Opening Range Breakout Indicator for ThinkorSwim

BenTen

BenTen

Administrative
Staff
VIP
@HighBredCloud I'm not too sure of those additional features. I only look at the high and low lines of the ORB.
 
H

HighBredCloud

Active member
@HighBredCloud I'm not too sure of those additional features. I only look at the high and low lines of the ORB.
@BenTen I was looking at the code on both of the versions and it seems that your version has initial risk set to 2.0 while the other on the right has it set to 1.0...hence the difference in the two thinner Green and Red lines...I am assuming that you can base a trade off the two thinner Green and Red lines but you take on more risk...HENCE you will need other indicators to confirm your entry...Anyways...I will test this out tomorrow and I will get back to my findings here with my current confirmation set up that I will later disclose once proven successful. Thanks for your help tonight.

One last thing...what is the best way to not show the RO bubbles and Target bubbles? comment them out by using # in front of every line that has chart bubble? I don't want to mess up the rest of the code...see pic below...

 
Last edited:
T

tomsk

Well-known member
VIP
Gosh, lots of interest on the ORB. For those not familiar with what the ORB is (other than the links that @markos had already posted earlier) I thought it might be insightful to provide some added info from Mobius who as we all know is an exceptional coder, teacher, professor, mentor, mathematician, trader bar none. Mobius trades /ES using the ORB although some traders have attempted to trade equities using this.

Here are some direct quotes from Mobius. Have fun digesting that - lot's of good info

Opening Range is the overnight distribution and occurs within the first 30 minutes of trading. The high and low of that range are the boundaries. Breaking those extremes is the ORB opening range breakout.

In my experience, other than an after the fact reversal, an ORB false breakout is attributable to news. A news event coming out at the end of the opening range can push price outside the range on a false signal. I usually do one of two things – when I know a news event can do that, either don't trade or scalp. Other than that, price on the intraday level is somewhat random so if you are going to trade intraday you have to be willing to take a loss and get out.

Make your risk level one you can live with. 2 points /ES or to the opposite extreme of the previous candle is my typical level for risk. and 1 ATR in my favor and I take risk out of the trade. If you trade 3 contracts and you take risk out at 1 ATR (take one contract off) let 2 run to 2 ATR and let 1 run. Each time stop at prior level, over time your going to make money. It's all trading like a monkey. If you can't trade at a minimum 3 contracts futures you are wasting your time on these sorts of systems
 
H

HighBredCloud

Active member
@tomsk I believe there is a method for everything...Personally I don't like to sit in a trade for hours to maximize gains on small shares...I'd rather take a big share size and be in and out of a trade within minutes...Finding a system that helps me get that piece of a pie is what I am interested in.
 
T

tomsk

Well-known member
VIP
Whatever you do, always focus on the risk rather than the reward. Pay attention to the market internals because at the end of the day that will in turn drive order flow. All the best as you find the system that works for you
 
H

HighBredCloud

Active member
Whatever you do, always focus on the risk rather than the reward. Pay attention to the market internals because at the end of the day that will in turn drive order flow. All the best as you find the system that works for you
@tomsk Thanks Tom...I've been on that quest for nearly 3 years now trading full time...I can tell you this...Majority of my losses came from micro trades and small shares size combined with overtrading. ALL this due to trading scared money after I suffered BIG TIME losses early in my trading career trading OTC BS...Needless to say I am on a different path now. I try to pick a daily price target and get out when I reach it. I get the whole risk vs reward BUT I think there is a moment where the stars align in EVERY stock where things will go your way IF you wait for it and are patient enough. That's the time to make your move with a share size to meet your daily goal.

I am here to find those indicators or strategies that are proven to work together to help me achieve just that. Will post what I think works good with this indicator once trading day is done...You will for sure get a mention and a thanks in this as I have used parts of your script to construct something of my own.
 
M

mikeraya

New member
Ben in the second picture you posted above there is a second dashed green line under the red dashed line. What is the green line? Just a target?
 
markos

markos

Well-known member
VIP
Ben in the second picture you posted above there is a second dashed green line under the red dashed line. What is the green line? Just a target?
@mikeraya please post a picture of what you mean using Imgur.com
 
H

HighBredCloud

Active member
OK...for anyone interested in the Opening Range Breakout indicator...I have found what in my opinion is the best version of the ORB...It is very similar to the one originally posted by @BenTen in the original thread, however, the cloud is easier to read and there is an option to set the "initial risk" which is not available on the version in this thread. In regards to the initial risk...Ben's version here appears to be set to 2.0 as the version that I am posting default is set to 1.0...I have tested this on 1.5 setting and with the combination of the right indicators you can take a trade in the "risk" zone and have it go your way. I should also mention that I have commented out the OR bubbles and actually ALL the chart bubbles as they were getting in the way of the candlesticks...You can comment them back in by removing the # from the corresponding lines in the script.

