♥ 0 |
Hi Pete, Please guide me to a scan for a 52 week high occuring intraday. This scan should show securities whose 52 week high was exceeded intraday. Thank you
Marked as spam
|
Private answer
It is not possible to write code for a Study Filter of a scan that can read the 52 week high from an intraday time frame. We can approximate this value but we cannot get it to exactly match the value you would compute from a weekly time frame. FYI, if you set a Study Filter to a weekly time frame and apply the following code it will trigger intraday if and when the price crosses above that previous 52 week high:
I don't understand why anyone would need to use an intraday time frame to get an alert for stocks crossing the 52 week high. When it's pretty obvious that you get the most accurate results by using the weekly time frame and you also get results throughout the current trading session. If the stock breaches that 52 high at 10:17 am on Monday, the weekly time frame scan will pick that up Monday at 10:17 am. If it breaches the 52 high at 2:36 pm on Thursday then the scan will pick that up Thursday at 2:36 pm For some reason many users of Thinkorswim believe that by using a lower time frame their scans will return faster results. This is not true and I explain why in the following video: https://www.hahn-tech.com/thinkorswim-scans-beginner-to-advanced/ The only intraday time frame that is able to get close to matching the accuracy of the scan I just described is the 1 hour, 2 hour or 4 hour time frames.Why? Because there are limitations to how much historical data is available to Study Filters of a custom scan. Details here: https://toslc.thinkorswim.com/center/howToTos/thinkManual/Scan/Stock-Hacker/studyfilters Note this approach is NOT as accurate as using the weekly time frame. But since you requested a solution for the intraday time frame I will provide that. But you must understand it is not as accurate and requires that you compute how many hourly bars are in a 52 week period. The first problem you run into is you have no way to compute how many holidays were withing that 52 week period. And you will never be able to include extended hours trade data in this scan because for the vast majority of stocks the number of bars during extended hours session changes from day to day. So lets take the example of a 1 hour time frame and compute an approximate value for the number of bars in a 52 week period. We know that without holidays there are 5 trading days in each week. 52 times 5 gives us 260 days. We can look at any 1 hour chart and count the number of bars in each regular session, which is 7. Now we multiply the number of trading days in 52 weeks and multiply that by 7, giving us a final value of 364. That's 364 hourly bars to approximate a period of 52 weeks. Close, but not exactly 52 weeks. After performing that computation we can derive a scan that works on a 1 hour time frame and comes close to a true 52 week high:
Looks exactly like the weekly scan doesn't it? The only difference is the number of bars used to find the target high. But this is not going to be as accurate as using the first scan and setting the Study Filter to a weekly time frame. Marked as spam
|
Please log in to post questions.