New Members: Be sure to confirm your email address by clicking on the link that was sent to your email inbox. You will not be able to post messages until you click that link.

Ave Day Range

Hi Mark

How do I calculate Average Day Range(20) > 5% ?

I have tried ..."and [SMA(20, [Range/Close]) > .05]" which doesn't work?

... "and [100*Range/Close > 5]" works but it is not the average from a 20 day lookback?

Also to confirm Range = High - Low not ATR?

Many thanks


  • This doesn't work because the sma( ) function does not do custom calculations inside the parentheses - in your example "range/close"

    [SMA(20, [Range/Close])]

    So I don't think you can do it exactly the way you want, unless you can find and indicator that already does that calculation.

    But you could try these alternatives (which you might have tried already) to approximate what you want:

    // the average range over 20 days is greater than 5 % of today's close

    and [sma(20, range) > close * .05]


    //the average range is more than 5% of the average close

    and [ [sma(20, range) / sma(20, close)] > .05]

    Or, if you want the range to exceed 5% of the close for each of the past 20 days you would have to inspect each day, so

    and [ [high-low]/close > .05]
    and [ [1 day ago high - 1 day ago low] / 1 day ago close > .05]
    ... etc.

    Of the three, I think the second probably would give you results closest to what you want.
  • Hi Mark,

    What does this calculate: [PctDiff(sma(20, range),sma(20,close)) < 5]

    It gives lots more results than: [ [sma(20, range) / sma(20, close)] > .05]
    Many thanks

  • Good question. I can't get meaningful results with PctDiff. But I did notice your version asks for less than 5 % (<5). Mine asks for greater than 5 % (>.05).
  • I looked at the documentation for PctDiff. It is not explicit about which term is the denominator and which the numerator, or how the result is expressed - as a fraction, e.g. .05 or as a whole number, e.g. 5. Sorry I don't have the time to look into it more. Maybe Support can help.
Sign In or Register to comment.