Adding EMA to ATR
You want a 14 period of the ATR. Generate it each bar:
#define EMAperiodATR 14 int start(){ static datetime Time0; bool newBar = Time0 < Time[0]; if (newBar){ Time0 = Time[0]; double EMAalphaATR = 2.0/(EMAperiodATR+1), ATR = iATR(NULL, 0, ATR.Period, 1); static double EMA.ATR; EMA.ATR += (ATR - EMA.ATR) * EMAalphaATR; } ...
Wow, and this will be the EMA14 of the ATR?
In an EA, how can you add an EMA to the ATR, because ATR is very low like .0004 and EMA is obviously much higher. Is there a way to put the EMA inside the ATR??
I am trying to create an EA for this strategy:
https://www.mql5.com/go?link=http://forex-strategies-revealed.com/advanced/30min-atr-breakout