I'm trying to set up a ORB Scan that is linked to a watchlist that will alert me. I only want to be alerted for breakouts or breakdowns that happen between 10am and 11am, however. Can anyone offer a helping hand into what I would need enter into the ThinkScript so that it only scans for crossovers (breakouts/breakdowns) between a certain timeframe?
Much appreciated.
This is what I'm working with right now that I'm so grateful to have gotten from this site.
Much appreciated.
This is what I'm working with right now that I'm so grateful to have gotten from this site.
Code:
script ORB_Mobile {
# ORB for TOS Mobile App
# Mobius
# V01.08.2018
def o = open;
def h = high;
def l = low;
def c = close;
def OpeningBell = getTime()[1] < RegularTradingStart(getYYYYMMDD()) and
getTime() > RegularTradingStart(getYYYYMMDD());
def RTH = getTime() >= RegularTradingStart(getYYYYMMDD()) and
getTime() <= RegularTradingEnd(getYYYYMMDD());
def ORActive = getTime() >= OpeningBell and
getTime() <= RegularTradingStart(getYYYYMMDD()) + 1800000;
def ORH = if OpeningBell
then h
else if ORActive and
h > ORH[1]
then h
else ORH[1];
def ORL = if OpeningBell
then l
else if ORActive and
l < ORL[1]
then l
else ORL[1];
plot ORhigh = if !ORActive and RTH
then ORH
else Double.NaN;
ORhigh.SetStyle(Curve.LONG_DASH);
ORhigh.SetLineWeight(3);
ORhigh.SetDefaultColor(Color.GREEN);
plot ORlow = if !ORActive and RTH
then ORL
else Double.NaN;
ORlow.SetStyle(Curve.LONG_DASH);
ORlow.SetLineWeight(3);
ORlow.SetDefaultColor(Color.RED);
def ORmeanActive = getTime() >= OpeningBell and
getTime() <= RegularTradingStart(getYYYYMMDD()) + 300000;
def ORmeanH = if OpeningBell
then h
else if ORmeanActive and h > ORmeanH[1]
then h
else ORmeanH[1];
def ORmeanL = if OpeningBell
then l
else if ORmeanActive and l < ORmeanL[1]
then l
else ORmeanL[1];
plot ORmean = if !ORmeanActive and RTH
then Round(((ORmeanH + ORmeanL) / 2) / TickSize(), 0) * TickSize()
else Double.NaN;
ORmean.SetStyle(Curve.LONG_DASH);
ORmean.SetLineWeight(3);
ORmean.SetDefaultColor(Color.YELLOW);
# End Code ORB for Mobile App
}
def ema = movavgexponential(close, 21);
#bullish
#plot breakthrough = close crosses above ORB_Mobile()."ORhigh" within 2 bars and (ORB_Mobile()."ORhigh" - ORB_Mobile()."ORlow")/ema < .025;
#bearish
plot breakdown = close crosses below ORB_Mobile()."ORlow" within 2 bars and (ORB_Mobile()."ORhigh" - ORB_Mobile()."ORlow")/ema < .025;