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.
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?
0
Answers
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.
My understanding from @gord is you have to specify the time frame for every term, otherwise the scan engine assumes the default, which is daily. So for weekly it would be:
weekly max(14, weekly close) = weekly max(52, weekly close)
I'm not sure this makes a practical difference if you run the scan after Friday's close, because Friday's daily close is also the weekly close (unless it's a holiday).
But, if you run a weekly close during the week, it takes the most recent update as the weekly close (regardless of whether you specify weekly). If you run the scan as of yesterday's close, and yesterday is not Friday, it uses the daily close as the weekly close, even though the week is not over. So when you run the scan, to get true weekly results - that is, data for a full week for the last data element - you need to set the start date to the close of the most recent Friday (or last day of the week that was not a holiday).