Page 30 of 62

Adaptive ATR

Posted: Wed Apr 29, 2020 10:27 pm
by Jimmy
I'm not sure if this one has already been shared by our members but here is another nice new code from Mladen which I think would be very useful for traders is his Adaptive ATR for MT4.

Thanks to Mladen for creating some valuable tools for the older platform and also releasing the source codes :)

As explained by Mladen:
This is an adaptive ATR for metatrader 4.

Apart from being adaptive, there is one more deviation in it - it is calculating average range (not average true range). The difference is subtle but it exists. It means that unlike the average true range (that checks if there was a gap when compared to previous bar), this indicator is calculating average range of high to low. And that is it. It is, as it is obvious from previous description, "ignoring" the gaps and that way it is calculating only the "effective" ranges.

Re: Adaptive Indicators for MT4

Posted: Sun May 03, 2020 9:11 pm
by tatlongtruong
Holmes27 wrote: Wed Apr 22, 2020 12:16 am

MrTools would you mind adding alerts on colour change please? This indicator seems really good for riding a trend.

Thanks as always

Holmes27
May I ask does this indi repaint?

Re: Adaptive Indicators for MT4

Posted: Mon May 04, 2020 1:17 am
by mrtools
tatlongtruong wrote: Sun May 03, 2020 9:11 pm

May I ask does this indi repaint?
No repaint, buy please feel free to back test to help verify.

Re: Adaptive ATR

Posted: Mon May 04, 2020 4:29 pm
by ionone
Jimmy wrote: Wed Apr 29, 2020 10:27 pm I'm not sure if this one has already been shared by our members but here is another nice new code from Mladen which I think would be very useful for traders is his Adaptive ATR for MT4.

Thanks to Mladen for creating some valuable tools for the older platform and also releasing the source codes :)

As explained by Mladen:
This is an adaptive ATR for metatrader 4.

Apart from being adaptive, there is one more deviation in it - it is calculating average range (not average true range). The difference is subtle but it exists. It means that unlike the average true range (that checks if there was a gap when compared to previous bar), this indicator is calculating average range of high to low. And that is it. It is, as it is obvious from previous description, "ignoring" the gaps and that way it is calculating only the "effective" ranges.
there is a problem though. when passed through the strategy tester : when a new bar opens, the ATR value is lowered quite a lot compared to previous value, and it happens on each bar. The reason is that you use the high minus low, and this value is zero at the opening of the bar. this is not accurate for live situations I think.
Is there a solution to this ?
could you make an adaptive ATR but with the same behaviour as the well known ATR?
or I guess we could just use previous value, that would be accurate

see the screenshot here, taken just after bar opening

Re: Adaptive Indicators for MT4

Posted: Tue May 05, 2020 4:44 am
by cinare
mrtools wrote: Tue Apr 28, 2020 2:22 am

Arrows added.
Hi MrTools, thank you so much for this indi! I cannot believe how accurate it is on all timeframes with the default settings. I am having so much suc6 with this one. Then I use your adaptive Jurik for extra signals if it is in the same direction. Works out pretty well. THANK U!

Re: Adaptive ATR

Posted: Tue May 05, 2020 4:58 am
by mrtools
ionone wrote: Mon May 04, 2020 4:29 pm

there is a problem though. when passed through the strategy tester : when a new bar opens, the ATR value is lowered quite a lot compared to previous value, and it happens on each bar. The reason is that you use the high minus low, and this value is zero at the opening of the bar. this is not accurate for live situations I think.
Is there a solution to this ?
could you make an adaptive ATR but with the same behaviour as the well known ATR?
or I guess we could just use previous value, that would be accurate

see the screenshot here, taken just after bar opening
screenshot.04-05-2020 08.30.14.jpg
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--) 
   { 

Re: Adaptive ATR

Posted: Tue May 05, 2020 8:01 pm
by ionone
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

Re: Adaptive Indicators for MT4

Posted: Wed May 06, 2020 5:32 am
by cinare
Hi MrTools,

I have a question about two of your indi's. They are for MT4. Do you also have them for MT5? Or do you code strictly for MT4?

Re: Adaptive Indicators for MT4

Posted: Fri May 08, 2020 7:14 pm
by Holmes27
tatlongtruong wrote: Sun May 03, 2020 9:11 pm

May I ask does this indi repaint?
I don't think so, as far as I can tell during the period I've been observing it.

Regards

Holmes27

Re: Adaptive Indicators for MT4

Posted: Fri May 15, 2020 6:39 am
by Mula
mrtools wrote: Thu Sep 20, 2018 6:24 am Mladen's Rsx of alb averages converted it to mt4.

About the indicator from Mladen::

RSX (Relative Strength Quality Index) that does not use "pure" price for calculation but uses adaptive lookback average filtered price for calculation

Of price filtering for rsx :

The advantage of using the filtered (smoothed) price is that some of the false signals are filtered out at the source itself (by averaging the price) and it the is omitted (the false signal) in the RSX calculation too. Also, since the average is adaptive it implicitly makes the RSX adaptive too

ALB averages that can be used :

simple moving average
exponential moving average
smoothed moving average
linear weighted moving average
triple exponential moving average
smoothed linear weighted moving average
nonlag moving average
linear regression value (lsma)
double smoothed exponential average
Usage :

Some experimenting with parameters is advised, but the usage of this RSX is the usual : either use the slope or some significant levels crossing for signals
Hi Mr Tools, do you by any chance have this exact indicator with mobile/email alerts?