Archived: Opening Range Breakout

Status
Not open for further replies.
With regard to the ORB specifically, which variable in the study do I use to signal 'price has crossed above that green line'?
 
Had to take off the bubbles of the supertrend, instead there was a reversal indicator here with stop losses. That one was way more reliable. @BenTen is there a way to make bubbles optional in the supertrend indicator. I was it to remain as part of the code but not wipe it off entirely. Like in the setup I can make it a yes/no condition?
I'd really appreciate it brother
 
@BenTen Hello Ben... Thank you for the code. I tried to use the link given in the original post but it din't work. So, I used the script you mentioned but my chart looks different. I am assuming that it should work on ES. Not sure what I am doing wrong. I also need to change time to reflect central time zone market hours... correct? Thanks for your help!

cf78WBa.png
 
@hhjani I don't have any experience with using the ORB indicator on the futures chart, but I assume it should work. Though, You may have to adjust the ORB breakout time. Besides that, take a look at all the other indicators I mentioned in the original post as well.
 
Good morning Mr Ben. I was wondering if there is a way to make a version of the ORB indicator to work in the TOS mobile app? Thank you very much for your generosity on sharing these scripts btw. I figured you must love what you do to be able to take so much of your time and share it to others. Kindly let me know if there's a way to code this for mobile app use. If not, thank you so much anyway! Have a great one!
 
@BenTen Hi. Thanks for this indicator. I have been using this for sometime with a good success rate. How do I turn off alerts that are received in the main message center window? I dont mind the sound alerts.

Thanks
 
WH2JBZz.png


nSpBKuj.png


Hi @BenTen - thanks for the link on uploading pics. Attached are two pics. The first one is where I have set the AlertOn to No, and the second one is example of alert that keeps popping in message center.
 
I tried playing SPY today, waited for candlestick to close into breakdown zone on 5min and bought put options... which the chart promptly reversed and marched up all day. An expensive lesson needless to say. Does anyone know the context/intention for the RiskON ORH line? Thanks.
 
@apmerf Take a look at this comment here.

From my experience, ORB on the indices barely works. I would use ORB on individual stocks.
 
Hey @BenTen, I cleaned up the script a little bit since I didn't need everything on it personally, but maybe you can help me with something.

1. The script only works and shows the lines on the 1 min and 5 min chart, but not on the 15 min. Is there something I'm missing within the script for it to also work on the 15m chart?

2. I only want the first two "High Profit Targets", but the levels are not actually accurate when it comes to the 1:1 and 2:1 RR (by percentage). So if the range of the first 15 min is 10%, my 1st profit target line shows only 8% and my second line shows 16%. I don't know why it does that. Anyway I can make them plot the exact ratio for the 1:1 and 2:1 RR that I need?

Here's the script I have.

Code:
# Opening_Range_Breakout Strategy with Risk and Target Lines

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   = 1600;
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 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 BarNumber() >= HighestAll(ORendBar)
               then HighestAll(if IsNaN(c[-1])
                               then ORL2[1]
                               else Double.NaN)
               else Double.NaN;
ORL2ext.SetDefaultColor(Color.RED);
ORL2ext.SetStyle(Curve.LONG_DASH);
ORL2ext.SetLineWeight(3);
ORL2ext.HideTitle();

def Bubbleloc1 = isNaN(close[-1]);
  def BreakoutBar = if ORActive
                    then double.nan
                    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)) / TickSize(), 0) * TickSize()
  else ATR[1];
  def cond1 =  if h > ORH2 and
                  h[1] <= ORH2
               then Round((ORH2  + (ATR * AtrTargetMult)) / TickSize(), 0) * TickSize()
               else cond1[1];
  def crossUpBar = if close crosses above ORH2
                   then bar
                   else double.nan;


# High Targets
plot Htarget = if bar >= HighestAll(ORendBar)
               then HighestAll(cond1)
               else na;
Htarget.SetLineWeight(1);
Htarget.SetDefaultColor(Color.WHITE);
Htarget.HideTitle();
AddChartBubble(ShowTargetBubbles and BubbleLoc1, cond1, "1:1", 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.SetLineWeight(1);
Htarget2.SetDefaultColor(Color.WHITE);
Htarget2.HideTitle();
AddChartBubble(ShowTargetBubbles and BubbleLoc1, condHtarget2, "2:1", Color.WHITE, if c > Htarget2
                                                          then no
                                                          else yes);

# End Code ORB VO3(B)
 
hi ben, i am trying to download this but im having a hard time. all i see is thick lines and can't see my chart. any suggestion?
 
Status
Not open for further replies.

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
164 Online
Create Post

Similar threads

Similar threads

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

What is useThinkScript?

useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.

How do I get started?

We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.

If you are new, or just looking for guidance, here are some helpful links to get you started.

What are the benefits of VIP Membership?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.
Back
Top