MTF Adaptive ATR

MTF Adaptive ATR

True Multi-Timeframe Dynamically Adapting ATR

This is actually a major overall to an earlier indicator I submitted to the library. The idea behind this indicator is to provide us with an Average True Range indicator than instead of the standard ATR indicator which is calculated with a static look back period, rather give us an ATR indicator that will only look at the most relevant price data. This means the indicator will (depending on the timeframe selected) only consider either market hours, after market hours or current weekly data. In this way, the sampled price data will always be relevant. The look-back period used to calculate the ATR will thus dynamically adapt as the trading day or week progress.

Explanation of the parameters:

  • TFMinutes: This parameter is used to input the current timeframe in minutes. (So for 5m TF set the parameter to 5, for hourly set it to 60)
  • TFMultiplier1: Those too lazy to work out higher timeframes you can use the multipliers. (Hourly TF is: TFMinutes = 1 and TFMultiplier1 = 60)
  • TFMultiplier2: Extention to the above functionality. (4-Hour TF is: TFMinutes = 1, TFMultiplier1 = 60 and TFMultiplier2 = 4)
  • stdDev: Standard deviation used to calculate the Relative ATR line
  • RecentDataPer: What percentage of the lookback period to sample for the SampledATR calculation (Recent Data)
  • MiddleDataPer:  What percentage of the lookback period to sample for the SampledATR calculation (Middle Data)
  • EarlyDataPer: What percentage of the lookback period to sample for the SampledATR calculation (Early Data)
  • ShowCalculationPeriod: Can be enabled to show a line on the indicator with the lookback period used for calculations
  • UseCloseOpenvsHighLow: If enabled will use open and close values instead of high and low to calculate the Total Price Range
  • GMTOffset: This is used to offset the GMT time difference in the code. (Default is set to GMT+2)
  • MarketOpenHour: Enter the hour (24hr) in which the market opens
  • MarketCloseHour: Enter the hour (24hr) in which the market closes
  • EnableAfterHours: Enable to calculate ATR values for after hours

Indicator Output Explained:

  • The black histogram shows the total price range for the evaluated period (be that for in-market hours, after-market hours or current weekly data)
  • The pink line called ‘Relative ATR’ shows the standard deviation adjusted ATR value based on the evaluation period
  • The green line called ‘Sampled ATR’  shows the averaged ATR as sampled over the 3 different data sets (within the evaluation period)

Possible Interpretations:

  1. When the black histogram expands it signifies that price is breaking higher or lower and expanding the current trading range.
  2. When the black histogram increases in steps without remaining static for extended periods we can assume the market is trending
  3. When the black histogram remains static we can assume the market is consolidating or ranging (watch for expansion)
  4. When the pink line rises with the green line we can assume that volatility is increasing
  5. When the pink line falls with the green line we can assume that volatility is decreasing
  6. When the pink line and the green line diverge we can assume a possible direction change is probable
  7. When either the pink line or the green line extends above the histogram it implies current volatility is extreme
  8. When the pink line stays high relative to the histogram it implies market is choppy with no clear direction
  9. When the pink line  stays low relative to the histogram it implies the market has a lot of momentum and trending

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

Register or


avatar avatar avatar
Related users ' posts
3 months ago
juanj I have actually completely redesigned this indicator with loads of improvements, so will res...
Brisvegas Thats Awesome thank you
Bard Thanks for this great addition. How would you "finish the syntax" if you were to use an ALMA...
Bard Problems with Safari latest s/ware and this site and links and adding code. Let me add the...
ottimo Congratulations Nicolas, What should I do for the 2 files I have to add them both in the gr...
Nicolas Only the "//PRC_StepALMA-VHF Hi/Lo band" is required, it uses the second code automatically....
ottimo Thank you Nicolas, great indicator, N. 1
jissey Bonjour Bolsatrilera,j'essaie de vous contacter pour le cm rsi ;je le trouve interessant, m...
jissey J'essaie de vous contacter pour l'indicateur"cm rsi"....
Tradingrob Hi Nicolas, when i upload this indicator in my list and use it as indicator. I get a totally...
Nicolas Apply it on the price chart. The indicator plot just one single line. There are two in the...
joobeng I get area of shading above and below a horizontal line. How can I post a picture here ? Thanks
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.
Nicolas Should not if adxlen variable is superior to 0.
AussieTrader Nicolas, Can you explain the numerator logic - e.g. Line 35 is (sTR[1] - sTR[1]) which wo...
Nicolas You are right, this is useless. Since I converted it from another programming language, I a...
AGTrader Interesante, muy visual Doc. Felicidades!!!
Andraxx simplemente impresionante Dom...te sigo en youtube. Me ha gustado tu canal. Gracias por comp...
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
jebus89 Big thanks for sharing this :) Seems to work as expected, good stuff.
Nicolas Des nouvelles ?
Whisper74 Hi Nicolas, I have build supertrend in excel for research and database purposes, but I actua...
Nicolas Sorry, I can afford to make custom programming for everyone. If you want to have codes trans...
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...
Wilko In answer to SAM: The Logic of the cover clause containing the same logic as the entry-claus...
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
JanWd Dear Gabri, could you explain why you have used "RitMensNoRiskTitle" ? In the formula [ ...
JanWd add it as a default variable, to be found on top if you make the indicator Kind regards, Jan
gabri JanWD, in the original sharpe formula (made for portfolios) this is the return for a no-ris...
gabri Grazie, con ETF to consiglio anche uno screener basato su questa strategia https://www.pror...
Alex975 Grazie della dritta.. testerò il tutto.
guillermus69 is this " a= log(close/close[1])" better than a = ((close/close[1]) -1) *100 . I ...