I am personally testing the ORB posted here with another indicator...MTF TMO combined with MTF Trend Magic and MTF SuperTrend found here https://usethinkscript.com/threads/multi-time-frame-true-momentum-oscillator-mtf-for-thinkorswim.1128/page-5#post-11833 skip the drama on that page and focus on post #93 where I go into detail about the indicator.

Summary: Section 1 the dots and triangles must match and TMO needs to be going in the same direction as the color of the dots and triangles to consider the entry...Your risk level decreases and the entry becomes more guaranteed IF at least one the dots or triangles in section #3 matches with the dots and triangles of section #1...Section #2 is just an extra extra confirmation that you are on the right side of the trend when the dots reflect the same color...black means no confluence between higher aggregations that are set...in that example 5, 10, 15, 20, 30 min timeframes...Hope this serves the community as well as its serving me.


Code:
# Opening_Range_Breakout Strategy edited by HighBredCloud
# V12-18-2019 Commented out Low and High Targets, and Add Chart Bubbles, also relying on much of Mobius' study below.
# --- When you add on to this CSA, just put your changes below the second line and so on. --- #
# Opening_Range_Breakout Strategy with Risk and Target Lines
# Mobius
# This is V03.02.2017(B) Other versions start with V01.01.2001 Ported to TOS 06.2011
#hint: Opening Range Breakout is one of the original Floor Trader Strategies.\n Why it works: Overnight orders accumulate. Those orders being placed during the first 15 minutes of Regular Trading Hours combined with the typical high volume in the first 30 minutes of trading make this the most volatile trading period of the day. Regularly released reports during the first 30 minutes of trading add to the volatility and effect the days direction.\n  Features of this study: The yellow dashed line is the Day Filter Line and is used to determin the trend direction for the day. The dominant time spent above or below this line during the Opening Range Period typically determines the days trend. Green points indicate a close at EOD above the yellow line. Red Points a close below the yellow line. Yellow points a neutral or balanced day, close Between the Opening Range Extremes and often very near the Day Filter Line. The Opening Range is plotted with a green and red dashed line. Trades can be taken when there is an open outside these range lines. Up to 10 Targets are generated using Average True Range to plot target lines. When price crosses the first target line part of the trade should be taken as Risk Off profit and a stop should be placed at the entry point ensuring a profitable trade. If price crosses further targets stops should be moved to the preceeding target until stopped or your profit target is met. Initial Risk Stops are an open below the bar's low prior to entry or the Risk Lines plotted below the Opening range Lines. When price tests the opening range lines from below for the upper line or above for the lower lines trades can be taken with a first target to the yellow line from either direction and a Risk Stop line outside the opening range at the First Target lines or a close outside the Opening Range Lines. \n FYI the color of Probable close direction points are statistically accurate between 60% and 70% of the time. Trading against the direction of the ORB's Day Filtered Direction should be considered counter trend trades.\n As of 01.03.2017 You have just under a 52% probability that a DAILY bar will close green. So a 60% to 70% probability is a nice edge.
# (B)Deletions / Additions: Deleted - Globex High / Low, Globex Volume and Averages.
#    Additions: Added 5 more target lines for a total of 10 on each side of the Opening Range.

declare Hide_On_Daily;
declare Once_per_bar;

input OrMeanS  = 0930.0; #hint OrMeanS: Begin Mean Period. Usually Market Open EST.
input OrMeanE  = 0935.0; #hint OrMeanE: End Mean period. Usually End of first bar.
input OrBegin  = 0930.0; #hint OrBegin: Beginning for Period of Opening Range Breakout.
input OrEnd    = 1000.0; #hint OrEnd: End of Period of Opening Range Breakout.
input RthEnd   = 1615;
input CloudOn  = no;     #hint CloudOn: Clouds Opening Range.
input AlertOn  = yes;    #hint AlertOn: Alerts on cross of Opening Range.
input ShowTodayOnly = yes;
input nAtr = 4;          #hint nATR: Lenght for the ATR Risk and Target Lines.
input AtrTargetMult = 2.0;#hint ATRmult: Multiplier for the ATR calculations.
input InitialRisk = 1.00; #hint InitialRisk: Amount of Risk your will to take opening a trade.
input ShowTargetBubbles = yes;

  def h = high;
  def l = low;
  def c = close;
  def bar = barNumber();
  def na = double.nan;
  def TS = TickSize();
  def BubbleX = bar == HighestAll(bar);
  def s = ShowTodayOnly;
  def Agg = GetAggregationPeriod() /1000/60;
  def RTH = if SecondsFromTime(0930) >= 0 and
               SecondsFromTime(1600) >= 0
            then 1
            else 0;
  def RTHbar1 = if RTH and !RTH[1]
                then bar
                else na;
  def ORActive = if secondsTillTime(OrMeanE) > 0 and
                    secondsFromTime(OrMeanS) >= 0
                 then 1
                 else 0;
  def today = if s == 0
              or getDay() == getLastDay() and
                 secondsFromTime(OrMeanS) >= 0
              then 1
              else 0;
  def ORHigh = if ORHigh[1] == 0
               or ORActive[1] == 0 and
                  ORActive == 1
               then h
               else if ORActive and
                       h > ORHigh[1]
               then h
               else ORHigh[1];
  def ORLow = if ORLow[1] == 0
              or ORActive[1] == 0 and
                 ORActive == 1
              then l
              else if ORActive and
                      l < ORLow[1]
              then l
              else ORLow[1];
  def ORWidth = ORHigh - ORLow;
  def ORHA = if ORActive
             or today < 1
             then na
             else ORHigh;
  def ORLA = if ORActive
             or today < 1
             then na
             else ORLow;
  def O = ORHA - Round(((ORHA - ORLA) / 2) / TS, 0) * TS;
  def ORActive2 = if secondsTillTime(OREnd) > 0 and
                     secondsFromTime(ORBegin) >= 0
                  then 1
                  else 0;
  def ORHigh2 = if ORHigh2[1] == 0
                  or ORActive2[1] == 0 and
                     ORActive2 == 1
                then h
                else if ORActive2 and
                        h > ORHigh2[1]
                then h
                else ORHigh2[1];
  def ORLow2 = if ORLow2[1] == 0
                or ORActive2[1] == 0 and
                   ORActive2 == 1
               then l
               else if ORActive2 and
                       l < ORLow2[1]
               then l
               else ORLow2[1];
  def ORWidth2 = ORHigh2 - ORLow2;
  def TimeLine = if secondsTillTime(OREnd) == 0
                 then 1
                 else 0;
  def ORmeanBar = if !ORActive and ORActive[1]
                  then bar
                  else ORmeanBar[1];
  def ORendBar = if !ORActive2 and ORActive2[1]
                 then bar
                 else ORendBar[1];
  def ORL = if (o == 0 , na, o);
