Opening Range Breakout (ORB) Scanner for ThinkorSwim

@netarchitech so, this is basically 6% above High bar plus 5% with limiter?
@dmillz Given the following code:

https://usethinkscript.com/threads/opening-range-breakout-orb-scanner-for-thinkorswim.68/post-626

And the explanation given here:

https://usethinkscript.com/threads/opening-range-breakout-orb-scanner-for-thinkorswim.68/post-843

Whereas the original 0.06 limited the range that was added/subtracted to the OpenRangeHigh/OpenRangeLow, the result sets could be rather large, so I added the "Limiter" to reduce the size of the result sets
Hope this helps...

Good Luck and Good Trading :)
 

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

@BenTen I've retooled Robert Payne's scan above to further refine results. Just plug in the desired percentage amount in the "Limiter" input and scan. Also, make sure to specify whether you're looking for Breakouts or Breakdowns by positioning the Hashtag (#) in front of the plot statement you want to exclude...

Rich (BB code):
# Filename: 30_min_Opening_Range_SCAN

# source: 30 min opening range
# original author: Robert Payne

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

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 PreviousRange = high[1] - low[1];
def range = Average(PreviousRange, 10);

def entryLine1 = OpenRangeHigh + (range * 0.06);
def entryLine2 = OpenRangeLow - (range * 0.06);

# Scan currently set to find Breakouts
# Move Hashtag to Breakout plot to scan for Breakdowns
# Limiter set by user (currently 5 percent)

plot breakout = close > (entryline1 + (entryline1 * Limiter));
#plot breakdown = close < (entryline2 - (entryline2 * Limiter));
When I ran this without the "Limiter" I got 233 results...After plugging in the Limiter, the scan returned 3 results...

Hope this helps...

Good Luck and Good Trading :)
Would you set-up up this scanner as @BenTen did n post #1 or differently?
 
Welcome to useThinkScript, @Rosalyn...

In order to take advantage of the "Limiter", you should follow @BenTen's initial instructions then copy/paste this scan code into the "thinkScript Editor" and delete any code currently in the "Condition Wizard"...

20201001-ORB-Scan-think-Script.png


Hope this helps...

Good Luck and Good Trading :)
 
Welcome to useThinkScript, @Rosalyn...

In order to take advantage of the "Limiter", you should follow @BenTen's initial instructions then copy/paste this scan code into the "thinkScript Editor" and delete any code currently in the "Condition Wizard"...

20201001-ORB-Scan-think-Script.png


Hope this helps...

Good Luck and Good Trading :)
thank you for trying to help. I know where to paste it but still not clear as to if I have to create the condition first and then paste the code in the editor or not. I tried not creating the condition and going to the editor and it does not work. Nothing scans. It is very confusion...
 
Happy to help if I can, @Rosalyn...

There is nothing to create in the "Condition Wizard" because the code in the "thinkScript Editor" is the condition...

Maybe try adjusting the "Limiter"...First try no limit (0.00) and see if you get any results...

Good Luck and Good Trading :)
 
Happy to help if I can, @Rosalyn...

There is nothing to create in the "Condition Wizard" because the code in the "thinkScript Editor" is the condition...

Maybe try adjusting the "Limiter"...First try no limit (0.00) and see if you get any results...

Good Luck and Good Trading :)
Hello, i did not edit anything on the script but created it as is, i just tried editing the limiter to 0 and no luck, 0 results

can u share the link? thx
 
Hi @Rosalyn,

Below please find the link you requested...I made two changes to the scan:
  1. I changed the timeframe from Daily to 30 minutes
  2. I added "RangeLimiter" to go with the original "Limiter" to be able to better scope result sets
As a result of the changes made, the scan does return tickers...Give it a try and let me know how it goes...

Hope this helps...

Good Luck and Good Trading :)

Link: http://tos.mx/Nqe2Z6l
 
Happy to help if I can, @Rosalyn...

There is nothing to create in the "Condition Wizard" because the code in the "thinkScript Editor" is the condition...

Maybe try adjusting the "Limiter"...First try no limit (0.00) and see if you get any results...

Good Luck and Good Trading :)
I also wanted to ask you and @BenTen if there is a scanner for stocks the are Up Gappers i.e. $TWLO today and Down Gappers ...thx
 
Hi All, Love the idea of ORB as a trading idea. Is anyone using this strategy finding that the stock is trading within the opening range all day as of recent? I'm getting lots of false breaks of the OR, but nothing that really runs without pulling back.
 
@netarchitech, thankyou for the awesome orb scanner. I have been playing with the source code a bit and i have an issue if you can help i will greatly appreciate it.
If i do a 10 min scan as below--

# Filename: 10_min_Opening_Range_SCAN

# source: 10 min opening range
# original author: Robert Payne

def OpenRangeMinutes = 10;
def MarketOpenTime = 0930;
input ShowTodayOnly = yes;
input Limiter = 0.03;

The scan results start coming in usually around 10.15ish but the stocks(in the scanner) have been moving(upward or downward) as soon as the market opens. Is there a setting in the code that can help the results pop up around 9:40 to 9:50?

Now if i change the market opening time to 9:20(using extended hrs) the scans are updated even around 9:35.
 
@ajmann You are certainly welcome...I'm glad to hear that the ORB Scanner is proving useful :) Credit, of course, goes to @RobertPayne for the scripting of the scanner...I only added a small mod to it...

The scan results start coming in usually around 10.15ish but the stocks(in the scanner) have been moving(upward or downward) as soon as the market opens.

As for the stocks moving upwards and downwards in your scanner, I believe that might be a column in the scanner that you have set to order, either ascending or descending, and the results are refreshing rapidly as the opening market data flows in...

2020-11-03-22-16-10.png


Is there a setting in the code that can help the results pop up around 9:40 to 9:50?

Frankly, I have not messed around with this scanner since the "Limiter" modification...I don't know if you can pinpoint the opening range like that, but maybe another member of the uTS community might be able to help...

Good Luck and Good Trading :)
 
@BenTen I am getting an error that says "exactly one plot expected".. any idea? I am copying and pasting right from page one. This is the study I have downloaded from the thread http://tos.mx/3tKKDCf

Thanks again for your help
I just copied and pasted the first script posted on the first page and it works as expected, without errors... I prefer the Copy & Paste method over using the shared links as it requires less steps in the long run...
 
@rad14733 Right, I am copying and pasting. I was just sharing the indicator I have loaded. I copy and paste the code directly to the scanner and get the same error. Not sure where I am messing this up. Does the scanner tie in with the indicator?
 
@TheNameIsBond You need to save the code as an indicator and then load that indicator into your scanner. Don't copy/paste the code directly into your scanner. Not going to work.
 
@TheNameIsBond Take a look at the video below. The entire process won't be the same as demonstrated in the video but it should be a good starting place for you to learn more about the scanner.

 
@BenTen I apologize if we are confusing each other. I am trying to create the scanner for a break of the ORH or ORL. I am creating a scanner that has the conditions "Close "crosses" (study) ORH2ext within 2 bars" and inverse for ORL2ext.. when I do that I get the too complex error..

The "code" that it switches to in the thinkscript editor says "close crosses OpeningRangeBreakout()."ORH2ext" within 2 bars and close crosses OpeningRangeBreakout()."ORL2ext" within 2 bars"

If I change "and" to "or" I still get error..
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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