ATR miscalculating!
Forums › ProRealTime English forum › ProRealTime platform support › ATR miscalculating!
- This topic has 35 replies, 4 voices, and was last updated 6 years ago by Vonasi.
-
-
05/26/2018 at 11:43 AM #71388
I’m just in the process of transferring all my strategies away from PRT and stumbled over another bug in PRT I wasn’t aware of. I found already a bug a half year ago in PRT’s MACD (they mixed up the names of the lines) but now I had to notice that also ATR is calculated wrong by PRT.
PRT’s help function gives the correct description how to calculate the ATR but something goes wrong and the indicator gives wrong results.
If I check for example the daily chart of chicago wheat. The last ATR(14) value PRT gives us is 14,567 but if you calculate according to the formula one finds on the internet (or for example also in PRT’s help function) you get a value of 12,6429.
I checked this several times. Of course I would be happy if somebody could proof me wrong.
Anyway since ATR is an indicator used by many I think this is no unimportant find. I’m pretty annoyed by this I must admit. I use ATR in almost all my strategies and all are optimized with PRT’s ATR. Having adapted all strategies to a ATR that is calculated wrongly is not nice. :-S
1 user thanked author for this post.
05/26/2018 at 12:11 PM #7139105/26/2018 at 12:47 PM #71395I now found out little more. The difference in the ATR is caused by a difference in closing price of each bar. For high and low of each bar PRT is showing the mid price between bid and ask. This was what I also expected for the close but this isn’t the case. For the close it becomes strange. To give a concrete example:
I look at chicago wheat JUL-18 contract, daily bars. For the closing price of the 24th may IG gives me bid: 530.9, ask: 531.9, so the mid price would be 531.4. But when I look in the PRT chart I find for the close of the 24th may 530.8!
@Nicolas: Do you have an idea how this can be? It is the same for other days. High and low that PRT gives are exactly the mid prices between bid and ask but the closes are strange. Do you maybe know what PRT uses as closing price?05/26/2018 at 1:06 PM #71397Oddly this is not the case for all days. For example fridays close is just the mid price between bid and ask. But if one looks back a few days one finds several where this is not true.
This effects of course all indicators using the closing price. So I guess I really would like to know what closing price this is we see in PRT. 🙂
05/27/2018 at 2:02 PM #71419I just send the following to PRT. I hope I receive an answer:
“I’m wondering if you can tell me how PRT calculates the shown closing price. As pecified above I’m looking at the dailhy chart of the JUL-18 contract for chicago wheat. Fridays close is given with 544,6 which is exactly the midprice between the bid and ask price I get from IG. This is what I expected.
But now look at thursday (the day before). The bid and ask I get from IG are 530,9 and 531,9 respectively. The midprice would be 531,4. But if you look in the PRT chart I see a value of 530,8 which is obviously NOT the midprice. So how was this price calculated?
For wednesday (the day before) it is similar. The midprice according IG would be 530,6 but instead PRT shows 531,1 (this happens to be IG’s ask price for the close of this day).
Tuesday is again completely different. IG’s midprice is 522,9 but PRT shows 521,1. It continues in this fashion. Can you please explain?
It is easy to understand that this difference in closing price has a major impact on amost all indicators because they more or less all make use of the closing price in some way.”05/27/2018 at 4:44 PM #7143105/28/2018 at 8:48 AM #7148105/28/2018 at 12:12 PM #7151105/28/2018 at 12:38 PM #7151406/04/2018 at 11:21 AM #72197Dear PRT,
Can you PLEASE answer at least this report? I really need this info to port my strategies to another environment. This should be in your interest because after I’m gone you will receive less reports (or even none!) from me. 😉
06/04/2018 at 11:48 AM #72200I got exactly the same value between a personal code of the ATR and the platform one:
123456789101112period = 14//True range calculationd1 = Dhigh(0)-Dlow(0)d2 = abs(Dhigh(0)-Dclose(1))d3 = abs(Dlow(0)-Dclose(1))dailyTR =max(d1,max(d2,d3))atr = wilderaverage[period](dailyTR)return atr06/04/2018 at 11:50 AM #7220206/04/2018 at 12:00 PM #72204Of course you do. Please read what I wrote above. The miscalculations are caused by PRT showing a wrong closing price (not the midprice between bid and ask). Your code is using the same close as the builtin ATR so the results are identical. But please compare the bid and ask of the close you can retrieve from IG with the close PRT uses. I can’t make sense to the strange PRT-close. This observations are from the daily chart, I have not checked how it is with other timeframes.
This affects all indicators using the close, ATR is just an example.
06/04/2018 at 12:11 PM #7220606/04/2018 at 12:15 PM #72207I can’t provide any screenshots now since I’m on my way to the airport but I wrote exact examples in #71419. Just open your IG platform and have a look at the bid/ask for the days mentioned and compare them to the close for the day in question PRT shows you. Then you will see…
-
AuthorPosts
Find exclusive trading pro-tools on