Archived: Opening Range Breakout

Status
Not open for further replies.
For some reason I am not getting colored breakout zone. Any suggestions? i have all indicators listed and pre and post market data turned off. Thanks so much for the wonderful indicators!!

 
@NDN3531 Turn the Cloud setting on in the Indicator's setting page.

 
> @BenTen P.S: I'll let Warmaster Steve talk more about the usage of TEMA and EMA when he's on. 😜

Can you elaborate a bit on the usage of TEMA and EMA with this strategy. Thanks in advance.

 
@hockeycoachdoug

Hey I can explain the use of Tema and Ema with that. One of the strategies I use to enter plays (3 or 5 min) is where the tema 30 (usually the purple line) and the ema 20 (usually the green line) are in relation to the candles and how they cross the candles and each other. For a call play, I look to enter where the tema curves underneath a couple candles bottoms and starts to curve up, or when it cuts across a candle and reverses a downward direction to go up. When the candles start to go up, I can get a confirmation that calls are still a good choice when the ema crosses below the tema. The crosses tend to lag the market, so this isn't great for exits, but can help you get a feel for where things are going. I'd recommend it with the Supertrend indicator that Ben has put up here. But here are the basics in action.

WMzZaK5.jpg


The first circle I have is where the ema crosses under the tema and they both cross at the same candle which is usually a strong trend sign. I'd enter calls here. The second circle shows what happens when the tema and ema get close to each other, but don't cross. Since they didn't cross, I can expect an uptrend from this point because the ema is still under the tema. I might add a call if it reverses like that. The third and fourth circle show a cross and you can see how a potential put play might happen. Just before the third circle, the tema is curving above the top candles. That's a risky put play you could take and get a confirmation that you'd be going down, but you'd want to sell as soon as the tema crossed through that big green candle right after the bottom. If you have problems getting out of plays, the fourth circle would give you a confirmation to get out because its back to going up.

I like using the tema and ema as a confirmation to some of my other indicators. The tema can give me a good indication of where to enter and I like to have a confirmation to get out if the play goes poorly. It lags the market a bit at times so I wouldn't use this as the only indicator. But with a little backtesting, you can kind of get a feel of what will happen when they cross or how the market will act. There are more examples of this in action in my trading blog, feel free to hit me up anytime here or in our channel on discord if you'd like to talk about it more or want me to look at something.
 
Here is an Opening Range Breakout (ORB) indicator for ThinkorSwim with Volume Profile included.

thinkScript Code

Rich (BB code):
# Volume Profile for ORB
# V01.05.02.2018
# TOS Volume Profile with cond altered for a user input Time Range. Labels added for ORH, ORL, OR POC, Opening Range Value Percents upper and lower.
# For Intraday use only

input valueAreaPercent = 70.0;
input opacity = 15;
input RthBegin = 0930;
input OREnd = 1000;
input TimeLength = 30; #hint TimeLenght: In Minutes

