
Re: Calculate Extended Moving Average (EMA)
Gysbert Wassenaar Mar 14, 2013 2:08 PM (in response to Leslie Blumenfeld )EMA is a recursive calculation. That can't be done in an expression afaik since an expression can't reference itself. You can calculate it in the script using the peek function. But that's not very dynamic since you can't vary x. Maybe you can use R.
edit: fixed some typos, i.e can to can't

Re: Calculate Extended Moving Average (EMA)
Leslie Blumenfeld Mar 14, 2013 2:00 PM (in response to Gysbert Wassenaar )You're saying that it "can" reference itself? Do you have an example of this?

Re: Calculate Extended Moving Average (EMA)
Rod Stewart Jan 8, 2014 11:53 PM (in response to Leslie Blumenfeld )I know this thread is a bit old but for the sake of posterity I'd thought I'd point out that a chart expression CAN reference itself. For example, I've had a quick go at doing an exponential moving average with a period of 9 and a weighting of 0.2 where the expression has the Label "EMA9":
if(RowNo() = 1, Data, (Data  Above(EMA9)) * .2 + Above(EMA9))
Technically I guess I shouldn't be starting the EMA from row 1 the way I have, but I hope it gives you the idea.
Cheers,
Rod



Re: Calculate Extended Moving Average (EMA)
Leslie Blumenfeld Jun 14, 2014 5:30 PM (in response to Leslie Blumenfeld )Rod, That turns out to be exactly what I did. I simply named the column and then referred to the column by name in the row above. I just never got to post the result.