Does Pandas calculate ewm wrong? : <p>When trying to calculate the exponential moving average (EMA) from financial data in a dataframe it seems that Pandas' ewm approach is incorrect.</p>

<p>The basics are well explained in the following link:
<a href="http://stockcharts.com/school/doku.php?id=chart_school:technical_indicators:moving_averages" rel="noreferrer">http://stockcharts.com/school/doku.php?id=chart_school:technical_indicators:moving_averages</a></p>

<p>When going to Pandas explanation, the approach taken is as follows (using the "adjust" parameter as False):</p>

<pre><code>   weighted_average[0] = arg[0];
   weighted_average[i] = (1-alpha) * weighted_average[i-1] + alpha * arg[i]
</code></pre>

<p>This in my view is incorrect. The "arg" should be (for example) the closing values, however, arg[0] is the first average (i.e. the simple average of the first series of data of the length of the period selected), but NOT the first closing value. arg[0] and arg[i] can therefore never be from the same data. Using the "min_periods" parameter does not seem to resolve this.</p>

<p>Can anyone explain me how (or if) Pandas can be used to properly calculate the EMA of data?</p>
