Profile Picture


Posted By mark0419 9 Years Ago
Nuclear Posted Friday October 24 2008
I have noticed what appears to be a problem in the ATR indicator. It seems that the AverageTrueRange indicator is not averaging the true range values correctly. When calculating the ATR for a period of 1 the values are what you would expect. However, when using a period of 2 the result values deviate significantly from a 2 period average of the true range.

To test this I created my own implementation of the ATR indicator and ran it in a system with the RE version. Both indicators where instanced twice, once with a period of 1 (the base line), and once with a period of 2 (the test). The system simply wrote out the values to a log file.

I then imported the first few rows of the data into an excel spreadsheet and added some manual calculations which illustrate the issue. Both the data file and the spreadsheet are included in the attached zip file. I can also provide the test system and ATR code for debugging / comparison if needed.


Attachments (311 views, 23.00 KB)
Posted Friday October 24 2008
The ATR uses a form of exponential moving average instead of a simple moving average.  It also uses the high minus the low for the first bar's true range value, where the true range indicator returns NaN for the first bar.


Posted Friday October 24 2008
Thanks for the swift reply Daniel. I just used a simple average so that would explain the difference. I have not heard of a true range calculation using this technique. Could you elaborate a little on what form of ema is being used by the atr indicator?


Similar Topics

Reading This Topic

2005-2017 © RightEdge Systems