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.
The mark, last, ask and bid are all available from a watchlist. You raise a concern about the watchlist signaling only on the close of the candle. The way I structured the code is to check the high of the current and active bar against the previous high. This can trigger ”intra-bar” and does not wait for the close. As to the refresh rate of a watchlist, you have two things in play. One is the scan that you created and saved, that is then running in the watchlist. The other is the watclist itself. I have not tested the refresh rate but I have heard that during the high volumes of the regular markets hours it takes 3-4 minutes for signals in the watchlist to respond to underlying conditions.
You mentioned in your initial answer ”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….”
Can you set the scan to a specific timeframe or do you have to have a chart running in a specific timeframe thereby ”linking” the watchlist?
Sorry, I’m quite new to TOS
May have answered my own question after doing some Googling….
Do I set the the timeframe by using the period option eg. Highest(high(period=”DAY”)[1], length))?
Again, you really should be viewing our videos on stock scanners. We demonstrate this in nearly every single video on stock scanners. You cannot use secondary aggregation period within the study filter itself. Once you see where it is set, it will all make sense.