how do I write a scan script for Maximum range over 30 days starting today

Hello I would like to write a scan script for "Maximum range over 30 days starting today is greater than maximum range over 15 days starting today". This scan is from trend trading for a living. I read the introduction to advanced scanning but could not find the answer. Thank you for your help

Comments

  • You need to use the max( ) and min( ) functions.

    The maximum range for a period of time is the difference between the highest high in that period and the lowest low in that period. So if the period you are looking at is x bars long, the range for that period would be max(x, high) - min(x, low).

  • Thanks. so screen for "Maximum range over 30 days starting today is greater than maximum range over 15 days starting today" the script would be [max(30, high) - min(30, low) > max(15, high) - min(15, low)]?
  • great. thanks a bunch!!!