plot ORLext = if ShowTodayOnly and barNumber() >= highestAll(ORmeanBar)
              then HighestAll(if isNaN(c[-1])
                              then ORL[1]
                              else na)
              else if !ShowTodayOnly
                   then ORL
              else na;
     ORLext.SetDefaultColor(color.Yellow);
     ORLext.SetStyle(curve.Long_DASH);
     ORLext.SetLineWeight(3);
     ORLext.HideTitle();
  def ORH2 = if ORActive2
             or today < 1
             then na
             else ORHigh2;
plot ORH2ext = if ShowTodayOnly and bar >= highestAll(ORendBar)
               then HighestAll(if isNaN(c[-1])
                               then ORH2[1]
                               else na)
               else if !ShowTodayOnly
                    then ORH2
               else na;
     ORH2ext.SetDefaultColor(color.Green);
     ORH2ext.SetStyle(curve.Long_DASH);
     ORH2ext.SetLineWeight(3);
     ORH2ext.HideTitle();
  def ORL2 = if ORActive2
               or today < 1
             then na
             else ORLow2;
plot ORL2ext = if ShowTodayOnly and bar >= highestAll(ORendBar)
               then HighestAll(if isNaN(c[-1])
                               then ORL2[1]
                               else na)
               else if !ShowTodayOnly
                    then ORL2
               else na;
     ORL2ext.SetDefaultColor(color.Red);
     ORL2ext.SetStyle(curve.Long_DASH);
     ORL2ext.SetLineWeight(3);
     ORL2ext.HideTitle();
  def RelDay = (ORL - ORL2) / (ORH2 - ORL2);
  def dColor = if RelDay > .5
               then 5
               else if RelDay < .5
                    then 6
               else 4;
  def pos = (ORH2 - ORL2)/10;
plot d1  = if (TimeLine , ORH2, na);
plot d2  = if (TimeLine , ORH2 - ( pos * 2), na);
plot d3  = if (TimeLine , ORH2 - ( pos * 3), na);
plot d4  = if (TimeLine , ORH2 - ( pos * 4), na);
plot d5  = if (TimeLine , ORH2 - ( pos * 5), na);
plot d6  = if (TimeLine , ORH2 - ( pos * 6), na);
plot d7  = if (TimeLine , ORH2 - ( pos * 7), na);
plot d8  = if (TimeLine , ORH2 - ( pos * 8), na);
plot d9  = if (TimeLine , ORH2 - ( pos * 9), na);
plot d10 = if (TimeLine ,(ORL2), na);
     d1.SetPaintingStrategy(PaintingStrategy.POINTS);
     d2.SetPaintingStrategy(PaintingStrategy.POINTS);
     d3.SetPaintingStrategy(PaintingStrategy.POINTS);
     d4.SetPaintingStrategy(PaintingStrategy.POINTS);
     d5.SetPaintingStrategy(PaintingStrategy.POINTS);
     d6.SetPaintingStrategy(PaintingStrategy.POINTS);
     d7.SetPaintingStrategy(PaintingStrategy.POINTS);
     d8.SetPaintingStrategy(PaintingStrategy.POINTS);
     d9.SetPaintingStrategy(PaintingStrategy.POINTS);
    d10.SetPaintingStrategy(PaintingStrategy.POINTS);
     d1.AssignValueColor(GetColor(Dcolor));
     d2.AssignValueColor(GetColor(Dcolor));
     d3.AssignValueColor(GetColor(Dcolor));
     d4.AssignValueColor(GetColor(Dcolor));
     d5.AssignValueColor(GetColor(Dcolor));
     d6.AssignValueColor(GetColor(Dcolor));
     d7.AssignValueColor(GetColor(Dcolor));
     d8.AssignValueColor(GetColor(Dcolor));
     d9.AssignValueColor(GetColor(Dcolor));
    d10.AssignValueColor(GetColor(Dcolor));
     d1.HideBubble();
     d2.HideBubble();
     d3.HideBubble();
     d4.HideBubble();
     d5.HideBubble();
     d6.HideBubble();
     d7.HideBubble();
     d8.HideBubble();
     d9.HideBubble();
    d10.HideBubble();
     d1.HideTitle();
     d2.HideTitle();
     d3.HideTitle();
     d4.HideTitle();
     d5.HideTitle();
     d6.HideTitle();
     d7.HideTitle();
     d8.HideTitle();
     d9.HideTitle();
    d10.HideTitle();
