indicator ATR bug report

Forums ProRealTime English forum ProBuilder support indicator ATR bug report

Viewing 2 posts - 1 through 2 (of 2 total)
  • #91554

    Average True Range is computed based on TR with Wilders smoothing method like (w/ period 14):

    ATR = (ATR[1] + TR/13) / 14

     

    So here is the bug:

    the atr curve, also the value of:

    return AverageTrueRange[14]((close*0.1))

    look like quite different than:

    return AverageTrueRange[14]((close*1))

     

    In principle, both two are the same but with value diff. order by ten.

    Everyone can try this and saw the difference.

     

     

    The attachment is DAX with ATR 20 (top one is default, and the bottom one is function “return AverageTrueRange[20]((close*0.1))“). You may see the result of close * 0.1 is totally ridiculous high (why it is so high with reduced close values?).

     

    If you don’t get the point, you can read this function:

    miniprice = close * 0.1
    return AverageTrueRange[20]((miniprice))

     

     

    ps. You might guess: “Oh maybe the difference is due to the exponential behavior…”. But wait, you can also try to compare it with the exponential behavior indicators like EMA(close), EMA(close/10), and see that the EMA is quite normal that the difference of results among close, close/10 is merely by ten.

    You even can write your own atr and see that yours is quite different from the default atr.

    #91601

    Average True Range is calculated with:
    True range is the highest data in absolute value among :

    (today’s high – today’s low)

    (today’s high – yesterday’s close)

    (today’s low – yesterday’s close)

    When you apply a factor like the way you did, it is applied only on the selected price serie and for each bar in the period, so the result cannot be the same as a real factorization of the ATR value:

    If you want to factorize the returned value of the indicator, you should use this kind of syntax:

    or

    and you’ll get the exact same value divided by 10.

Viewing 2 posts - 1 through 2 (of 2 total)

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