Hi,
I found this:
https://tosindicators.com/indicators/opening-range-breakout
was wondering if this ORB indicator can be modified so it can plot as show on expansion as well?
input entryType = {default wickTouch, closeAbove};
input openingRangeStartTimeEST = 930;
input openingRangeEndTimeEST = 1000;
input tradeEntryStartTimeEST = 1000;
input tradeEntryEndTimeEST = 1100;
def openingRange = if SecondsTillTime(openingRangeStartTimeEST) <= 0 and SecondsTillTime(openingRangeEndTimeEST) >= 0 then 1 else 0;
def openingRangeHigh = if SecondsTillTime(openingRangeStartTimeEST) == 0 then high else if openingRange and high > openingRangeHigh[1] then high else openingRangeHigh[1];
def tradeEntryRange = if SecondsTillTime(tradeEntryStartTimeEST) <= 0 and SecondsTillTime(tradeEntryEndTimeEST) >= 0 then 1 else 0;
def openingRangeLow = if SecondsTillTime(openingRangeStartTimeEST) == 0 then low else if openingRange and low < openingRangeLow[1] then low else openingRangeLow[1];
#plot highCloud = if openingRange then openingRangeHigh else double.nan;
#plot lowCloud = if openingRange then openingRangeLow else double.nan;
#highCloud.setDefaultColor(Color.Gray);
#lowCloud.setDefaultColor(Color.Gray);
#AddCloud(lowCloud, highCloud, color.gray, color.gray);
plot tradeEntryHighExtension = if tradeEntryRange then openingRangeHigh else double.nan;
plot tradeEntryLowExtension = if tradeEntryRange then openingRangeLow else double.nan;
tradeEntryHighExtension.setPaintingStrategy(PaintingStrategy.Horizontal);
tradeEntryLowExtension.setPaintingStrategy(PaintingStrategy.Horizontal);
tradeEntryHighExtension.setStyle(Curve.Short_Dash);
tradeEntryLowExtension.setStyle(Curve.Short_Dash);
tradeEntryHighExtension.setDefaultColor(Color.Gray);
tradeEntryLowExtension.setDefaultColor(Color.Gray);
def bullEntryCondition;
def bearEntryCondition;
switch(entryType){
case wickTouch:
bullEntryCondition = tradeEntryRange and high > openingRangeHigh and high[1] <= openingRangeHigh;
bearEntryCondition = tradeEntryRange and low < openingRangeLow and low[1] >= openingRangeLow;
case closeAbove:
bullEntryCondition = tradeEntryRange and close > openingRangeHigh and close[1] <= openingRangeHigh;
bearEntryCondition = tradeEntryRange and close < openingRangeLow and close[1] >= openingRangeLow;
}
def bullishORB = if bullEntryCondition then 1 else if !tradeEntryRange then 0 else bullishORB[1];
def bearishORB = if bearEntryCondition then 1 else if !tradeEntryRange then 0 else bearishORB[1];
def range = openingRangeHigh - OpeningRangeLow;
def halfRange = range / 2;
def halfwayUpsideProjection = openingRangehigh + halfRange;
plot halfwayUpsideProjectionPlot = if bullishORB and tradeEntryRange then halfwayUpsideProjection else double.nan;
halfwayUpsideProjectionPlot.setPaintingStrategy(PaintingStrategy.Horizontal);
halfwayUpsideProjectionPlot.setDefaultColor(Color.Light_Green);
def fullUpsideProjection = openingRangehigh + range;
plot fullUpsideProjectionPlot = if bullishORB and tradeEntryRange then fullUpsideProjection else double.nan;
fullUpsideProjectionPlot.setPaintingStrategy(PaintingStrategy.Horizontal);
fullUpsideProjectionPlot.setDefaultColor(Color.Green);
#AddLabel(yes, " ^ORB: " + ( Round (fullUpsideProjection, 2)), Color.MAGENTA) ;
def midRange = openingRangeLow + halfRange;
plot midRangePlot = if tradeEntryRange then midRange else double.nan;
midRangePlot.setPaintingStrategy(PaintingStrategy.Horizontal);
midRangePlot.setStyle(Curve.Short_Dash);
midRangePlot.setDefaultColor(Color.Gray);
#AddLabel(yes, " /ORB: " + ( Round (midRange, 2)), Color.ORANGE) ;
def halfwayDownsideProjection = openingRangelow - halfRange;
plot halfwayDownsideProjectionPlot = if bearishORB and tradeEntryRange then halfwayDownsideProjection else double.nan;
halfwayDownsideProjectionPlot.setPaintingStrategy(PaintingStrategy.Horizontal);
halfwayDownsideProjectionPlot.setDefaultColor(Color.Light_Red);
def fullDownsideProjection = openingRangelow - range;
plot fullDownsideProjectionPlot = if bearishORB and tradeEntryRange then fullDownsideProjection else double.nan;
fullDownsideProjectionPlot.setPaintingStrategy(PaintingStrategy.Horizontal);
fullDownsideProjectionPlot.setDefaultColor(Color.Red);
#AddLabel(yes, " !ORB: " + ( Round (fullDownsideProjection, 2)), Color.MAGENTA) ;
I found this:
https://tosindicators.com/indicators/opening-range-breakout
was wondering if this ORB indicator can be modified so it can plot as show on expansion as well?
input entryType = {default wickTouch, closeAbove};
input openingRangeStartTimeEST = 930;
input openingRangeEndTimeEST = 1000;
input tradeEntryStartTimeEST = 1000;
input tradeEntryEndTimeEST = 1100;
def openingRange = if SecondsTillTime(openingRangeStartTimeEST) <= 0 and SecondsTillTime(openingRangeEndTimeEST) >= 0 then 1 else 0;
def openingRangeHigh = if SecondsTillTime(openingRangeStartTimeEST) == 0 then high else if openingRange and high > openingRangeHigh[1] then high else openingRangeHigh[1];
def tradeEntryRange = if SecondsTillTime(tradeEntryStartTimeEST) <= 0 and SecondsTillTime(tradeEntryEndTimeEST) >= 0 then 1 else 0;
def openingRangeLow = if SecondsTillTime(openingRangeStartTimeEST) == 0 then low else if openingRange and low < openingRangeLow[1] then low else openingRangeLow[1];
#plot highCloud = if openingRange then openingRangeHigh else double.nan;
#plot lowCloud = if openingRange then openingRangeLow else double.nan;
#highCloud.setDefaultColor(Color.Gray);
#lowCloud.setDefaultColor(Color.Gray);
#AddCloud(lowCloud, highCloud, color.gray, color.gray);
plot tradeEntryHighExtension = if tradeEntryRange then openingRangeHigh else double.nan;
plot tradeEntryLowExtension = if tradeEntryRange then openingRangeLow else double.nan;
tradeEntryHighExtension.setPaintingStrategy(PaintingStrategy.Horizontal);
tradeEntryLowExtension.setPaintingStrategy(PaintingStrategy.Horizontal);
tradeEntryHighExtension.setStyle(Curve.Short_Dash);
tradeEntryLowExtension.setStyle(Curve.Short_Dash);
tradeEntryHighExtension.setDefaultColor(Color.Gray);
tradeEntryLowExtension.setDefaultColor(Color.Gray);
def bullEntryCondition;
def bearEntryCondition;
switch(entryType){
case wickTouch:
bullEntryCondition = tradeEntryRange and high > openingRangeHigh and high[1] <= openingRangeHigh;
bearEntryCondition = tradeEntryRange and low < openingRangeLow and low[1] >= openingRangeLow;
case closeAbove:
bullEntryCondition = tradeEntryRange and close > openingRangeHigh and close[1] <= openingRangeHigh;
bearEntryCondition = tradeEntryRange and close < openingRangeLow and close[1] >= openingRangeLow;
}
def bullishORB = if bullEntryCondition then 1 else if !tradeEntryRange then 0 else bullishORB[1];
def bearishORB = if bearEntryCondition then 1 else if !tradeEntryRange then 0 else bearishORB[1];
def range = openingRangeHigh - OpeningRangeLow;
def halfRange = range / 2;
def halfwayUpsideProjection = openingRangehigh + halfRange;
plot halfwayUpsideProjectionPlot = if bullishORB and tradeEntryRange then halfwayUpsideProjection else double.nan;
halfwayUpsideProjectionPlot.setPaintingStrategy(PaintingStrategy.Horizontal);
halfwayUpsideProjectionPlot.setDefaultColor(Color.Light_Green);
def fullUpsideProjection = openingRangehigh + range;
plot fullUpsideProjectionPlot = if bullishORB and tradeEntryRange then fullUpsideProjection else double.nan;
fullUpsideProjectionPlot.setPaintingStrategy(PaintingStrategy.Horizontal);
fullUpsideProjectionPlot.setDefaultColor(Color.Green);
#AddLabel(yes, " ^ORB: " + ( Round (fullUpsideProjection, 2)), Color.MAGENTA) ;
def midRange = openingRangeLow + halfRange;
plot midRangePlot = if tradeEntryRange then midRange else double.nan;
midRangePlot.setPaintingStrategy(PaintingStrategy.Horizontal);
midRangePlot.setStyle(Curve.Short_Dash);
midRangePlot.setDefaultColor(Color.Gray);
#AddLabel(yes, " /ORB: " + ( Round (midRange, 2)), Color.ORANGE) ;
def halfwayDownsideProjection = openingRangelow - halfRange;
plot halfwayDownsideProjectionPlot = if bearishORB and tradeEntryRange then halfwayDownsideProjection else double.nan;
halfwayDownsideProjectionPlot.setPaintingStrategy(PaintingStrategy.Horizontal);
halfwayDownsideProjectionPlot.setDefaultColor(Color.Light_Red);
def fullDownsideProjection = openingRangelow - range;
plot fullDownsideProjectionPlot = if bearishORB and tradeEntryRange then fullDownsideProjection else double.nan;
fullDownsideProjectionPlot.setPaintingStrategy(PaintingStrategy.Horizontal);
fullDownsideProjectionPlot.setDefaultColor(Color.Red);
#AddLabel(yes, " !ORB: " + ( Round (fullDownsideProjection, 2)), Color.MAGENTA) ;
Last edited by a moderator: