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
Vinks_o_7 Vonasi you're a beast !!! ;-)))
pableitor Amazing indicator , you are pushing PRT to the limit! But looking at the scatter its not c...
supertiti Bonjour Nicolas, Je ne comprend pas bien , le trend change de couleur quand les prix sont a...
Nicolas Oui ce serait possible, cependant l'indicateur est bien prévu pour conserver la couleur de l...
supertiti Quand tu pourras si tu peux nous coder la troisième couleur cela améliorerait les trades cou...
Nicolas How to import file page: in the help section of the website explains howto
kenssa import through the indicator page/window in the Proreal time
chicoteca Buenas, no consigo que se me muestre en el chart de DAX. ¿Cómo procedo? Gracias.-
Nicolas remplacer les valeurs de coloured(0,255,0) par coloured(r,g,b) et ajouter ces noms de variab...
mohamed merci Nicolas!
sacram14 Merci Nicolas pour ce set-up que je ne connaissais pas ! J'ai tenté de reprendre le code pou...
Ciccarelli Franco Per lasciare che la strategia venga eseguita (dopo aver importato il file): Basta eliminare...
JADINVEST Hello Jan, hello everyone, Thanks Jan for this strategy! Since 2020, have any of you found a...
Alessandro Furlani Hi Ian, hope you still use PRT and so you can read this post. I have tested a lot your work ...
Stockastiss Can this code be simply transferred into Backtestingcode so one doesnt need to use call ? (i...
Vonasi Sorry for the late reply. Add the code to your strategy and remove line 5 and line 39. Chang...
viktorthunss Hi! How many averages are there? Can I see the somewhere?
leofi https://www.prorealcode.com/topic/simple-average-with-visual-color/
leofi Go visit www.prorealcode.com/topic/simple-average-with-visual-color/ and watch 2em post
Dritan Hi,I am new on Prorealtime and coding.I downloaded the indi but I have it on a separate wind...
Nicolas Just add it on the price series.
yomisadiku Hello Nicolas, Can I use high and low price at lines hh=max(hh,close) and ll=min(ll,close) ...
Nicolas Yes you can do that, the impact will be that the trailing stop line will be much close to th...
Byggtrader Hi Nicolas! How do I get the indicator in the price chart? It only stays under i new chart.
Nicolas Just add it on the price chart by using the wrench on the left upper side of the chart (pric...
Dom Hello, hello....je commence le trading et découvre par la même occasion le codage....et ce n...
Nicolas Merci, ça fait plaisir !
Be-n Bonjour tout le monde ! Dans l'indicateur de tendance, j'ai du mal à saisir la nuance entre ...
Globalmarkets79 Thank you Vonasi for the answer. I have an other question. When i tried to run the indicator...
Vonasi Lines is either 0 or 1 to turn on or off the drawing of them. Once again if you download and...
Globalmarkets79 Thank you Vonasi, this indicator is very helpful!!!
Nicolas
6 years ago
Bateson Merci pour la réponse Nicolas. C'est bien ce que j'ai fait mais ça ne fonctionne toujours pa...
Enzo Paliotti Veramente ottimo, era quello che cercavo, si potrebbe modificare inserendo come variazione a...
Nicolas Perché no, chiedetelo con una descrizione dettagliata nel forum degli indicatori, per favore!
jiddan78 how to convert to afl amibroker ?
Nicolas We do not supply free coding assistance for AFL Amibroker on the website. You can ask for pa...
Ngomsi @ Vonasi, how to use timeframe , 13 minutes ,21 minutes, 34 minutes,et 55 minutes with this...
manchokcity can we have it in mql4 platform? or how or which platform do we use it?
camporan I don't use MetaTrader so I won't be able to do the translation myself. Sorry!
Alexander9 This can for amibroker ? . Thanks
riz001 thnk u
geroniman bonjour Nicolas, j ai un indicateur le Tiger . J aiemrai placer des fleches buy et sell dire...
Nicolas Merci de formuler les demandes sur le forum. ça n'est pas le bon endroit et hors sujet ici ! ;)
avatar
Anonymous Hi robertogozzi - thank you very much for sharing this strategy. I have performed various ...
robertogozzi Thank you samsampop.
Dotan Hello guys I really appreciate this coding effort but can I use this code for Mt5 Forex Trad...
JJ Tec Hola. Me gustaría contactar contigo para ver la estrategia..
nilsla1981 Has someone already tested in real ?
Lucas0000 Hola. estoy buscando un programador en proorder, para hacer un programa basado en el Q-trend...
LucioleLucide Clean view, thanks for sharing
dertopen hi where i can found the window for candle configuration?
paolosab69 Ciao! . I have seen the pictures that explain this metod but i don't understand when is mome...
Thomas
6 years ago
Thomas Como? no intiendo. Can you write in english . It works! Download the itf file.
Thomas New Version comin soon...
CHARLESRACHELLE OLA NAO SERVE PARA MT4?
Vinks_o_7
6 years ago
IV Mcm I've always wondered how to make the ADX faster, thank you!
Vinks_o_7 You welcome !
Vinks_o_7 Another variation that may be more accurate : we calculate the average of normalized DI's in...

Top