title: Using TTR package to calculate Exponential moving average
body: <p>Curious if anyone used it. I did a simple EMA operation on a time series. But wasn't able to reconcile very well. </p>
  
  <p>I read that the value of the update constant = 2/(N+1). I defined <code>x = 1:20</code>, and did <code>EMA(x,5</code>). Then I did an EMA computation using the recursive computation. The two results don't really line up</p>
  
  <p>The function returns</p>
  
  <pre><code>EMA(x,5)
   [1] NA NA NA NA  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18
  </code></pre>
  
  <p>And my little thing gives me, </p>
  
  <pre><code>EMA
   [1]  1.000000  1.333333  1.888889  2.592593  3.395062  4.263374  5.175583  6.117055  7.078037  8.052025  9.034683 10.023122 11.015415 12.010276 13.006851 14.004567
  [17] 15.003045 16.002030 17.001353 18.000902
  </code></pre>