addCloud(if CloudOn == yes
         then orl
         else na
       , orl2, createColor(50,25,25), createColor(50,25,25));
addCloud(if CloudOn == yes
         then orl
         else na
       , orh2, createColor(25,50,50), createColor(25,50,50));
def T = Round(Floor(RthEnd / agg), 0) * agg;
def Settlement = if SecondsTillTime(T) == 0 and
                    SecondsFromTime(T) == 0
                 then Round(VWAP / TS, 0) * TS
                 else Settlement[1];
def SettlementBar = if SecondsTillTime(T) == 0 and
                       SecondsFromTime(T) == 0
                    then bar
                    else SettlementBar[1];
plot SettlementClose = if bar >= HighestAll(SettlementBar)
                       then HighestAll(if isNaN(close[-1])
                                       then Settlement
                                       else na)
                       else na;
     SettlementClose.SetLineWeight(1);
     SettlementClose.SetStyle(Curve.Long_Dash);
     SettlementClose.SetDefaultColor(Color.Gray);
     SettlementClose.HideTitle();
#AddChartBubble(BubbleX, SettlementClose, "PC", color.Gray, 0);

  def RTHOpen = if RTH and !RTH[1]
                then open
                else RTHOpen[1];
plot RTHo = if bar >= HighestAll(RTHBar1)
            then HighestAll(if isNaN(close[-1])
                            then RTHOpen
                            else na)
            else na;
     RTHo.SetStyle(Curve.Short_Dash);
     RTHo.SetDefaultColor(Color.Dark_Gray);
     RTHo.HideTitle();
#AddChartBubble(BubbleX, RTHo, "RTH-O", color.Gray, 0);
plot PriceLine = HighestAll(if isNaN(close[-1])
                            then close
                            else na);
     PriceLine.SetLineWeight(1);
     PriceLine.SetPaintingStrategy(PaintingStrategy.Line);
     PriceLine.SetDefaultColor(Color.Cyan);
     PriceLine.HideTitle();
# Begin Risk Algorithm
# First Breakout or Breakdown bars
  def Bubbleloc1 = isNaN(c[-1]);
  def BreakoutBar = if ORActive
                    then na
                    else if !ORActive and c crosses above ORH2
                         then bar
                         else if !isNaN(BreakoutBar[1]) and c crosses ORH2
                              then BreakoutBar[1]
                    else BreakoutBar[1];
  def ATR = if ORActive2
  then Round((Average(TrueRange(h, c, l), nATR)) / TS, 0) * TS
  else ATR[1];
  def cond1 =  if h > ORH2 and
                  h[1] <= ORH2
               then Round((ORH2  + (ATR * AtrTargetMult)) / TS, 0) * TS
               else cond1[1];
plot ORLriskUP = if bar >= highestAll(ORendBar) and !ORActive and today
                 then HighestAll(ORH2ext - InitialRisk)
                 else na;
     ORLriskUP.SetStyle(Curve.Long_Dash);
     ORLriskUP.SetDefaultColor(Color.Green);
     ORLriskUP.HideTitle();
  def crossUpBar = if c crosses above ORH2
                   then bar
                   else na;
#AddChartBubble(bar == HighestAll(crossUpBar-10), ORLriskUP, "Risk ORH", color.green, no);
plot ORLriskDN = if bar >= highestAll(ORendBar) and !ORActive and today
                 then HighestAll(ORL2ext + InitialRisk)
                 else na;
     ORLriskDN.SetStyle(Curve.Long_Dash);
     ORLriskDN.SetDefaultColor(Color.Red);
     ORLriskDN.HideTitle();
  def crossDnBar = if h crosses below ORL2ext
                   then bar
                   else na;