def o = open;
def h = high;
def l = low;
def c = close;
def x = BarNumber();
def t = GetTime();
def RTS = RegularTradingStart(GetYYYYMMDD());
def RTE = RegularTradingEnd(GetYYYYMMDD());
def Active = SecondsFromTime(RthBegin) >= 0 and
SecondsTillTime(OREnd) > 0;
def firstBar = if Active and !Active[1]
then x
else Double.NaN;
def agg = GetAggregationPeriod();
def ORperiod_1 = if t crosses above RTS - agg + 300000
then Round(((Highest(h, 3) + Lowest(l, 3)) / 2) / TickSize(), 0) * TickSize()
else ORperiod_1[1];
plot OR_M = if x >= HighestAll(firstBar)
then HighestAll(if IsNaN(c[-1])
then ORperiod_1
else Double.NaN)
else Double.NaN;
OR_M.SetStyle(Curve.LONG_DASH);
OR_M.SetLineWeight(2);
OR_M.SetDefaultColor(Color.YELLOW);
AddChartBubble(x == firstBar, OR_M, "ORM", OR_M.TakeValueColor());
def timeSegment = (SecondsFromTime(0000) / 60) % TimeLength == 0;
def profiles = 1440 / TimeLength; # Profiles for 24 hours
def cond = if Active and !Active[1]
then 1
else timeSegment;
profile vol = VolumeProfile("startNewProfile" = cond,
"onExpansion" = 0,
"numberOfProfiles" = 20,
"pricePerRow" = TickSize(),
"value area percent" = valueAreaPercent);
def pc = if IsNaN(vol.GetPointOfControl())
then pc[1]
else vol.GetPointOfControl();
def hVA = if IsNaN(vol.GetHighestValueArea())
then hVA[1]
else vol.GetHighestValueArea();
def lVA = if IsNaN(vol.GetLowestValueArea())
then lVA[1]
else vol.GetLowestValueArea();
def hProfile = if IsNaN(vol.GetHighest())
then hProfile[1]
else vol.GetHighest();
def lProfile = if IsNaN(vol.GetLowest())
then lProfile[1]
else vol.GetLowest();
def POC_ = if Active
then Round(pc / TickSize(), 0) * TickSize()
else POC_[1];
plot POC = if x >= HighestAll(firstBar)
then HighestAll(if IsNaN(c[-1])
then POC_
else Double.NaN)
else Double.NaN;
def ProfileHigh_ = if Active
then hProfile
else ProfileHigh_[1];
plot ProfileHigh = if x >= HighestAll(firstBar)
then ProfileHigh_
else Double.NaN;
def ProfileLow_ = if Active
then lProfile
else ProfileLow_[1];
plot ProfileLow = if x >= HighestAll(firstBar)
then ProfileLow_
else Double.NaN;
def VAHigh_ = if Active
then Round(hVA / TickSize(), 0) * TickSize()
else VAHigh_[1];
plot VAHigh = if x >= HighestAll(firstBar)
then HighestAll(if IsNaN(c[-1])
then VAHigh_
else Double.NaN)
else Double.NaN;
def VALow_ = if Active
then Round(lVA / TickSize(), 0) * TickSize()
else VALow_[1];
plot VALow = if x >= HighestAll(firstBar)
then HighestAll(if IsNaN(c[-1])
then VALow_
else Double.NaN)
else Double.NaN;
vol.Show(color.current, Color.YELLOW, Color.current, opacity);
POC.SetStyle(Curve.LONG_DASH);
POC.SetLineWeight(3);
POC.SetDefaultColor(Color.YELLOW);
VAHigh.SetStyle(Curve.LONG_DASH);
VAHigh.SetLineWeight(1);
VALow.SetStyle(Curve.LONG_DASH);
VALow.SetLineWeight(1);
VAHigh.SetDefaultColor(Color.GRAY);
VALow.SetDefaultColor(Color.GRAY);
ProfileHigh.SetStyle(Curve.LONG_DASH);
ProfileHigh.SetLineWeight(3);
ProfileLow.SetStyle(Curve.LONG_DASH);
ProfileLow.SetLineWeight(3);
ProfileHigh.SetDefaultColor(Color.GREEN);
ProfileLow.SetDefaultColor(Color.RED);
def bubble = IsNaN(c[2]) and !IsNaN(c[3]);
AddChartBubble(bubble, VAHigh, "OR %" + valueAreaPercent, VAHigh.TakeValueColor(), yes);
AddChartBubble(bubble, VALow, "OR %" + valueAreaPercent, VALow.TakeValueColor(), no);
AddChartBubble(bubble, POC, "OR POC", POC.TakeValueColor(), no);
AddChartBubble(bubble, ProfileHigh, "ORH", ProfileHigh.TakeValueColor(), yes);
AddChartBubble(bubble, ProfileLow, "ORL", ProfileLow.TakeValueColor(), no);
AddVerticalLine(Active and !Active[1], "RTH", Color.CYAN, Curve.SHORT_DASH);
AddVerticalLine(!Active and Active[1], "ORend", Color.CYAN, Curve.SHORT_DASH);
AddVerticalLine(t crosses above RTE, "RTHend", Color.CYAN, Curve.SHORT_DASH);
def prevClose = if t crosses above RTE
then vwap
else prevClose[1];
def prevCloseBar = if t crosses above RTE
then BarNumber()
else Double.NaN;
plot prevCloseLine = if x >= HighestAll(prevCloseBar)
then HighestAll(if IsNaN(c[-1])
then prevClose
else Double.NaN)
else Double.NaN;
prevCloseLine.SetStyle(Curve.SHORT_DASH);
prevCloseLine.SetDefaultColor(Color.GRAY);
AddChartBubble(x == HighestAll(x), prevCloseLine, "RTH C", prevCloseLine.TakeValueColor(), no);
def RTHopen = if Active and !Active[1]
then o
else RTHopen[1];
plot RTHopen_ = if x >= HighestAll(firstBar)
then HighestAll(if IsNaN(c[-1])
then RTHopen
else Double.NaN)
else Double.NaN;
RTHopen_.SetStyle(Curve.SHORT_DASH);
RTHopen_.SetDefaultColor(Color.GRAY);
AddChartBubble(x == HighestAll(x), RTHopen, "RTH O", RTHopen_.TakeValueColor(), no);
# End Code ORB using Volume Profile

Shareable Link

https://tos.mx/2TscIe
 
