bigmit2011
New member
From what I understand something like the code below would only work
if we are still within 9:45 and 10:00 time frame,
but how would I still be able to find stocks that
have the below pattern (first bar is green bar, and the second bar is engulfing red)
for first two 15 mins bars, if I check midday or EOD.
if we are still within 9:45 and 10:00 time frame,
but how would I still be able to find stocks that
have the below pattern (first bar is green bar, and the second bar is engulfing red)
for first two 15 mins bars, if I check midday or EOD.
Ruby:
input SecondBar = 0945;
input DurationMins = 15;
def durationSec = durationMins * 15;
def secondsPassed = SecondsFromTime(SecondBar);
# open[1] is first 15 mins while open is the second bar
def pattern = (open[1] < close[1]) and (low < low[1]) and (high > high[1]) and (open < close)
def timeCondition = if secondsPassed > 0 and secondsPassed <=durationSec then 1 else 0
plot scan = pattern and timeCondition