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
kats Bonsoir, Pensez vous pouvoir répondre à ma question posée ci dessus? Ce serait vraiment tr...
Iván Bonjour L'ensemble de l'indicateur est alimenté à partir de la ligne 9 avec la définition d...
kats BONSOIR c bon merci j ai trouve ce weekend merci de votre reponse cdlt
Gaspare Ciao Ivan si puo' inserire una strategia su questo indicatore per ottimizzare le variabil...
Iván Hi! You should change $rbox, $gbox and $bbox variables. Also r,g,b for last box.
finplus Thanks Ivan.
roccafragius Ivan, I just want to say you.. very very great job!!!! Thank you so much for this indicator!...
Iván
4 weeks ago
Iván Si lo descargas e importas en tu PRT verás que se han creado las variables para luego config...
WhyAskOZ Hi, Ivan As always you are doing great coding. The code works on my PRT, however the issu...
Iván You can delete in the last line (return) the configuration for color. Delete coloured(xx,xx,...
P. Marlowe Quite an impressive work, Iván. Extremely useful and accurate. Congratulations. Keep it up¡
lkiklkik i love it !!! thanks.
Stenozar Hi Ivan, can you translate from tradingviwe the EMA TREND METER INDICATOR? It couid be inte...
Iván Hi Yes I can. Please, create a new topic for that I will translate it.
Stenozar Hi Ivan, I've created a new topic about the indicator: https://www.prorealcode.com/topic/ema...
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 Hi You should delete from the indicator code all drawing functions and all variables not us...
Iván I've created a screener to show [longcondition or shortcondition]
Chrisinobi Hallo Ivan, Danke das ist Perfekt !! Kannst du bitte in der Screener-Bibliothek die itf. hoc...
MaoRai54 Thanks, now it's OK. in your first code at line 15-16 it's missing.
Madrosat Hello Ivan Did you try a strategy with this indicator
Iván Hi. No I didn't. This is a code translation requested by an user a few days ago.
Iván
3 months ago
cjr30 Simplemente modifica las lineas 19 y 21 por las siguientes: drawtext("▲",barindex,low-0.1*a...
groelandes Gracias!!
WhyAskOZ i copied the code into strategy and it gives error on line 21 and 23. it says " Line 1: ...
Iván
3 months ago
Madrosat Hello Ivan You have interesting topics on indicators , smart supertrend, optimised trend t...
Iván Hi! thanks. All of these codes are translations requested in the forum. I've on mind to back...
Raspete01 Buenos días Iván, estoy intentando llevar el código eliminando los colores y pasando un Back...
Iván
3 months ago
ARLEQUIN49 Hello Ivan, Would it be possible to convert the code of this QQE MOD indicator which accomp...
ARLEQUIN49 here is the code: //@version=4 //By Glaz, Modified // study("QQE MOD") RSI_Period = i...
Iván Hi, Yes I can translate it but please, create a new topic for it.
Fgats quelques explications en Français ici : Some explanations in French here : https://www.p...
Nicolas Merci pour cette contribution, j'apprécie ! :)
Fgats Merci Nicolas pour ces encouragements et merci aussi pour le commentaire en Anglais accompa...
Alai-n I really like it when you develop ideas around price movement! I am much less a fan of all t...
elcortijoverde Muy buen trabajo.Intuitivo y claro.Gracias por tu dedicación y aportación.
Nicolas
9 months ago
B-Xtrender
B-Xtrender
8
Indicators
616248 Bonjour Nicolas, Peux tu nous expliquer le principe de fonctionnement ? Ou nous mettre un...
Nicolas Le lien vers l'article IFTA de l'auteur est dans le post déjà :)
P. Marlowe Very poweful indeed. It deserves close attention. I really appreciate very much IFTA backgro...

Top