This script does not seem to work in TOS IOS app even though it appears in the studies. There must be some limitation of the TOS moble app.

 
@Chenthy73 Unfortunately, not at the moment. A lot of custom indicators you find will not be compatible with ToS app.

 
hey Ben, I have a Q about the this ORB strategy. The Target lines, RO, Tgt2 etc. what triggers the RO line to appear? I notice sometimes price breaks above ORB/bullzone and the RO line doesn't appear, but appears below the ORB/bear zone. Just trying to make sure I am not missing something. Thanks

 
@Bignoek Hey, I'm not too sure on that. There is probably a function in that code on how the lines are calculated. I'll let you know if I find something.

 
Hey Ben,

New user here, loving your site. Thank you!

Question on this - when the stock breaks out, are you looking to buy a call at the underlying's strike price when it crossed, or a deeper ITM Call?

Thanks :)

 
@jr87 RiskOn/RiskOff. I see them as support/resistance level.

 
@icantrade I would have to look into it but here is a scanner I found for ORB (created by Linus).

Rich (BB code):
 Opening Range Breakout 
linus, 2014 Feb 22, v0.6 

declare lower;  # for testing on chart. 

#hint UseDate: If UseDate is Yes then only scan when the date matches the  DateToScanFor input.  

input UseDate = No; 

#hint DateToScanFor: if UseDate = Yes then set to the date on which the scanner will search; 

input DateToScanFor = 20140220; 

#hint FindAllBreakouts: If Yes then all breakouts after the opening range will be flagged, else if No then just the first breakout (up or down) will be flagged. 

input FindAllBreakouts = Yes; 

#hint TradeZoneStartTime: Entry must be at or after this time to be found, in Eastern time. 

input TradeZoneStartTime = 930; 

#hint TradeZoneEndTime: Entry must be before this time to be found, in Eastern time.  

input TradeZoneEndTime = 1600; 

#hint MinutesInRange: Duration in minutes of opening range.  

input MinutesInRange = 1; 

#hint TargetRange: If 0, don't scan for TargetRange.  If greater than zero and less than 5 then multiply the height of the range by TargetRange to determine when targets have been hit. [Example: TargetRange = 0.5 scans for price above Range High + ((Height of Range) * 0.5), or price below Range Low - ((Height of Range) * 0.5)]. 

input TargetRange = 0.0; 

#hint price: Price used to signal an entry when crossing opening range.  

input price = close; 

def dateOK = !UseDate or DaysFromDate(DateToScanFor) == 0;  

def startSecs = SecondsFromTime(TradeZoneStartTime); 

# True if the current bar is in the opening range. 

def inOR = startSecs >= 0 and startSecs < MinutesInRange * 60; 

# True if in the trade zone. 

def inTradeZone = startSecs >= 0 and SecondsTillTime(TradeZoneEndTime) > 0; 

# H2, L2 store the current high and low of opening range. 

def H2 = if !inTradeZone then Double.NaN else if inOR and !inOR[1] then high else if inOR and H2[1] < high then high else H2[1]; 

def L2 = if !inTradeZone then Double.NaN else if inOR and !inOR[1] then low else if inOR and L2[1] > low then low else L2[1]; 

# pastOR is 0 if not in the trading zone, or in the opening range. pastOR is 1 if at the first bar after the opening range.  pastOR is 2 if past the first bar after range. 

def pastOR = CompoundValue(1, if !inTradeZone or inOR or !dateOK then 0 else if !inOR and inOR[1] then 1 else if pastOR[1] == 1 then 2 else pastOR[1], 0); 

def target = if !pastOR then 0 else if TargetRange > 0 and TargetRange < 5 then (H2 - L2) * TargetRange else 0; 

# Breakout is 1 if price has crossed above opening range, -1 if price has crossed below then opening range, else is 0. 

def signal = compoundValue(1,  

    if !pastOR then 0  

    else if signal[1] != 0 and !FindAllBreakouts then signal[1] 

    else if price > H2 + target then 1  

    else if price < L2 - target then -1  

    else 0  

, 0); 

plot Breakout = if !isNaN(close) then signal else Double.NaN; 

Breakout.SetPaintingStrategy(PaintingStrategy.LINE_VS_POINTS); 

Breakout.AssignValueColor(if Breakout > 0 then Color.GREEN else if Breakout < 0 then Color.RED else Color.GRAY); 
END SCAN 
 
@BenTen thanks BenTen.

One question - I am assuming the changes were in the display (especially the visibility of the cloud) - but the core functionality is still the same. Am I correct?

 
@bayareatrader Yes, I only changed the customization. The core functionality remains intact.

You can read Steve's learning logs here.

 
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
375 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