Opening Range Breakout Strategy with Market Volatility for ThinkorSwim

@BenTen I attempted to convert the strategy to a scan:

Rich (BB code):
# 30 min opening range Market Volatility V1.1 SCAN
# Robert Payne
# Adapted to strategy by WalkingBallista and BenTen
# https://usethinkscript.com/d/164-algo-trading-breakouts-indicator-for-thinkorswim

input atrlength = 14;

input avglength = 500;

def vol = reference ATR(atrlength, averageType = AverageType.SIMPLE);

def avgvol = Average(vol, avglength);

def calm = vol < avgvol - (avgvol * .1);

def neutral = avgvol + (avgvol * .1) > vol > avgvol - (avgvol * .1);

def volatile = vol > avgvol + (avgvol * .1);

def window =  vol - avgvol;

def OpenRangeMinutes = 30;
def MarketOpenTime = 0930;
def LastBar = SecondsFromTime(1530) == 0;
input TimeToStopSignal = 1525;
def TradeTimeFilter = SecondsFromTime(TimeToStopSignal);
input ShowTodayOnly = no;
input ema1_len = 8;
input ema2_len = 13;

def Today = if GetDay() == GetLastDay() then 1 else 0;
def FirstMinute = if SecondsFromTime(MarketOpenTime) < 60 then 1 else 0;
def OpenRangeTime = if SecondsFromTime(MarketOpenTime) < 60 * OpenRangeMinutes then 1 else 0;

def ORHigh =  if FirstMinute then high else if OpenRangeTime and high > ORHigh[1] then high else ORHigh[1];
def ORLow = if FirstMinute then low else if OpenRangeTime and low < ORLow[1] then low else ORLow[1];

def OpenRangeHigh = if ShowTodayOnly and !Today then Double.NaN else if !OpenRangeTime then ORHigh else Double.NaN;
def OpenRangeLow = if ShowTodayOnly and !Today then Double.NaN else if !OpenRangeTime then ORLow else Double.NaN;

def dailyRange = high(period = "day" )[1] - low(period = "day" )[1];
def range = Average(dailyRange, 10);

def ema1 = MovAvgExponential(length=ema1_len);
def ema2 = MovAvgExponential(length=ema2_len);

# Bullish
plot buy_bullish = ((close crosses above OpenRangeHigh) OR (ema1 crosses above OpenRangeHigh)) and TradeTimeFilter < 1 and volatile;

#def sell_bullish = ema1 crosses below ema2 or (close < OpenRangeHigh) or LastBar;

# Bearish
#plot short_bearish = ((close crosses below OpenRangeLow) OR (ema1 crosses below OpenRangeLow)) and TradeTimeFilter < 1 and volatile;

#def cover_bearish = ema1 crosses above ema2 or (close > OpenRangeLow) or LastBar;
While it compiles with no errors, it has not generated any results either. Please test when you have a chance... Thanks...

Good Luck and Good Trading :)

 
Last edited:

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

Hi can you customize Algo parabolic sar that moves with price as a Trailing stop loss they have this indicator on MT4 . Thanks

 
Last edited:
Hi @BenTen Ben, I don't day trade as my day job keeps me away from a screen. That said, you may want to try the stock HullMA in TOS as an alternative to EMA. The EMA calls back quite a large numbers of days (qty not known, but very many past days). Those past days could throw off that calc. Just my 2 cents if you want to try a litttle tweak..... Mark

ps: A zero lag ZEMA might work as well.

 
Last edited:
@markos Interesting. I'll definitely take a look for sure. Thanks for bringing that up.

 
Last edited:
hello @BenTen happy weekend its my first day here , i learnt and follow OP Range Breakout system by last 1 year , i want to ask that if i have lot this stretergy to my chart it will auto open and close the trades ????? like auto trading i dont have to open the trades or its just giving me signals to do ? sorry it might be a dumb question but considering it my first day to this blog kindly pls reply , thanks ,

 
Last edited:
@ykd2018x Hi, welcome &#128515;. Looks like you want ToS to auto trade for you? Like I mentioned above such feature is not available yet. You will need to make the trade by yourself.

 
Last edited:
@BenTen You are welcome. After a little more thought, you may want to leave it with EMA. If you are familiar with Slim Miller from askslim.com, he uses 5 8 13 for his EMA crossovers in his SLMRibbons study. Which I use on my daily & weekly charts. I use them to color the candles... https://tos.mx/GunLX7 Have a great weekend.

 
Last edited:
@markos, Thanks for sharing your setup, I really appreciate your contribution..... I have question why you used bar chard instead of candle.... can you share your Enter and exist setup.

 
Last edited:
Hi can you customize Algo for parabolic sar that moves with price as a Trailing stop loss they have this indicator on MT4 . Thanks

 
Last edited:
@mo2020 You can probably integrate it into the existing code.

 
Last edited:
@San I have it on a bar chart and a candle chart depending how I feel that day. San, I do not day trade, I use everything from standard technical analysis tools like trend lines to the polarity change on the tmo from red to green.

 
Last edited:
The code for the strategy shows 2 errors around the 2 lines that say "delete in TOS".

After deleting those, the editor shows no further errors, but the name of the strategy is still in red color.

S97.png
 
Quick question, what is the -100 or 100 or 0 on the chart at the triggers? I feel like its going to be an obvious answer but for some reason I am not getting it. Thanks.
 
Last edited:

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
366 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