How exactly ATR is calculated in MT4?

 

There are several topics on this already but they usually explain differences in ATR values between various trading platforms, I can't get the correct values with MT4's own downloaded data.

I saved MT4 chart as .csv file and calculated ATR according to rules on this page: http://stockcharts.com/school/doku.php?id=chart_school:technical_indicators:average_true_range_a

Then I compared the result with the data shown on the chart itself, OHLC values are exactly the same, MT4 shows first ATR value for day 16 (I'm calculating 15-day ATR) and it's different. I've even tried to calculate exponential moving average but still no luck.

You can check all the numbers and formulas here, ATR values from MT4 I entered manually

https://docs.google.com/spreadsheet/ccc?key=0Aq6BoCDk6eoWdElfUXpXMWItbllybkI5X19UOFJ6c1E&usp=sharing

I've made that document editable, feel free to correct anything that is wrong, but probably create a separate sheet for any massive editing.

 
stangoesagain:

There are several topics on this already but they usually explain differences in ATR values between various trading platforms, I can't get the correct values with MT4's own downloaded data.

I saved MT4 chart as .csv file and calculated ATR according to rules on this page: http://stockcharts.com/school/doku.php?id=chart_school:technical_indicators:average_true_range_a

Then I compared the result with the data shown on the chart itself, OHLC values are exactly the same, MT4 shows first ATR value for day 16 (I'm calculating 15-day ATR) and it's different. I've even tried to calculate exponential moving average but still no luck.

iATR: https://www.metatrader5.com/en/terminal/help/indicators/oscillators/atr and source: https://www.mql5.com/en/code/7807
 
  1. MT4 uses SMA( tr )
  2. Some platforms use EMA( tr )
  3. Your http://stockcharts.com/school/doku.php?id=chart_school:technical_indicators:average_true_range_a specifies
    Current ATR = [(Prior ATR x 13) + Current TR] / 14
    which is an MMA (Modified moving average) An alpha of 1/n (1/14) corresponds to a EMA (exponential moving average) of period = 2n - 1 (27)
Reason: