Ok let’s break this down into your three main time spans. You can adapt it as needed. The dynamic watchlist is achieved very simply by creating and saving a custom scan. Then from the watchlist you select that saved scan as your watchlist. From that point, the scan runs dynamically in the watchlist. The very last line of code I provide is used to color the background of a custom watchlist column based on your conditions.
This one can be set to daily time frame and it will compare the current bar’s high to the highest high in 252 trading days, roughly 52 weeks.
plot scan = high > Highest(high[1], 252);
This one can be set to hourly time frame and it will compare the current bar’s high to the highest high in the previous 7 hours. (seven hourly bars in a day)
plot scan = high > Highest(high[1], 7);
This one can be set to a daily time frame and it will compare the current bar’s high to the highest high in the previous 5 days (one trading week)
plot scan = high > Highest(high[1], 5);
In order to color the background of a custom column in the watchlist we’ll need to add a single line to any of the scans listed above. The install this in a custom column in your watchlist:
AssignBackgroundColor(if scan == 1 then Color.GREEN else Color.BLACK);
In order to cover the other side (lowest low in period), you should be able to adapt the code samples given to achieve the results you requested.
In order to show the number of times a previous high has been breached requires a very complicated solution that is not provided in the scope of this forum.
Thanks for the info.
So there’s no way to incorporate the code into the scan itself, it can only be added as a custom column in the watch list after you’ve specific scan criteria to limit the tickers?
I know there’s a limit of 300 rows per custom column or something to that effect which limits scanning the entire market for new highs/lows
I don’t understand the question here. Perhaps I should have gone into more detail. You wanted a dynamic watchlist. That is accomplished by creating and saving a custom scan. Then opening that saved scan in a watchlist. Thus ”incorporating the code into the scan itself”. The part that is added to the custom column merely changes the background color based on the condition.
Hi
I understand the creation of a dynamic watchlist from a saved scan. What I meant was, is there a way to have the custom scan limit the results to those stocks near their x day(s) Hi/Lo because I see there is an option in the scan to add a study filter.
So the watchlist will then contain only stocks near their Hi/Lo and the custom column will then highlight those that reach/surpass their HiLo.
Hope I’ve explained it better this time
Tx
Sorry. My responses in the Q&A forum are made in the context of our published videos. Since you are asking about the option to add a study filter to a scan, it seems you have not seen any of our videos on customized stock scanners. I’m sure after you view several of our videos in the Scan category things will clear up. We provide many examples of adding a study filter to a custom scan, along with code samples to download.