title: EMA function (pack TTR) - Invalid N
body: <p>I'm having some trouble to create a loop using EMA function.</p>
  
  <pre><code>for(i in c(1,2,3)){ 
  
  paste("Q",i,"$",tick[i],"_EMA10", sep="") = EMA(na.locf(paste("Q",i,"$",tick[i]),sep=""),10)
  
  }
  </code></pre>
  
  <p>Where <code>tick = c(AAPL,MSFT,NQ)</code> and <code>Q1</code>, <code>Q2</code>, <code>Q3</code> are xts tables, hence the objective of this loop is to run through all the xts tables, take each value of colums as input and create new column with the values on the xts tables.</p>
  
  <p>Expected result would be as if i run individually below:</p>
  
  <pre><code>Q1$AAPL_EMA10 &lt;- EMA(na.locf(Q1$AAPL), 10)
  </code></pre>
  
  <p>Problem is that i get error "Invalid N" and I cannot seem to sort it out. Could you please help out?</p>