English

## ATR formula used in MT4 indicator is not original

Back to topics list To post a new topic, please log in or register
 207 Rasoul 2014.08.02 14:30   I was studying Average True Range indicator that I realized the calculation used in standard MT4 indicator is different than original formula. The calculation of ATR in MT4 is based on following formula:ATR[i] = ATR[i-1] + ( TR[i] - TR[i-n] ) / n; // n is the ATR periodBut the original formula as described in the book New Concepts in Technical Trading Systems is:ATR[i] = ( ATR[i-1] * (n-1) + TR[i] ) / n; // n is the ATR periodDoes anybody know what the rationale behind this different calculation of ATR is?
 145 graziani 2014.08.02 14:45 #   many of implemented indicators are different compared to original.in case of Wilders indicator, one of the reason would be optimization: Welles was calculating practically everything manually, so he was optimising calculations in favour of calculation speed on the cost of precision.
13126
WHRoeder 2014.08.02 20:23 #

 ATR[i] = ATR[i-1] + ( TR[i] - TR[i-n] ) / n; // n is the ATR period This is the SMA(n, TR) that mt4 uses. ATR[i] = ( ATR[i-1] * (n-1) + TR[i] ) / n; // n is the ATR period This is the MMA(N, TR) which equals EMA(2N-1, TR) original. ATR[i] = ATR[i-1] + (TR[i] - ATR[i-1]) / n; // n is the ATR period Same but without magnifying round off errors. ATR[i] = ATR[i-1]  + (TR[i] - ATR[i-1] ) * 2/(N+1); This is EMA(N, TR) that some other platforms use.

207
Rasoul 2014.08.03 17:05 #

WHRoeder:
 This is the SMA(n, TR) that mt4 uses. This is the MMA(N, TR) which equals EMA(2N-1, TR) original. Same but without magnifying round off errors. This is EMA(N, TR) that some other platforms use.

Thanks for your explanation! It is now clear for me why the formula that MT4 uses is different than the original formula.

To add comments, please log in or register