Simple Box/Range Scan?

What is the best way to define a range say in the last 2 years of price that is within say 20% price from low to high and is within that range the entire time? Even better would like to make sure it is more near a high, but the first part is where I really need to start. Thanks!

Comments

  • You would set up a statement that says the maximum price over two years - max(500, high) - is less than 20 per cent greater than the minimum price over two years - min(500, low) * 1.2.

    The 500 is because there are about 250 trading days in a year - 52x5=260 - 9 holidays = 251 x 2 = 502, round off to 500.

    If you want it near a high now you would ask for the current close to be greater than the min(500, low) * 1.18 or so.