OutsideTrades
New member
Hi everyone! I'm looking to make a simple scan for stocks where the first 15m bar (9:30 to 9:45) has a low below the pre market low but then closes back above the pre market low, and vice versa for the opposite direction. This is the code that I have and I feel like it should work but its not turning up any results for some reason. Am I missing something obvious?
Thanks a bunch in advance!!
Code:
input RTHStart = 0930;
input RTHEnd = 1600;
input PremktStart = 0000;
input PremktEnd = 0929;
def isPremkt = SecondsFromTime(PremktStart) >= 0 and SecondsTillTime(PremktEnd) > 0;
def isFirstBar = SecondsFromTime(RTHStart) >= 0 and SecondsTillTime(RTHStart + 15) > 0;
def premktHigh = if isPremkt then Max(high, premktHigh[1]) else premktHigh[1];
def premktLow = if isPremkt then Min(low, premktLow[1]) else premktLow[1];
// Only on 9:30–9:45 bar
def sweepUp = isFirstBar and low < premktLow and close > premktLow;
def sweepDown = isFirstBar and high > premktHigh and close < premktHigh;
plot scan = sweepUp or sweepDown;
Thanks a bunch in advance!!
Last edited by a moderator: