#### Howdy, Stranger!

It looks like you're new here. Sign in or register to get started.

Options

# Scanning for New High/Low within x number of days

Hi,

I am trying to write a code for a new 63 day high close any time within the last 20 days and conversely a new 63 day low close within the last 20 days. Is this possible and practical bearing in mind the number of permutations?

• Options
mod
I'm assuming you want both events to occur within the last twenty days. You could test for the max 20 day close equal to the max 63 day close, and the min 20 day close equal to the min 63 day close. That should catch any permutation. Note the 20 days and the 63 days includes the most current close, so if you run the scan during the day, and set the starting day to the most recent intraday update, the scan will count today as one of the 20 and 63 days. If you don't want that, set the starting day to the last closing date. You will probably get some hits where the high occurs first and others where the low occurs first.

• Options
Thanks.
Actually it was for 2 separate scans as part of an Up-trend and Down-trend. I thought I may have to write out 20 lines of text but using [max (20, close) = max (63, close)] and [min (20, close) = min (63, close)] does the job fine.

I also wanted the same on a week basis and eventually got to [weekly max (14, close) = weekly max (52, close)] after trying to figure out where to put the word weekly.
• Options
mod
edited February 2016