ATRADX – Oscillator and trend follower by ADX and ATR

v10.3
ATRADX – Oscillator and trend follower by ADX and ATR

For some time now I wanted to have an indicator that would inform me about the progress (not the direction) of the current trend and its strength.

Many of you will be thinking that the ADX already fulfills that function, and in a certain way it is true. The ADX reports on the progress of the trend, and the distance between ADX and ADXr of its strength. But there’s a problem:

Those who know how the ADX is calculated will understand that if + DM and -DM are high, it gives a static signal. However, a value in range can be more or less volatile, and variations in its volatility indicate whether it is more or less likely that it will enter into a trend in a close manner.

Here comes into play the ATR, which was in fact programmed by J. Welles Wilder Jr, just like the ADX. In addition both indicators were published in 78 in the same book. You may ask yourself: But does not the ATR serve the same as the ADX?

Yes and no.

If the ADX grows, the ATR also tends to do so, especially the faster the trend. However, a strong trend with low noise and low ATR is possible.

Also the ATR has a problem, and that is expressed in absolute terms, so it does not make sense to compare the EUR / USD with BTC / USD and draw conclusions against their ATRs, since the first pair can be 0.008 in a day concrete and that of the second of 274. That is, more than 34,000 times greater.

I needed an indicator that would adapt to the value that was operating without too much adjustment, so I built a histogram that is a weighted sum of the relative variation of ATR and the distance between ADX and ADXr, with the possibility of adjusting the weight of each component as we wish .

Besides, representing the ADX in terms of 0 was not very useful, given that most times it will be at least more than 5. So it was a good option to give the possibility of setting line 0 at any value. For example in the classic 17 or 23 employees to discard side markets. In this way histogram and ADX are faced with the same baseline, as the MACD for example.

In the histogram I wanted to mark those combined ADR and ADX-ADXr values ​​that were extreme. A high value would mean a strong trend with high volatility, a nervous price. A value under the opposite, a quiet value, excessively quiet, with a remarkable compression, possibly to the corner of an explosion.

As an extra, I thought it would be interesting to add another high cut-off point to quickly see if a level was exceeded, from which trend collapse is very likely. This level appears as a line and if it is exceeded, a violet ellipse is drawn automatically.

Without coiling more, I leave the code and tell me what improvements we could apply.


Desde hace algún tiempo quería tener un indicador que me informara en conjunto el progreso (que no dirección) de la tendencia actual y de su fuerza.

Muchos estaréis pensando que el ADX ya cumple esa función, y en cierta forma es cierto. El ADX informa sobre la el progreso de la tendencia, y la distancia entre ADX y ADXr de su fuerza. Pero hay un problema:

Los que sepáis como se calcula el ADX entenderéis que si +DM y -DM son elevados, da señal estática. Sin embargo un valor en rango puede ser más o menos volátil, y las variaciones en su volatilidad indican si es más o menos probable que entre en tendencia de una forma próxima.

Aquí entra en juego el ATR, que de hecho fue programado por J. Welles Wilder Jr, tal y cómo el ADX. Además ambos indicadores fueron publicados en el 78 en el mismo libro. Quizás te preguntes: ¿Pero no sirve para lo mismo el ATR que el ADX?

Sí y no.

Si el ADX crece, el ATR también suele hacerlo, especialmente cuanto más rápida es la tendencia. No obstante es posible una tendencia fuerte con poco ruido y ATR bajo.

Además el ATR tiene un problema, y es que se expresa en términos absolutos, por lo que no tiene sentido comparar el EUR/USD con BTC/USD y sacar conclusiones enfrentando sus ATRs, dado que el del primer par puede ser 0,008 en un día concreto y el del segundo de 274. Es decir,

 

más de 34.000 veces mayor.

Necesitaba un indicador que se adaptara al valor que estuviera operando sin demasiado ajuste, así que construí un histograma que es una suma ponderada de la variación relativa de ATR y la distancia entre ADX y ADXr, con posibilidad de ajustar el peso de cada componente según deseemos.

Además representar el ADX en función de 0 era poco útil, dado que la mayoría de veces será, al menos, mayor a 5. Por lo que era una buena opción dar la posibilidad de fijar la línea 0 en cualquier valor. Por ejemplo en los clásicos 17 o 23 empleados para descartar mercados laterales. De esta forma histograma y ADX quedan enfrentados a la misma línea base, como el MACD por ejemplo.

En el histograma quería marcar aquellos valores combinados de ATR y distancia de ADX-ADXr que fueran extremos. Un valor alto significaría una tendencia fuerte con volatilidad elevada, un precio nervioso. Un valor bajo todo lo contrario, un valor tranquilo, excesivamente tranquilo, con una compresión notable, posiblemente a la esquina de una explosión.

Como extra, me parecía interesante añadir otro punto de corte alto para ver de forma rápida si se superaba un nivel a partir del cual es muy probable un colapso tendencial. Este nivel aparece como una línea y además si se rebasa, se dibuja automáticamente una elipse violeta.

Sin enrollarme más, os dejo el código y me decís qué mejoras podríamos aplicar.

