Adaptive ATR-ADX Trend

v10.3
Adaptive ATR-ADX Trend

Constructs the trailing ATR stop above or below the price, and switches
directions when the source price breaks the ATR stop. Uses the Average
Directional Index ( ADX ) to switch between ATR multipliers. The higher
multiplier is used when the ADX is rising, and the lower ATR multiplier
is used with the ADX is falling. This ADX criteria further widens the gap
between the source price and the trailing ATR stop when the price is trending,
and lessens the gap between the ATR and the price when then price is not
trending.

The ATR-ADX stop is effectively a double adapative stop that trails the price,
by both adapting to the true range of the price, and the average directional
change. When the stop is below the price (long trade) the value never decreases
until the price intersects the stop, and it reverses to being above the price
(short trade). When the stop is above the price it will never increase until
it is intersected by the price. As the true range and ADX change, the stop
will move more quickly or more slowly.

First, if the ‘Above Threshold’ box is checked,the falling (smaller) multiplier
will be used regardless once the ADX rises above a certain threshold (default > 30).
The ATR will effectively rise faster once the price enters ‘very trendy’ mode.
Typically, ADX > 20/25 is used in classic ADX trading (which I have found
unprofitable through backtesting). The idea behind this extra multiplier criteria
is that once the price starts trending ‘very’ well, a top/bottom is likely near,
and when that top comes the price will quickly rebound. Experienced traders know
exactly what I am describing. Play around with an ADX/DI indicator using this
stop system in tandem and it will be found that many successful trades are entered
when the market is not trending (i.e. < ADX < 25), and exited once/if the price
enters ‘very trendy’ mode above 30 and the ATR changes (stopped out).

Second, heiken-ashi bars can be introduced to the ATR stop system. This is the same
thing as just switching the chart to Heiken Ashi mode, but without having to change
the plotting type. I find this useful, so that things like pivot lines can be
preserved to their correct calculations, while the benefit of heiken ashi bars can
still be enjoyed. Be advised that with each tinkering that extends the life of the
ATR trend, the odds of that same trend changing near the top/bottom are reduced,
so as always there is a trade-off to maximize the time spend in a trade and nailing
a top or bottom.

Third, Different source prices can be used. I have found that HLC3 is best because
it keeps the price from being stopped out in very key areas, set as the default.

Fourth, alert conditions are introduced so that the trader can be warned when the
ATR-ADX changes. These can be used by right clicking the strategy and clicking
“Add Alert…”. Reference the bottom of the script for the names of the alert
conditions.

(original code and description from its author: mortdiggiddy, all credits goes to him).

Code translated from TradingView (pinescript) code by a request in the english forum.

 

Share this

Risk disclosure:

No information on this site is investment advice or a solicitation to buy or sell any financial instrument. Past performance is not indicative of future results. Trading may expose you to risk of loss greater than your deposits and is only suitable for experienced investors who have sufficient financial means to bear such risk.

ProRealTime ITF files and other attachments : How to import ITF files into ProRealTime platform?

PRC is also on YouTube, subscribe to our channel for exclusive content and tutorials

  1. Pepsmile • 06/29/2018 #

    Thanks Nicolas !

  2. Demon • 06/29/2018 #

    Merci beaucoup pour cette contribution au catalogue des stops.

  3. stefou102 • 06/29/2018 #

    Thx Nicolas! trying to test this indicator in an automated strategy but I’m becoming crazy because when I call the indicator and then simply Graph it in the chart result, there is a discrepency in the value of the indicator vs it’s “called” version in the strategy. How is that possible? In the strategy I’m calling it via the command

    • Nicolas • 06/29/2018 #

      In this case, I suggest to add the indicator’s code directly into your strategy.

  4. stefou102 • 06/29/2018 #

    mystoploss=call “Adaptative ATR-ADX”(MedianPrice)
    GRAPH mystoploss as “Adapt”

  5. schilds • 06/29/2018 #

    Nicolas, Could you explain lines 35, 37 and 38 please. Unless I’m missing something they can result in a division by zero attempt.

    • Nicolas • 06/29/2018 #

      Should not if adxlen variable is superior to 0.

  6. AussieTrader • 06/29/2018 #

    Nicolas, Can you explain the numerator logic – e.g. Line 35 is (sTR[1] – sTR[1]) which would appear to be either null or zero.

    • Nicolas • 06/29/2018 #

      You are right, this is useless. Since I converted it from another programming language, I assume it was in the original code…

  7. Ass13 • 06/29/2018 #

    bonjour nicolas j’aime bcoup votre indicateur

  8. bharatjai • 06/29/2018 #

    Script ‘Adaptive ATR’ has been saved
    line 24: no viable alternative at input ‘lr’

    Getting above error. Please help to resolve the same.

    • Nicolas • 06/29/2018 #

      download the itf file and import it into your platform.

  9. Francis3332 • 240 days ago #

    Bonjour à tous,
    J’aime beaucoup cet indicateur et j’aimerais pouvoir l’utiliser sur la dernière version de prorealtime V12 avec l’option “Utiliser une autre pèriode” cad pouvoir, par exemple, visualiser l’indicateur en 3mn sur un graph 2mn.
    Quelqu’un pourrait-il m’aider ?
    Merci d’avance.
    Bonne journée.
    Fran6

avatar
Register or

Likes

avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar

+20 more likes

Related users ' posts
P. Marlowe Muy bueno. ¿Podría hacerse para señalar extremos por el lado bajista? Lo mismo a la inversa....
Miro Esta es una versión del indicador, para ambos extremos. //-------------------------------...
P. Marlowe Muchas gracias ¡¡
Regisnew très bel indicateur merci
jordan //---settings MAmode=0 Period=150 NumberOfMA=100 //---end of settings MA2=undefined ...
jordan dites moi si cela correspond à ce que vous cherchez
kats bonjour merci de ta reponse mais non ca fonctionne pas sympa quand même d'avoir essayé cdlt
Faisalx Hola Ivan. Thanks for your great job. I would appreciate if you have look at my request http...
roccafragius Thank you for all these useful information!! Very great job Ivan! THank you so much
geroniman Merci Ivan, super travail. On peut toujours compter sur toi pour apporter des innovations su...
Iván Allora crei un nuovo post. Lo aspetterò.
Stenozar Ciao Ivan, ho inserito il post con la richiesta di traduzione. Se puoi vedere, grazie!
Iván perfect!
larouedegann TIMEFRAME(15minutes) apparemment ne fonctionne pas
Iván Bonjour Je ne comprends pas bien le problème. L'indicateur fonctionne dans n'importe quelle...
larouedegann OUI je le sais, il fonctionne dans toutes les unités de temps. Mais je souhaite utiliser l'i...
Bernard13 (Je réécris mon commentaire -français- en français car certains mots ne correspondaient pas ...
Iván 1000 indicateurs !!! brutaux
Doddge Hola Iván, ¿sería posible crear un screener que indique cuándo las velas coloreadas del indi...
RTR Ivan thank you for the pro-screener. I a trying to understand how to write the signals from ...
Iván Hi, Lines 62 and 63. These lines define buy and sell conditions.
Iván
11 months ago
winnie37 Hi Ivan, if i want to use it, and call the oscillator value (in grey, green or red), how to...
Iván The oscillator is smoothtype. In inputs there is de lag to configure the output
Nicolas
2 years ago
FXtonio Bonjour Nicolas, merci pour cette merveille, je l'utilise en compl2ment du "magical buy sell...
xpe74 Bonjour Nicolas, quelle est la valeur de MA que l'on doit prendre en compte pour intégration...
Nicolas Il faut faire un CALL de l'indicateur et y placé en paramètre les valeurs des périodes souha...
mfejza also, for long trailing stop d2=low d1=lowest[3](d2)+1/3*AverageTrueRange[20](close) d3...
CederTrader Hi Denis, does this indicator add to the chart as panel, or on the candles. Thanks
Nicolas Add it on the price chart as described in this video: https://www.prorealcode.com/blog/video...
Denis Hello Nicolas and Ceder Trader, Sorry, I only just saw your replies. The indicator is alre...
Xenotrax A première vue, sa à l'air d'être un indicateur très puissant sur de petites temporalités, j...
merri Bonjour Nicolas, Comment transformer cet indicateur en bot sur PRT ?
Nicolas Cela a déjà été fait, voir ce sujet: https://www.prorealcode.com/topic/strategia-con-lindica...
zilliq Thanks @Nicolas. I tried to use it as Trend in a proorder system, but don't know why, it doe...
Suzu Yuk He is right. MT and mavgMT are not defined and causing errors.....
StephFor //ind1 = ZigZagPoint[2*averagetruerange[200]](close) avr = 3 //3% ind1 = ZigZag[avr](close...
Manu L. @Steph un grand merci pour ton aide mais :-( J'ai copier le code tel quel mais cependant j...
AlphaMauss Je n'ai pas réussi à faire fonctionner l'indicateur avec le code fourni en commentaire sur P...
Pensera Bonjour Nicolas, comment est-il possible de backtester cet indicateur? cela fait une erreu...
Nicolas Oui bien sûr, il doit y avoir pas mal de sujets dans le forum à ce propos.
simmerseb Bonjour, merci beaucoup pour cet indicateur je le trouve très clair et pertinent.
Nicolas Oui c'est possible. Merci de ne pas poster des demandes qui sont hors sujets. Pour les deman...
Igor Merci pour cet itf. Question : comment faire pour instruire un screener ?
Nicolas tester le croisement du Close avec la première valeur de l'indicateur : "TrailingStop", faci...

Top