#AddChartBubble(bar == HighestAll(crossDnBar - 10), HighestAll(ORLriskDN), "Risk ORL", color.red, yes);
# High Targets
plot Htarget = if bar >= HighestAll(OREndBar)
               then HighestAll(cond1)
               else na;
     Htarget.SetPaintingStrategy(paintingStrategy.Squares);
     Htarget.SetLineWeight(1);
     Htarget.SetDefaultColor(Color.White);
     Htarget.HideTitle();
#AddChartBubble(ShowTargetBubbles and BubbleLoc1, cond1, "RO", color.white, if c > Htarget then no else yes);
  def condHtarget2 = if h crosses above cond1
  then Round((cond1 + (ATR * AtrTargetMult)) / TS, 0) * TS
  else condHtarget2[1];
plot Htarget2 = if bar >= HighestAll(OREndBar) #BreakoutBar
                then  HighestAll(if isNaN(c[-1])
                                 then condHtarget2
                                 else na)
                else na;
     Htarget2.SetPaintingStrategy(PaintingStrategy.Squares);
     Htarget2.SetLineWeight(1);
     Htarget2.SetDefaultColor(Color.Plum);
     Htarget2.HideTitle();
#AddChartBubble(ShowTargetBubbles and BubbleLoc1, condHtarget2, "T2", color.plum, if c > Htarget2
                                                          #then no
                                                          #else yes);
  def condHtarget3 = if h crosses above Htarget2
  then Round((condHtarget2 + (ATR * AtrTargetMult)) / TS, 0) * TS
  else condHtarget3[1];
plot Htarget3 = if bar >= HighestAll(OREndBar) #BreakoutBar
                then HighestAll(if isNaN(c[-1])
                                then condHtarget3
                                else na)
                else na;
     Htarget3.SetPaintingStrategy(PaintingStrategy.Squares);
     Htarget3.SetLineWeight(1);
     Htarget3.SetDefaultColor(Color.Plum);
     Htarget3.HideTitle();
#AddChartBubble(ShowTargetBubbles and BubbleLoc1, condHtarget3, "T3", color.plum, if c > Htarget3 then no else yes);
  def condHtarget4 = if h crosses above Htarget3
  then Round((condHtarget3 + (ATR * AtrTargetMult)) / TS, 0) * TS
  else condHtarget4[1];
plot Htarget4 = if bar >= HighestAll(OREndBar) #BreakoutBar)
                then HighestAll(if isNaN(c[-1])
                                then condHtarget4
                                else na)
                else na;
     Htarget4.SetPaintingStrategy(PaintingStrategy.Squares);
     Htarget4.SetLineWeight(1);
     Htarget4.SetDefaultColor(Color.Plum);
     Htarget4.HideTitle();
#AddChartBubble(ShowTargetBubbles and BubbleLoc1, condHtarget4, "T4", color.plum, if c > Htarget4 then no else yes);
  def condHtarget5 = if h crosses above Htarget4
  then Round((condHtarget4 + (ATR * AtrTargetMult)) / TS, 0) * TS
  else condHtarget5[1];
plot Htarget5 = if bar >= HighestAll(OREndBar) #BreakoutBar
                then HighestAll(if isNaN(c[-1])
                                then condHtarget5
                                else na)
                else na;
     Htarget5.SetPaintingStrategy(PaintingStrategy.Squares);
     Htarget5.SetLineWeight(1);
     Htarget5.SetDefaultColor(Color.Plum);
     Htarget5.HideTitle();
#AddChartBubble(ShowTargetBubbles and BubbleLoc1, condHtarget5, "T5", color.plum, if c > Htarget5 then no else yes);
  def condHtarget6 = if h crosses above Htarget5
  then Round((condHtarget5 + (ATR * AtrTargetMult)) / TS, 0) * TS
  else condHtarget6[1];
plot Htarget6 = if bar >= HighestAll(OREndBar) #BreakoutBar
                then HighestAll(if isNaN(c[-1])
                                then condHtarget6
                                else na)
                else na;
     Htarget6.SetPaintingStrategy(PaintingStrategy.Squares);
     Htarget6.SetLineWeight(1);
     Htarget6.SetDefaultColor(Color.Plum);
     Htarget6.HideTitle();
#AddChartBubble(ShowTargetBubbles and BubbleLoc1, condHtarget6, "T6", color.plum, if c > Htarget6 then no else yes);
  def condHtarget7 = if h crosses above Htarget6
  then Round((condHtarget6 + (ATR * AtrTargetMult)) / TS, 0) * TS
  else condHtarget7[1];
plot Htarget7 = if bar >= HighestAll(OREndBar) #BreakoutBar
                then HighestAll(if isNaN(c[-1])
                                then condHtarget7
                                else na)
                else na;
     Htarget7.SetPaintingStrategy(PaintingStrategy.Squares);
     Htarget7.SetLineWeight(1);
     Htarget7.SetDefaultColor(Color.Plum);
     Htarget7.HideTitle();
#AddChartBubble(ShowTargetBubbles and BubbleLoc1, condHtarget7, "T7", color.plum, if c > Htarget7 then no else yes);
  def condHtarget8 = if h crosses above Htarget7
  then Round((condHtarget7 + (ATR * AtrTargetMult)) / TS, 0) * TS
  else condHtarget8[1];
