Opening Range (ORB) Watchlist Column for ThinkorSwim

markos

markos

Well-known member
VIP
Below are two custom watchlist columns for the Opening Range Breakout indicator. Add either one to your watchlist of stocks and it will tell you which tickers are currently breaking out, breaking down, or within the trading range of the first 30mins.

Both work the same way - just visually different. First one was created by Mobius and the second one by @WalkingBallista.



Mobius ThinkScript Lounge 2017

Rich (BB code):
# ORB Watch List Column
input StartTime = 0930;
input EndTime = 1000;
def h = high;
def l = low;
def c = close;
def ORActive = if SecondsFromTime(StartTime) > 0 and
                   SecondsTillTime(EndTime) >= 0
                then 1
                else 0;
def ORH = if ORActive and !ORActive[1]
           then h
           else if ORActive and
                   h > ORH[1]
                then h
                else ORH[1];
def ORL = if ORActive and !ORActive[1]
           then l
           else if ORActive and
                   l < ORL[1]
                then l
                else ORL[1];
def ORhigh = if !ORActive
              then ORH
               else Double.NaN;
def ORlow = if !ORActive
              then ORL
              else Double.NaN;
AddLabel(1, if close > ORhigh
             then "Above"
             else if close < ORlow
                  then "Below"
                  else "Inside",
             if close > ORhigh
             then color.green
             else if close < ORlow
                  then color.red
                  else color.yellow);

WalkingBallista's thinkScript Code

Code:
# 30 min opening range
# Robert Payne
# WalkingBallista Watchlist

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

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

plot status = if close > OpenRangeHigh then 1 else if close < OpenRangeLow then 0 else -1;
status.AssignValueColor(if status == 1 then Color.Dark_Green else if status == 0 then Color.Dark_Red else Color.Dark_Orange);
AssignBackgroundCOlor(if status == 1 then Color.Dark_Green else if status == 0 then Color.Dark_Red else Color.Dark_Orange);

Shareable Links

@BenTen contributed to this post.
 
Last edited:
L

laketrader

New member
2019 Donor
VIP
Great. You can define a custom column with the above code. And then add this custom column into a stock watchlist. You can quickly figure out which stocks in the watchlist break out from open range.

 
Last edited:
Y

ykd2018x

Member
2019 Donor
CAN U TELL HOW TO CREATE THIS COLUMN ? i only know to create a scanner and use it as watch list , its something different , any referal link for more info also okay

thanks
 
BenTen

BenTen

Administrative
Staff
VIP
@ykd2018x Click on the option to Customize your watchlist column (it's the gear icon). Under the dropdown menu > select Custom Quotes > Pick one of the Custom Quotes > Delete the current setting > Switch over to thinkScript Editor > Paste either one of the code above.



Step 2 in the screenshot above is wrong. It's supposed to be pointing at the Delete button instead of the Edit button.
 
B

Brethan

New member
I tried using custom quote with the code and doesnt seem to work. Getting "above" on all stocks on watchlist.
 
V

VicD

Member
Hey, can you guys piggy back on this? I use ORB ( i have a 5 minute fib one that works great. But I want to do a column like this but that also states how wide the opening rage was. As I trade options you need some distance, say your opening range was 2.75%, Like ZM today. Now, you know if it failed at the first fib, it would go back in range and potentially go to oposite side. So 2.75% on zoom is a nice payday. Any idea how I would set the text in the column to tell me how much the opening range was?
 
P

Pumper

New member
Please anyone? Or an alert when the price action is going within like 5 cents of opening high/low would be nice too.
 
G

gregoryK

New member
VIP
I'm getting same EXACT thing! What is the solution???
Same problem. I'm getting above on all. I changed the script from 9:30 to 9:45 because I like the 15ORB, but still didn't work. Was above before the start of the market and all through the day.
 
V

VicD

Member
@Pumper @Brethan Change to a different time frame or try a different watch list.
 
P

Pumper

New member
@Pumper @Brethan Change to a different time frame or try a different watch list.

Can you fix that? IDK code. Looks like Gregory already tied to change to a different time and it didn't work.

I'm not aware of any other watch lists like this.

PLEASE HELP!

@BenTen C'mon champ you can fix this easy. Blessings.
 
V

VicD

Member
This is the code I have. And it works just fine. I have it set to 5 minutes at the top next to the name.

Code:
# ORB Watch List Column

input StartTime = 0930;

input EndTime = 0935;

def h = high;

def l = low;

def c = close;

def ORActive = if SecondsFromTime(StartTime) > 0 and

                   SecondsTillTime(EndTime) >= 0

                then 1

                else 0;

def ORH = if ORActive and !ORActive[1]

           then h

           else if ORActive and

                   h > ORH[1]

                then h

                else ORH[1];

def ORL = if ORActive and !ORActive[1]

           then l

           else if ORActive and

                   l < ORL[1]

                then l

                else ORL[1];

def ORhigh = if !ORActive

              then ORH

               else Double.NaN;

def ORlow = if !ORActive

              then ORL

              else Double.NaN;

AddLabel(1, if close > ORhigh

             then "Above"

             else if close < ORlow

                  then "Below"

                  else "Inside",

             if close > ORhigh

             then color.green

             else if close < ORlow

                  then color.red

                  else color.yellow);
 
Last edited by a moderator:
P

Pumper

New member
This is the code I have. And it works just fine. I have it set to 5 minutes at the top next to the name.
Same thing. Everything is still listed as "above"...

I got $10 paypal if someone can fix this problem and make my thinkorswim alert me whenever the orb high / low is crossed.

$5 if you can just fix the indicator to get it working properly, instead of it saying "above" for ever ticker.
 
lowtrade

lowtrade

Member
VIP
I just created one with WalkingBallista's code. Change the time interval to 5 minutes and works fine.
 
V

VicD

Member
I swear. I told you exactly the same thing, Ben had a picture of it in reply #4. You could have just scrolled through the thread! It's like RIGHT THERE. You need a custom photo too? 🥃 I need a whisky after some conversations.
 
P

Pumper

New member
I swear. I told you exactly the same thing, Ben had a picture of it in reply #4. You could have just scrolled through the thread! It's like RIGHT THERE. You need a custom photo too? 🥃 I need a whisky after some conversations.

You did tell me the same exact thing. But lowtrade showed a picture of how to change the time. For all a newbie to ToS like me, and many others I'm sure, saw your post and thought "WTF how do I change the time in the code".

On the other hand, my boy came through THOROUGH with a pic. On how to change the time. That's why he's the GOAT, and you the runner up. But being runner up still ain't bad.
 
lowtrade

lowtrade

Member
VIP
@VicD I got your custom watch list code working but I still didn't get it.

Would you mind to explain the below values?
Inside
Above
Below

 
V

VicD

Member
If the price is inside the opening range it says Inside, if below it says below and if above it says above. You set your time period as you like. Say 5 minute range, if your price above the range will say above, if below below. If you are looking to trade trending, you buy if it breaks out from range or when it back tests OR, if below same rule, if it's breaking out and trending down or it comes back to OR an rejects you get puts or sell short whatever your cup o tea is. If it is a nice fat range you can sell for premium or trade from failure to reach or rejection of range top (or typically failed breakouts to first SD or first Fib extension. And you buy off the rejection of bottom. I trade options and one of my favorite trades is morning breakout to 2nd fib (cause if you have a certain set up that trade works like 90% of the time) and then you sell out and reverse at rejection to the lower end of range. (There is another set up, the gap and run, typically goes 3-4 fibs out of the gate but it does like a pivot and comes back to like 75% of move before it breaks out, making an opening range)
 

Similar threads

Top