Variables y valores por defecto:

ADXp 14

ADXcut 20

ADXhcut 60

ATRb 14

ATRp 2

ATRadj 20

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

avatar
Register or

Likes

avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar
Related users ' posts
Nicolas https://www.prorealcode.com/topic/ayuda-screener-indicador-perfect-trend-line/#post-51291
Manu L. Bonjour Nicolas, suite a une de mes precedentes demande dans le forum indicateur, j'ai touv...
AntoGH C'est selon moi le meilleur indicateur, que j'ai vu, si vous trouvez mieux dîtes moi car dif...
Jiacky mma = average[per,1](close) should be mma = average[per,1](close * 1000). Otherwise TDF will...
bolsatrilera Hi Nicolas, I have this version of the True Balance Power ,created by eykpunter on Tradingvi...
bolsatrilera and the code : REM TRUE BALANCE OF POWER // código original de eykpunter para la plataform...
flodefacebook Merci Nicolas pour cet indicateur. Très utile dans une technique de retournement.
HeikinAshi thank you for this very interesting indicator Nicolas! did you define a tradable setup fo...
JanWd Tried the code, nice concept, seems to work quit well for US/EUR 2hrs, Other markets seems n...
JR1976 Simple and nice code , congrats !!! Seems work well with TIme frame 1 h
phanz Hi all, Sorry revisiting an old post. This algo is simple, and simplicity is the ultimate ...
Steven Bahia Hi Nicolas - great indicator - is there a way to place a alert when the Oscillator crosses ...
Nicolas Alerts can't be programmed, you have to set them yourself with the Alert tool of the platfor...
Steven Bahia just to add to this would there be a way to establish a entry price from the Oscillator
juanj And the point of violation is the close of the candle that violates the line by generating a...
juanj For the latest version of the strategy or to follow updates and developments see the thread ...
phanz i backtested it with 10K units of EURUSD 1 hour i get an equity curve that is going one way ...
Wing Not yet but I plan to.
Leo Have a look in this Forum, I got something interesting for you... https://www.prorealcode.co...
Dávid Gyalus Dear Wing, As I am a daytrader, and one of my best friend is a programmer we think your a...
EchnatonX Hallo Im Demomodus bei IG habe ich das Problem, dass oft keine Orders ausgeführt werden kön...
Jan EchnatonX, nice late answer of me: Make the stop loss a percentage of the close, like 100/...
guleny Hello I made some optimization to make it better. But there are 5 transacttion which incr...
stratobast Good afternoon everyone. Thanks Doctrading for your work. I have an issue while using this ...
stratobast My bad guys. I understood what was the problem. The indicator uses highs and lows for the Re...
samwarduk Has anyone tried this on Bitcoin GBP1? The results look amazing but every time mine trie...
Kris75 Hi Bolsatrilera, I love this indicator! Thanks; => did you develop a strategy around...
Doctrading AH ok, I think the ca3 is the same : ca3 = pB[1] < 0.2 and pB < 0.2 Best regards,
chromosome21 Hello everybody, First, thank you so much for all your advices, I'm a begginer in trading a...
bertrandpinoy bonjour j ai un probleme avec ce code modifié, apparement PRT ne veut pas...avez vous une so...
rispardin no entiendo como funciana este indicador, por favor alguien podria explicar como utilizarlo???
AVT No se trata de un solo indicador, pero cada linea muestra otra información, de abajo hacia ...
IV Mcm Your indicator is interesting, I evaluated its relevance with the squeeze to detect the phas...
Kris75 Hi Gabri I launched a very simple strategy based on the 3 bars trailing stop that you cre...
TimDeCat Hi. Has anyone coded a version that you could alter it to say 5 bar trailing stop? ie make ...
Nicolas Please open a new topic in forums so we can code it there, thanks.
finplus bonjour, il y a un problème à la fin du code avec elsif (close 0 then ... ne manque t il pas...
kj1988 Hello Nicolas, thank you for this useful indicator. Could you tell me how I can remove the...
Nicolas remove lines 101 to 103
GraHal Yes sorry, I set up a link to a screen shot on my google drive and then I got locked into th...
gabri Here's the thread https://www.prorealcode.com/topic/multiframe-rsi-of-rsi/
Bernard13 Bonjour Nicolas, Pourriez-vous m'indiquer si cet indicateur fonctionne avec la V11 ? Le di...
nwesterhuijs Thanks, only saw it just now.
juanj For the latest version and discussions see the Ichimoku thread here: https://www.prorealcod...
Louwrens Hi Juanj. Thanks for this. I am tying it as we speak. It does not trade that often, which is...
poonsl2828 Hi! Francesco I have test it on GBP/USD but it only have a trade on 9 Jun which i backtes...
ullle73 why not use 1h chart? has 95% hitrate
ullle73 i see most of positions are only 1 pip before exit?
HeikinAshi Do you have an update of this indicator since you've created them, or is this still the actu...
mcha Thank you for this work. Do you try to transform/put this indicator on candlesticks and is ...

Top