plot Htarget8 = if bar >= HighestAll(OREndBar) #BreakoutBar
                then HighestAll(if isNaN(c[-1])
                                then condHtarget8
                                else na)
                else na;
     Htarget8.SetPaintingStrategy(PaintingStrategy.Squares);
     Htarget8.SetLineWeight(1);
     Htarget8.SetDefaultColor(Color.Plum);
     Htarget8.HideTitle();
#AddChartBubble(ShowTargetBubbles and BubbleLoc1, condHtarget8, "T8", color.plum, if c > Htarget8 then no else yes);
  def condHtarget9 = if h crosses above Htarget8
  then Round((condHtarget8 + (ATR * AtrTargetMult)) / TS, 0) * TS
  else condHtarget9[1];
plot Htarget9 = if bar >= HighestAll(OREndBar) #BreakoutBar
                then HighestAll(if isNaN(c[-1])
                                then condHtarget9
                                else na)
                else na;
     Htarget9.SetPaintingStrategy(PaintingStrategy.Squares);
     Htarget9.SetLineWeight(1);
     Htarget9.SetDefaultColor(Color.Plum);
     Htarget9.HideTitle();
#AddChartBubble(ShowTargetBubbles and BubbleLoc1, condHtarget9, "T9", color.plum, if c > Htarget9 then no else yes);
  def condHtarget10 = if h crosses above Htarget9
  then Round((condHtarget9 + (ATR * AtrTargetMult)) / TS, 0) * TS
  else condHtarget10[1];
plot Htarget10 = if bar >= HighestAll(OREndBar) #BreakoutBar
                 then HighestAll(if isNaN(c[-1])
                                 then condHtarget10
                                 else na)
                 else na;
     Htarget10.SetPaintingStrategy(PaintingStrategy.Squares);
     Htarget10.SetLineWeight(1);
     Htarget10.SetDefaultColor(Color.Plum);
     Htarget10.HideTitle();
#AddChartBubble(ShowTargetBubbles and BubbleLoc1, condHtarget10, "T10", color.plum, if c > Htarget10 then no else yes);
# Low Targets
  def cond2 = if L < ORL2 and
                 L[1] >= ORL2
              then Round((ORL2  - (AtrTargetMult * ATR)) / TS, 0) * TS
              else cond2[1];
plot Ltarget =  if bar >= HighestAll(OREndBar)
                then highestAll(if isNaN(c[-1])
                                then cond2
                                else na)
                else na;
     Ltarget.SetPaintingStrategy(PaintingStrategy.Squares);
     Ltarget.SetLineWeight(1);
     Ltarget.SetDefaultColor(Color.White);
     Ltarget.HideTitle();
#AddChartBubble(ShowTargetBubbles and BubbleLoc1, cond2, "RO", color.white, if c < Ltarget
                                                     #then yes
                                                     #else no);
  def condLtarget2 = if l crosses below Ltarget
  then Round((cond2 - (AtrTargetMult * ATR)) / TS, 0) * TS
  else condLtarget2[1];
plot Ltarget2 =  if bar >= HighestAll(OREndBar)
                 then highestAll(if isNaN(c[-1])
                                 then condLtarget2
                                 else na)
                 else na;
     Ltarget2.SetPaintingStrategy(PaintingStrategy.Squares);
     Ltarget2.SetLineWeight(1);
     Ltarget2.SetDefaultColor(Color.Plum);
     Ltarget2.HideTitle();
#AddChartBubble(ShowTargetBubbles and BubbleLoc1, condLtarget2, "T2", color.plum, if c < condLtarget2
                                                              #then yes
                                                              #else no);
  def condLtarget3 = if l crosses below Ltarget2
  then Round((condLtarget2 - (ATR * AtrTargetMult)) / TS, 0) * TS
  else condLtarget3[1];
plot Ltarget3 = if bar >= HighestAll(ORendBar)
                then highestAll(if isNaN(c[-1])
                                then condLtarget3
                                else na)
                else na;
     Ltarget3.SetPaintingStrategy(PaintingStrategy.Squares);
     Ltarget3.SetLineWeight(1);
     Ltarget3.SetDefaultColor(Color.Plum);
     Ltarget3.HideTitle();
#AddChartBubble(ShowTargetBubbles and BubbleLoc1, condLtarget3, "T3", color.plum, if c > Ltarget3 then no else yes);
  def condLtarget4 = if l crosses below Ltarget3
  then Round((condLtarget3 - (AtrTargetMult * ATR)) / TS, 0) * TS
  else condLtarget4[1];
plot Ltarget4 = if bar >= HighestAll(OREndBar)
                then highestAll(if isNaN(c[-1])
                                then condLtarget4
                                else na)
                else na;
     Ltarget4.SetPaintingStrategy(PaintingStrategy.Squares);
     Ltarget4.SetLineWeight(1);
     Ltarget4.SetDefaultColor(Color.Plum);
     Ltarget4.HideTitle();
