The first assumption is that you do not intend to run this scan during the last few seconds of the first 5 min candle. Which would be required if we were not careful to design the code so that it carries the value forward through the rest of the trading session. You did not include such details in your request so I had to consider how the vast majority of our viewers would be most likely to run this scan.
The time frame for this scan is entirely up to you. The code does not need to know what time frame is being applied to the Study Filter. I have included a user input to adjust the percent threshold without modifying the logic or structure of the code. Notice there are two separate signals in this scan. One for each direction. This allows our viewers to select whichever direction they want to run this scan.
This scan will only work as requested if extended hours session is excluded from the Study Filter.
input percentThreshold = 0.5;
def newDay = GetDay() <> GetDay()[1];
def trackPercentChange = if newDay then 100 * (close / close[1] - 1) else trackPercentChange[1];
# use this to scan for percent change greater than threshold
plot scan = trackPercentChange > percentThreshold;
# use this to scan for percent change less than threshold
#plot scan = trackPercentChange < -percentThreshold;