I have a scanner that looks for 3 green bars with higher highs and higher lows intraday.
The issue I am having is that the scanner produces results for stocks that have 2 green bars in a row with higher highs and higher lows during the current trading session and would also include a green bar with higher highs and higher lows from the previous day. Please advise on how to exclude previous day conditions so that my scan will only produce results for condition met during the current trading session?
Code:
def startTime = SecondsTillTime(0945) >= 0;
def endTime = SecondsFromTime(1545) >= 0;
def timeEnabled = !(startTime or endTime);
def greenCandle = close > open;
def higherHighs =
high > high[1] and
low > low[1] and
high[1] > high[2] and
low[1] > low[2];
plot scan = timeEnabled and
((greenCandle[3] and greenCandle[2] and greenCandle[1])
or (greenCandle[4] and greenCandle[3] and greenCandle[2])
or (greenCandle[5] and greenCandle[4] and greenCandle[3])
or (greenCandle[6] and greenCandle[5] and greenCandle[4]))
and (higherHighs or higherHighs[1] or higherHighs[2]);
The issue I am having is that the scanner produces results for stocks that have 2 green bars in a row with higher highs and higher lows during the current trading session and would also include a green bar with higher highs and higher lows from the previous day. Please advise on how to exclude previous day conditions so that my scan will only produce results for condition met during the current trading session?