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 • 343 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
ottimo Thank you Nicolas, great indicator, N. 1
tikigai Merci Nicolas! First Happy new Year 2020. Very good indicator BUT (yes the french "oui, m...
Nicolas Whats prorealtime version? Did you try in version prior to v11? indicator's call and loop ca...
Marcos Alvarez Dominguez Hello Nicolas, is it possible to stablish a bullish screener for this indicator when the cen...
Nicolas Please open a topic in the screener section to ask for this specific query.
zaher123 Hello, the indicator doesn't show up anything on the screen, any suggestions please?
Nicolas Apply it on the price chart. The indicator plot just one single line. There are two in the...
jamesoc Hi Nicolas, do you happen to know if there is an indicator that can be applied to charts, to...
gustavobp Buenos dias Nicolas, al agregar tu indicador no me reconoce la variable Price ni en la linea...
joobeng Sorry, I solved the problem. I have add the CBL indicator using the spanner icon on the pric...
Nicolas Adjust the price settings for the Y Axis to use the price only.
XXXXVII Hello Your indicator is interesting. However, I can't see the orange line. Do you have ...
Nicolas Definition of CustomClose: https://www.prorealcode.com/documentation/customclose/ [2] means...
Bard Just wondered Nicolas, say you had set DEFPARAM CumulateOrders = True, is there anyway for t...
Bard Sorry pls ignore last image, try this - it actually has the Dev Stop indicator! https://www...
Appsoluxions Hi Nicolas, do you have the MT4 version of the indicator? I am not sure if these kind of que...
Nicolas Hi, don't have one sorry. But you can still ask for private coding through our programming s...
Appsoluxions Cool. Thanks for the response.
Domenec Claro Juanjo de todas maneras en deinversoratrader.com tienes estsos osciladores evolucionad...
Dron Hola Domenec, en la descripción hablas del indicador velas de colores, no lo encuentro en la...
Domenec Hola Dron mira en el blog deinversoratrader.com en formacion indicadores ahi hay varios grat...
AGTrader Interesante, muy visual Doc. Felicidades!!!
Andraxx simplemente impresionante Dom...te sigo en youtube. Me ha gustado tu canal. Gracias por comp...
Steven Hi im looking for some help to put a automated code together BUY ORDER If EMA 10/25 is...
Dwell Thank you! Great tool!
odin hi luisella, i think breadth indicators a not available in pro realtime, because you the cal...
4example Thank you
Gaby333 to good to be true dosent do anything))
Caribeengeek Bonjour j’avais vu que vous proposiez d’écrire des codes pour ceux qui s’y connaisse pas Mai...
Caribeengeek Les devises unité
Nicolas Merci d'utiliser le forum pour les demandes de programmation personnalisée
Toto le Heros Thanks Nicolas. I read somewhere that in the calculation, we should round the value of the A...
Nicolas aADX = round(adx[10])
jebus89 Big thanks for sharing this :) Seems to work as expected, good stuff.
xpe74 Top visually, and very efficient. I would like to integrate it as a value in a small algo i...
swapping merci gabri, on va le mettre à l'essai ;)
GraHal Please forgive the daft question, but why is 3-bars-trailing-stop-williams-3.itf included a...
Kris75 Hi, Seems great but what would be the code for a stock ? Thanks, Chirs
oakenstream Paul, what is the best way in your opinion to know if I have over optimized?
Nicolas Your picture is too small, but for sure the problem is about the fact you are still using v1...
Rory Dryden Thanks. This looks useful.
Edelmiro Un millón... de gracias... me gustaría más, poder ofrecer euros; pero va a ser que no puedo,...

Top