Optuma Forums › Optuma Scripting › Double Exponential Moving Average › Reply To: Double Exponential Moving Average
May 28, 2020 at 6:54 pm
#58327

- Topics: 63
- Replies: 557
- Posts: 620
Ah in that case you will need to create both DEMAs using the different lookback periods. This will draw both using the Show Plot tool:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
//DEMA1; EMA1 = MA(BARS=10, STYLE=Exponential, CALC=Close); EMA2 = MA(EMA1, BARS=10, STYLE=Exponential, CALC=Close); //DEMA2; EMA3 = MA(BARS=30, STYLE=Exponential, CALC=Close); EMA4 = MA(EMA3, BARS=30, STYLE=Exponential, CALC=Close); //Calc DEMAs DEMA1=(2 * EMA1) - EMA2; DEMA2=(2 * EMA3) - EMA4; Plot1=DEMA1; Plot1.Colour = Green; Plot2=DEMA2; Plot2.Colour = Blue; |
To change it to a true/false boolean condition for a crossover in a Show Bar or Scan delete from Line 11 and replace with DEMA1 CrossesAbove DEMA2.
-
This reply was modified 9 months, 1 week ago by
Darren.