#AddChartBubble(ShowTargetBubbles and BubbleLoc1, condLtarget4, "T4", color.plum, if c < Ltarget4
                                                              #then yes
                                                              #else no);
  def condLtarget5 = if l crosses below Ltarget4
  then Round((condLtarget4 - (AtrTargetMult * ATR)) / TS, 0) * TS
  else condLtarget5[1];
plot Ltarget5 = if bar >= HighestAll(OREndBar)
                then highestAll(if isNaN(c[-1])
                                then condLtarget5
                                else na)
                else na;
     Ltarget5.SetPaintingStrategy(PaintingStrategy.Squares);
     Ltarget5.SetLineWeight(1);
     Ltarget5.SetDefaultColor(Color.Plum);
     Ltarget5.HideTitle();
#AddChartBubble(ShowTargetBubbles and BubbleLoc1, condLtarget5, "T5", color.plum, if c < Ltarget5
                                                              #then yes
                                                              #else no);
  def condLtarget6 = if l crosses below Ltarget5
  then Round((condLtarget5 - (AtrTargetMult * ATR)) / TS, 0) * TS
  else condLtarget6[1];
plot Ltarget6 = if bar >= HighestAll(OREndBar)
                then highestAll(if isNaN(c[-1])
                                then condLtarget6
                                else na)
                else na;
     Ltarget6.SetPaintingStrategy(PaintingStrategy.Squares);
     Ltarget6.SetLineWeight(1);
     Ltarget6.SetDefaultColor(Color.Plum);
     Ltarget6.HideTitle();
#AddChartBubble(ShowTargetBubbles and BubbleLoc1, condLtarget6, "T6", color.plum, if c < Ltarget6
                                                              #then yes
                                                              #else no);
  def condLtarget7 = if l crosses below Ltarget6
  then Round((condLtarget6 - (AtrTargetMult * ATR)) / TS, 0) * TS
  else condLtarget7[1];
plot Ltarget7 = if bar >= HighestAll(OREndBar)
                then highestAll(if isNaN(c[-1])
                                then condLtarget7
                                else na)
                else na;
     Ltarget7.SetPaintingStrategy(PaintingStrategy.Squares);
     Ltarget7.SetLineWeight(1);
     Ltarget7.SetDefaultColor(Color.Plum);
     Ltarget7.HideTitle();
#AddChartBubble(ShowTargetBubbles and BubbleLoc1, condLtarget7, "T7", color.plum, if c < Ltarget7
                                                              #then yes
                                                              #else no);
  def condLtarget8 = if l crosses below Ltarget7
  then Round((condLtarget7 - (AtrTargetMult * ATR)) / TS, 0) * TS
  else condLtarget8[1];
plot Ltarget8 = if bar >= HighestAll(OREndBar)
                then highestAll(if isNaN(c[-1])
                                then condLtarget8
                                else na)
                else na;
     Ltarget8.SetPaintingStrategy(PaintingStrategy.Squares);
     Ltarget8.SetLineWeight(1);
     Ltarget8.SetDefaultColor(Color.Plum);
     Ltarget8.HideTitle();
#AddChartBubble(ShowTargetBubbles and BubbleLoc1, condLtarget8, "T8", color.plum, if c < Ltarget8
                                                              #then yes
                                                              #else no);
  def condLtarget9 = if l crosses below Ltarget8
  then Round((condLtarget8 - (AtrTargetMult * ATR)) / TS, 0) * TS
  else condLtarget9[1];
plot Ltarget9 = if bar >= HighestAll(OREndBar)
                then highestAll(if isNaN(c[-1])
                                then condLtarget9
                                else na)
                else na;
     Ltarget9.SetPaintingStrategy(PaintingStrategy.Squares);
     Ltarget9.SetLineWeight(1);
     Ltarget9.SetDefaultColor(Color.Plum);
     Ltarget9.HideTitle();
#AddChartBubble(ShowTargetBubbles and BubbleLoc1, condLtarget9, "T9", color.plum, if c < Ltarget9
                                                              #then yes
                                                              #else no);
  def condLtarget10 = if l crosses below Ltarget9
  then Round((condLtarget9 - (AtrTargetMult * ATR)) / TS, 0) * TS
  else condLtarget10[1];
plot Ltarget10 = if bar >= HighestAll(OREndBar)
                then highestAll(if isNaN(c[-1])
                                then condLtarget10
                                else na)
                else na;
     Ltarget10.SetPaintingStrategy(PaintingStrategy.Squares);
     Ltarget10.SetLineWeight(1);
     Ltarget10.SetDefaultColor(Color.Plum);
     Ltarget10.HideTitle();
#AddChartBubble(ShowTargetBubbles and BubbleLoc1, condLtarget10, "T10", color.plum, if c < Ltarget10
                                                              #then yes
                                                              #else no);
# Day Trend Label
def DayTrend = if RTHOpen > SettlementClose
               then 1
               else 0;
def ORTrend = if RelDay < .5
              then 1
              else 0;
