Attachments forums

List of attachments posted on this forum.


All files on forums: 134177

Re: Adaptive ATR

ionone, Tue May 05, 2020 8:08 pm

mrtools wrote: Tue May 05, 2020 4:58 am

Try changing line # 60 from

Code: Select all

int i=rates_total-prev_calculated; if (i>rates_total-1) i=rates_total-1; for (; i>=0 && !_StopFlag; i--) 
   { 
to this

Code: Select all

int i=rates_total-prev_calculated+1; if (i>rates_total-1) i=rates_total-1; for (; i>=0 && !_StopFlag; i--) 
   { 
it changes absolutely nothing lol
the problem is not a simple indexing issue, it's the algorithm that has been made so it behaves that way.
the ATR never uses high minus low with such importance in the computations, it uses close minus PREVIOUS low and previous high minus close AND high minus low (the max value of these)
so at the opening of the bar, it still maintains a value that is coherent.
But by affecting more weigth to current high minus low, it make the indi behave incoherently during the duration of the candle, getting closer and closer to an acceptable value as we get closer to the end of the bar.

Of course this is not a problem is you use the close value of the previous candle, but it can be a problem if you use the Adaptive ATR value of the current bar, in a live situation

EDIT :
here is my version, and as you can see the curve doesn't drop at the opening of the bar, and the two curves are pretty similar.

cheers

Jeff
All files in topic