I try to discourage folks from using the 1 min time frame for scans. The scans on Thinkorswim run on the server and not locally on the user's computers. There is a heavy load on those servers during market hours, especially during the first several minutes of the regular session.
In most cases the lag time for the scan generating results will exceed 1 minute. Which makes most scans based on 1 min time frame useless on Thinkorswim. Users of Thinkorswim should always try to use the highest time frame possible in order to reduce the lag time.
This is especially true for scans of this nature. The scan must process every 1 min bar in the last 11 trading sessions in order to produce results in this type of scan. The only way to reduce that processing load is to use a higher time frame. Higher time frames cause the number of bars that must be processed to be reduced. Which results in scans that run faster.
Here is the best solution I can provide free of charge in the Q&A Forum:
def regularSessionOpen = SecondsTillTime(930) == 0;
def regularSessionClose = SecondsTillTime(1559) == 0;
rec trackHighestHigh = if regularSessionOpen then high else if high > trackHighestHigh[1] then high else trackHighestHigh[1];
rec trackPreviousDayHigh = if regularSessionClose then trackHighestHigh else trackPreviousDayHigh[1];
plot signal = close > trackPreviousDayHigh;
The close of the regular session market (1559) is set for a 1 min time frame. Anyone who needs to use a different time frame will need to be adjusted so that it matches whatever time is stamped on the last bar of the regular trading session.
This code will trigger for each and every bar that trades above the previous day's highs. Adding additional code to trigger only the first bar that crosses is more than I can provide free of charge in the Q&A Forum.
Screenshot below shows what this looks like on a chart and shows how to setup the Study Filter of the scan.