addLabel(1, if DayTrend and ORTrend
            then "UP > " + AsDollars(RTHopen)
            else if (DayTrend and !ORTrend)
                   or
                    (!DayTrend and ORTrend)
                 then "Prob Range Day"
            else "DN < " + AsDollars(RTHopen),
            if DayTrend and ORTrend
            then color.green
            else if (DayTrend and !ORTrend)
                   or
                    (!DayTrend and ORTrend)
                 then color.white
            else color.red);
# Time Reminders
#AddVerticalLine(secondsTillTime(0930) == 0, "RTH", color.cyan, Curve.Short_Dash);
#AddVerticalLine(secondsTillTime(1030) == 0, "End EU", color.cyan, Curve.Short_Dash);
#AddVerticalLine(secondsTillTime(1200) == 0, "Lunch", color.cyan, Curve.Short_Dash);
#AddVerticalLine(secondsTillTime(1500) == 0, "Lst Hr", color.cyan, Curve.Short_Dash);
#AddVerticalLine(secondsTillTime(1615) == 0, "RTH End", color.cyan, Curve.Short_Dash);

# End Code ORB VO3(B)
 
Last edited:
B

BbenSD

New member
VIP
@tomsk I believe there is a method for everything...Personally I don't like to sit in a trade for hours to maximize gains on small shares...I'd rather take a big share size and be in and out of a trade within minutes...Finding a system that helps me get that piece of a pie is what I am interested in.
Hey there HighBredCloud, that statement resonates with me personally because that's precisely what I was doing. Essentially scalping with large orders. It's great when it works, but equally not great when it doesn't of course.

One of my friends who has been a successful swing trader since 1999 told me that although I had some moderate success doing that, eventually it would bite me when I get hit with a gap down. So that's why people ultimately elect to have smaller orders across different stocks, because it helps mitigate the risk.

I see that you have a bunch of questions regarding ORB, as I do/did. I admire the motivation!
 
S

Shrum

New member
@HighBredCloud I tried your script and I am getting a line printing at zero for some reason that is causing my chart to squinch up, any idea why? I is wanting to plot that and the candles. How does your chart look?

thanks
 
BenTen

BenTen

Administrative
Staff
VIP
@HighBredCloud If you made changes to the script that you just posted above, please also indicate that within the header of the script.
 
H

HighBredCloud

Active member
@BbenSD Your friend is right...you really need to have EVERYTHING that aligns to go in with a large share size or it will bite you in the end...The more I spend looking at different types of indicators the more I come to realize that it's all about the MTF entry and exit...I've been focusing on 1h 30 min 15 min charts aligning before entering on 5 min...No other way that I know how or no other indicator will ever be as accurate as price action. Although the indicator of choice that I have been using has been TMO...on all 4 charts and a real Heikin Ashi trend on 5 min ONLY...IF the TMO does not align on all 4 charts...don't take the trade...You're better off in my opinion.
 
H

HighBredCloud

Active member
@BenTen I mentioned that in the post...didn't know that I could just add what I commented out with a # sign...but OK...will know for next time. Again IMO this is the best version of ORB for anyone wanting to use it especially because you can adjust the initial risk. Pair that with the right indicators and you can take the risk early to trade.
 
B

BbenSD

New member
VIP
@BbenSD Your friend is right...you really need to have EVERYTHING that aligns to go in with a large share size or it will bite you in the end...The more I spend looking at different types of indicators the more I come to realize that it's all about the MTF entry and exit...I've been focusing on 1h 30 min 15 min charts aligning before entering on 5 min...No other way that I know how or no other indicator will ever be as accurate as price action. Although the indicator of choice that I have been using has been TMO...on all 4 charts and a real Heikin Ashi trend on 5 min ONLY...IF the TMO does not align on all 4 charts...don't take the trade...You're better off in my opinion.
What's also interesting is that I came to that same conclusion as well. MTF is key. I found it extremely useful in volatility squeeze indicators as well and using 5, 15, 30-minute charts for RSI.
 
markos

markos

Well-known member
VIP
@HighBredCloud I have made changes to the header in this particular script for you to use them as a future template.
Also, please go back to thread #251 and edit it as I have shown below.
The reason that this is done is not just to keep track but to help people that use web crawlers see where a script stands in relationship to other revisions. This is standard coding practice and it shows that you have taken ownership of it and are the current author.
Thank you, Markos

# Opening_Range_Breakout Strategy edited by HighBredCloud
# V12-18-2019 Commented out Low and High Targets, and Add Chart Bubbles, also relying on much of Mobius' study below.
# --- When you add on to this CSA, just put your changes below the second line and so on. --- #
# Opening_Range_Breakout Strategy with Risk and Target Lines
# Mobius
# This is V03.02.2017(B) Other versions start with V01.01.2001 Ported to TOS 06.2011

#hint: Opening Range Breakout is one of the original Floor Trader Strategies.\n Why it works: Overnight orders accumulate. Those orders being placed during the first 15 minutes of Regular Trading Hours.....
 

Top