Opening Range Breakout Strategy with Market Volatility for ThinkorSwim

netarchitech

netarchitech

Well-known member
@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:
M

mo2020

New member
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:
1

15minofpham

New member
I didn't get any results either. :-(

 
Last edited:
BenTen

BenTen

Administrative
Staff
VIP
@15minofpham Whats the ticker?

 
Last edited:
markos

markos

Well-known member
VIP
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:
BenTen

BenTen

Administrative
Staff
VIP
@markos Interesting. I'll definitely take a look for sure. Thanks for bringing that up.

 
Last edited:
1

15minofpham

New member
@BenTen This was the scan that netarchitech created. The scan didn't bring up any results.

 
Last edited:
Y

ykd2018x

Member
2019 Donor
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:
BenTen

BenTen

Administrative
Staff
VIP
@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:
markos

markos

Well-known member
VIP
@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... http://tos.mx/GunLX7 Have a great weekend.

 
Last edited:
S

San

Member
2019 Donor
@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:
M

mo2020

New member
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:
BenTen

BenTen

Administrative
Staff
VIP
@mo2020 You can probably integrate it into the existing code.

 
Last edited:
M

mo2020

New member
@BenTen Thanks but how ? Thank for your help

 
Last edited:
markos

markos

Well-known member
VIP
@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:
T

thinky

Member
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.

 
B

Bill

New member
2019 Donor
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:

Top