Better True ATR

This topic contains 16 replies, has 4 voices, and was last updated by avatar Leo 10 months, 2 weeks ago.

View all attachments
Viewing 15 posts - 1 through 15 (of 17 total)
  • #54616

    Good |Day Everyone

    I am looking for some inputs regarding calculating a better true reflection of ATR rather than just using the simple ATR calculated over n amount of periods.

    My thoughts here are to get rid of the extremes (suxh as price spikes) that tend to skew ATR.

    So two approaches I have tried so far is;

    Calculating the Median ATR using i.e. 3 data samples;

    Or taking i.e. 3 ‘random data samples and calculating the average (although this will still contain extremes)

    Does anyone else maybe have some thoughts around this?

    1 user thanked author for this post.

    Just wrote this to calculate a 5 data sample Median ATR value Disclaimer: I haven’t checked my logic on this yet, so might be incorrect.



    Why not using a simple long term average of ATR of X periods? This is a real median IMO:



    Noticed the start of my loop at line 6 got lost: For N = 0 to 4 Do


    @nicolas, I didn’t really think of that to be honest. Will try it and see what gives the most consistent results.


    Sorry about that, I’m currently upgrading some things in the website and text formatting errors sometimes appear.. I’m hoping to fix the issue this week 😐 


    Noticed the start of my loop at line 6 got lost: For N = 0 to 4 Do

    Are you sure about N, not T instead? (I’ll update the code)


    Yes sorry it is T and on line 6 not 9. Replying from my phone. 


    Also realize I only required half of the If’s as for a uneven number I only have to measure one side of the values to find the median.



    I have found that instead of calculating the ATR over the entire barindex as suggested below:

    To rather focus on the actual trading period that my algorithm usually runs i.e. between 09h00 and 22h00.

    I can even calculate this for the last n trading sessions/days to get a better average.


    Or you could use a minimum of a long period and short period ATR to smooth out the spikes.

    Indicator with three ATR values for comparison attached.

    1. Lowest-ATR-of-2.itf

    @vonasi. clever.

    However at this stage I am still getting the most consistent results by sampling from different periods and using an average among them.



    Plotting a graph of your ‘sampling from different periods’ calculation I still get some very big spikes. I don’t know what you are using the ATR results for but if it was for setting Take Profits or Stop Losses this could leave you to some very big TP and SL positions. My ‘lowest of 2’ calculation removes these spikes but at the price of less sensitivity of what is actually happening right now. I am yet to persuade myself that ATR is of any benefit for setting TP and SL positions as it is either too lagging or too spikey.  As a method of seeing market volatility it is however quite good – ATR is increasing so something is happening!


    I use it as follow:

    At position open calculate dynamic TP and SL thresholds using ATR*x (point where TP and SL will be trailed based on then current volatility). Thus it is simply to calculate the level where TP and SL will become applicable in order to give the price enough wiggle room to ‘decide’ on direction. I also update the threshold level at specific times during the day.


    If you find a way to get good TP and SL sizing from ATR then please share it as I’m yet to find any method that works consistently due to the laggy/spiky thing!

Viewing 15 posts - 1 through 15 (of 17 total)

Create your free account now and post your request to benefit from the help of the community
Register or