PM Price > Yest High or < Yest Low

Robby Luca

New member
I would like to scan for the price (in afterhours) to be above yesterday's high or below yesterday's low.
I already have an afterhours scan that shows price change from yesterday's close.
Is there a way to use similar code? Instead of PrevClose to change it into PrevHigh and PrevLow?

def marketClose = 1559;
def Price =  close;
def today  = GetDay() == GetLastDay();
def dayHours = SecondsTillTime(marketClose) >= 0 ;

def PrevClose = if (dayHours[1] and !dayHours) or (dayHours[1] and !today[1] and today)
                #in case there was no afterhours trading
                then Price[1]
                else PrevClose[1];

plot PriceChange = Price - PrevClose;


There is already an exsiting indicator in ThinkorSwim called DailyHighLow which plot previous day's high and low. Pull that up in your scanner. Set up a condition like this:


Make sure you have the "EXT" option on. This will scan for current close above previous day's high.

Similar threads