Dual Distance From Average indicator

Dual Distance From Average indicator

I still debate myself between indicators that try to predict the future and those that illustrate a simplified view of the obvious market moves. I think that indicators that are very clear help in 2 ways: 1) indicating trades that are conceptually simple, that everybody understands and where you visualise your edge and 2) not forgetting to look at the basics.

This indicator won’t predict any future: it aims to put in a clear way what the market does, and it is conceptually very simple.

I use it for trend following. It measures the distances between price (smooth version of price) and moving averages (exponential, default of 70 and 200 as I use for Spanish stocks). The behaviour that I look for are bounces with (or close to) the 0 line. Interpretation: a bounce in the 0 line simply is the moving average acting as a support (if the bounce is a local minima) or resistance (if the bounce is a local maxima).

I use a smoothed version of the price (exp moving average, default 15) for 2 reasons: 1) close price on itself it gives too spiky signals that become more complex to interpret, 2) it is very common for price to pierce a moving average, but it is far less likely that a smooth version of close (i.e. another moving average) pierces it.

Finally, I print (red line) the distance between the 2 moving averages (70 and 200). This is simply to bring in the longer term trend (bull > 0, bear < 0) as well as MA crossings.

You may likely see this as a redundant indicator if you print your moving averages in the chart, and you will be right. This is just a way to bring moving average interpretation to a simplified form.

I hope someone finds it useful. Any feedback or comments are welcome!

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?

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

  1. Abz • 314 days ago #

    hello ,
    Thanks for this indicatior , what timeframe do you use it on ?

  2. camporan • 310 days ago #

    You can use it 5M onwards, but the longer timeframe the more accurate it is. My preferred are 30M and daily. Also, use your judgement to see if the bounces do happen historically: the edge is just likelihood, and the best way to know how good your edge is, is by looking at the past 🙂

  3. manchokcity • 306 days ago #

    can we have it in mql4 platform? or how or which platform do we use it?

    • camporan • 296 days ago #

      I don’t use MetaTrader so I won’t be able to do the translation myself. Sorry!

  4. Alexander9 • 16 days ago #

    This can for amibroker ? . Thanks

Register or


avatar avatar avatar avatar avatar avatar avatar avatar
Related users ' posts
XXXXVII Fixed ITF Trend Background //Indicateur CCI ID2 = CCI[50] => 60 ID3 = CCI[100] => 60...
Screw27 Hi man, I installed the indicator and i don't know why but my graph it is so big
HelixKing sounds interesting I'll take a look
Darren Nash Thanks Souhail, in the end i just copy/paste the logic with variables and it works. I rem...
Darren Nash One thing to note also for DOW trading if using IG, change the buy/sell qty from 1 to 2
mostafa samady How can I optimize it for DAX 30? Thanks!
born2trading hello Nicolas, sorry for off-topic question, but can you tell me what kind of indicator you ...
Nicolas Not an indicator but an option in PRT v11.
Screw27 Salut nicolas j'aimerais savoir tes résulats grace a cettte methode
eva.g.forsgren Jag får felkod på rad 56?
Nicolas This indicator only works on PRTv11 onwards.
Jan If you start PRT via your trading account at IG.com, the PRT version 11 is not available yet...
Nicolas Il faut l'appliquer sur le prix, en allant dans les paramètres du prix.
tonycom95 Bonjour Nicolas est ce que cet outil est utilisable sur les actions ? Désolé si ma question ...
Nicolas Bien sûr, pourquoi pas ?
Nicolas No, all codes on our website are to be used with ProRealTime: https://www.prorealtime.com/en/
Nicolas Poni qui la tua domanda se è correlata a questo indicatore, altrimenti apri un nuovo argomen...
bob789 Once you download it, how do you upload it into PRT? thanks
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
Jan Just run the code for this pair, make sure you have the right spread filled. What you could...
oxy75 Hello. I understood that we were waiting to choose two values ​​between 0 and 69 for the two...
Roi Aglipa Hi, Any way to project those 2 chosen averages (see below) on the chart? "Once MAType = w...
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...
swedshare You got some potential here. A couple of things I think about: 1, The opening hours in this...
phoentzs Ich habe hier mit Spread 2 gerechnet, also etwa dem Mittelwert zwischen Tag und Nacht. Das G...
phoentzs Hab festgestellt, das US500 fast noch besser funktioniert als der Dax. Was aber auch daran l...
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...
Alps007 Hi Nicolas. Happy New Year. Can you please program me several MACD divergence screeners ...
Arlei Zanin Hello Nicolas, would it be possible to convert the Cloud to Pascal language? Thank you.
ashee i want it in MT4
Nicolas Use the color variables R and G to test if the trend is bullish (R=0) or bearish (R>0).
s00071609 Where can i find the syntax to test the colour of the line, I am calling the indicator value...
Nicolas You should open a new topic to discuss about the strategy and its coding.
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...
scarphace38 Bonsoir, je découvre PRT et je n'arrive pas a afficher le meme résultat pour l'indicateur de...
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 !
Vonasi Sure that is possible. I will code it and make a post in the English ProBuilder forum and pu...
Vonasi Vama v2 with Hull moving average included can be found here: https://www.prorealcode.com/top...
JMat45 Thank you, Vonasi.