title: Conver a loop from Pinescript to Python
body: <p>Im tryng to convert this formula (WMA Moving Average) for loop in <em>Python</em> from <em>Pinescript</em>
  but <code>for i to x</code> not exist. I tried <code>for i in range(x)</code> but seems dont return same result.
  What exactly means <code>to</code>? Documentation of Pinescript said means <code>from i to x</code> but i dont find the equivalent in Python</p>
  <pre><code>pine_wma(x, y) =&gt;
      norm = 0.0
      sum  = 0.0
      for i = 0 to y - 1
         weight = (y - i) * y
         norm := norm + weight
         sum := sum + x[i] * weight
      sum / norm
  
  plot(pine_wma(close, 15))
  </code></pre>
  <p>Python Code:</p>
  <pre><code>import pandas as pd
  
  dataframe = pd.read_csv('dataframe.csv')
    
  def formula_wma(x, y):
      list = []
      norm = 0.0
      sum = 0.0
      i = 0
      for i in range(y - 1):
          weight = (y - i) * y
          norm   = norm + weight
          sum    = sum + x[i] * weight
          _wma = sum / norm
          list.append(_wma)
          i += 1
      return list  
  
  wma_slow   = formula_wma(dataframe['close'],45)
  dataframe['wma_slow']   = pd.Series(wma_slow, index=dataframe.index[:len(wma_slow)])
  
  print(dataframe['wma_slow'].to_string())
  </code></pre>
  <p>Output:</p>
  <pre><code>0       317.328133
  [Skipping lines]
  39      317.589010
  40      317.449259
  41      317.421662
  42      317.378052
  43      317.328133
  44             NaN
  45             NaN
  [Skipping Lines]
  2999           NaN
  3000           NaN
  </code></pre>