Opening Range Breakout (ORB) Scanner for ThinkorSwim

T

traderintheroom

New member
@15minofpham You can use this version of ORB where it also plots the entry line for breakout and breakdown based on the range times 0.06. You can change that amount manually via the source code. As far as the scanner I'm not too sure.

Rich (BB code):
# 30 min opening range
# Robert Payne

def OpenRangeMinutes = 30;
def MarketOpenTime = 0930;
input ShowTodayOnly = yes;

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];

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

OpenRangeHigh.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
OpenRangeHigh.SetDefaultColor(Color.YELLOW);
OpenRangeHigh.SetLineWeight(2);
OpenRangeLow.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
OpenRangeLow.SetDefaultColor(Color.YELLOW);
OpenRangeLow.SetLineWeight(2);

DefineGlobalColor("cloud", CreateColor(161, 182, 158));
AddCloud(OpenRangeHigh, OpenRangeLow, GlobalColor("cloud" ));

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

plot entryLine1 = OpenRangeHigh + (range * 0.06);
entryLine1.SetDefaultColor(Color.GREEN);

plot entryLine2 = OpenRangeLow - (range * 0.06);
entryLine2.SetDefaultColor(Color.GREEN);

def SoundAlert = high crosses above entryLine1 or low crosses below entryLine2;
Alert(SoundAlert, "Something exciting just happened with " + GetSymbol(), Alert.BAR, Sound.Ring);

Hi Ben - I am looking to edit the alert sound on this ORB Script with a custom sound. Do you know how to write the script to replace Alert.BAR, Sound.Ring with the a custom sound?
 
T

thinky

Member
A. Is It Possible to Add Custom Sounds to Custom Study Chart Alerts in TOS
So at this point the only way to get a custom sound alert using this indicator is to build and save a custom scan. Then set the alert options for that scan. (Yes, the alert settings for a custom scan support custom sounds) We demonstrate how to set the alert options on a scan in the video titled: “Thinkorswim Overnight Range Scan Alert“.
B. Using Custom Alert Sounds In Thinkorswim
https://www.simplertrading.com/using-custom-alert-sounds-in-thinkorswim/







C. Learning Center - Sound
https://tlc.thinkorswim.com/center/reference/thinkScript/Constants/Sound.html

Example: Chimes
Sound.Chimes

Change "Sound.Ring" for the sound you want from the link above (NoSound, Bell, Ding, Ring, Chimes):
Alert(SoundAlert, "Something exciting just happened with " + GetSymbol(), Alert.BAR, Sound.Ring);
 
Last edited:
T

traderintheroom

New member
@traderintheroom Notifications allow for custom sound alerts. Try adding one, then reference it in code as "Custom". Let us know.

Using Custom Alert Sounds In Thinkorswim
https://www.simplertrading.com/using-custom-alert-sounds-in-thinkorswim/







Learning Center - Sound
https://tlc.thinkorswim.com/center/reference/thinkScript/Constants/Sound.html

Example: Chimes



Change "Sound.Ring" for the sound you want from the link above (NoSound, Bell, Ding, Ring, Chimes):
Thanks for the quick reply - I did try to rename the alert file name to the custom sound name in the script without luck. Script editor says invalid statement on this.

What I tried:

Alert(SoundAlert, "Something exciting just happened with " + GetSymbol(), Alert.BAR, Sound.Ring);

I replaced Ring with the file name and also tried .mp3 and Custom Alert (file name).mp3

*It plays if I do a custom price alert just fine just not in the ORB script.

EDIT - I just saw your edit re: SCAN ORB - I will try that, thank you.
 
Last edited:
Y

Yazzy2589

New member
VIP
@BenTen how are you? Do u have a link to your simple ORB chart indicator? Like the pic you posted?
 
dougn

dougn

New member
VIP
Great contribution to the other ORB system that I had. Thank you!

One question...

Is there a way to separate the scan into parts ... bullish and bearish?

Solution: Easy to do within the column "Edit". Just delete one or the other and rename the column.

Outcome: Now the watchlist column alerts are sent out already categorized as breakouts or breakdowns.

Links to separated scan/watchlists added on markos suggestion. Thank you markos. Adjust settings to your personal parameters.

ORB 30m Bear Scan ... http://tos.mx/sW9VOd

ORB 30m Bull Scan ... http://tos.mx/Ppe23L
 
Last edited:
BenTen

BenTen

Administrative
Staff
VIP
Warehouse
@dougn Love the edits. Glad you figured it out :D
 
markos

markos

Well-known member
VIP
Warehouse
@
Great contribution to the other ORB system that I had. Thank you!

One question...

Is there a way to separate the scan into parts ... bullish and bearish?

Solution: Easy to do within the column "Edit". Just delete one or the other and rename the column.

Outcome: Now the watchlist column alerts are sent out already categorized as breakouts or breakdowns.
@dougn please put the share links in for the benefit of this community. Yes I could go back to the beginning, but if I was new at this, I would appreciate a share link. Just a thought. Thanks!
 
Last edited:
dougn

dougn

New member
VIP
Yes that's the right way to do it and I'll make sure it happens going forward.

Edits have been made and links added to my post.
 
T

Tradervic

New member
Hi everyone. I have been trading on TOS for many years but not familiar with Thinkscript. I tried many times to copy the formula to my platform but it seems I can get the scan but the ORB doesn't show up on my charts. I guess I am dumb! Can someone give me step by step on how to import this into my TOS? Also is it a strategy or a study and how to do I save it as such. Any help would be appreciated !
 
BenTen

BenTen

Administrative
Staff
VIP
Warehouse
@Tradervic Are you having trouble with the scanner or the indicator itself?
 
T

Tradervic

New member
BenTen: I copied your scanner script (http://tos.mx/NzMhcR ), and it opens up on my TOS as a scan. But your instructions in the thread is to add study filters and conditions. I get stuck at this part where you want us to select ORB indicator because there isn't a choice for that. Your instructions.....((On the right field, select your ORB indicator. Under plot > ORH2 within 2 bars. Altogether you'll have something like this.))

Also I can't seem to show the indicator on the charts.

I must be missing something really simple. Appreciate your time and help.
 

Top