Opening Range Breakout (ORB) Scanner for ThinkorSwim

L

Likos

Member
VIP
@netarchitech Appreciate the reply :) Looking forward to your answer.

 
Last edited:
L

Likos

Member
VIP
@netarchitech Is there a way to add an addition to support/resistance threshold fishing?

 
Last edited:
netarchitech

netarchitech

New member
@Likos The "Limiter" can be set to whatever value you want, so feel free to experiment with it...The scan should be able to be used either extended or regular trading hours...Just change the setting for input ShowTodayOnly = yes** to "**no**" (it is right above **input Limiter = 0.05 in the code)

@Likos I'm not familiar with "support/resistance threshold fishing", could you provide an explanation? Thanks :)

 
Last edited:
L

Likos

Member
VIP
@netarchitech



  • 1. Just an explanation of what 0.05 value is for so I understand the nature of the search
  • 2. Support/Resistance that not only picks breakouts but also reputable SR (support resistance) score that's worth decision making.
  • 3. Upon playing with it via after hours check mark 1min, it gave me a handful of results is it because it's set to # breakdown?
  • 4. If I leave it on yes, can it scan pre-market to opening as well?
 
Last edited:
netarchitech

netarchitech

New member
@Likos In the original code:

Rich (BB code):
plot entryLine1 = OpenRangeHigh + (range * 0.06);

plot entryLine2 = OpenRangeLow - (range * 0.06);
The amount specified for the breakout/breakdown thresholds was fixed at 6%, thereby limiting the user to a specific result set, per the following request:

> @15minofpham Is there a way to tweak it so the scan only returns X pct? ie. 1% above breakout? This way it keeps the results more manageable.
I just created a variable ("Limiter") and an input so the user could specify whatever value they wanted:

Rich (BB code):
input Limiter = 0.05;

# 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));
The scan, as it currently configured, will find Breakouts. The Hashtag character (#) is used to comment out the Breakdown portion of the code because you can't have more than one plot at a time in a scan...Just move the # to the beginning of the Breakout code to find Breakdowns...

Hope this helps...

Good Luck and Good Trading :)

 
Last edited:
L

Likos

Member
VIP
@netarchitech I'm still confused though; what's the difference from break down to breakouts of that scan ? # set to breakdown gives me all green results or large gains, while breakout scans for low floats per say.

The 0.06 or 0.05 by definition is it seeking symbols going above 5% or something ? Sorry for the handful of questions. I feel this is appropriate for a opening market scan after 8-9am looks like.

 
Last edited:
L

Likos

Member
VIP
@netarchitech These are the after hours searches for #breakdown set 0.50 to $10.00 stocks





 
Last edited:
netarchitech

netarchitech

New member
> @Likos I'm still confused though; what's the difference from break down to breakouts of that scan ? # set to breakdown gives me all green results or large gains, while breakout scans for low floats per say.

>
> The 0.06 or 0.05 by definition is it seeking symbols going above 5% or something ? Sorry for the handful of questions. I feel this is appropriate for a opening market scan after 8-9am looks like.
@Likos Breakouts and Breakdowns will return stocks having exceeded or broken above or below their previous range:

Rich (BB code):
def PreviousRange = high[1] - low[1];
The range is further defined by the application of a 10 period simple moving average to that previous range:

Rich (BB code):
def range = Average(PreviousRange, 10);
The defined range is then plugged in to the following code:

Rich (BB code):
def entryLine1 = OpenRangeHigh + (range * 0.06);
def entryLine2 = OpenRangeLow - (range * 0.06);
whereupon at market open, for the first 30 minutes, the OpenRangeHigh and OpenRangeLow are established:

Rich (BB code):
def OpenRangeMinutes = 30;
def MarketOpenTime = 0930;
Now at the close of the 30 minute period, either the breakout or the breakdown scan can be run:

Rich (BB code):
plot breakout = close > (entryline1 + (entryline1 * Limiter));
#plot breakdown = close < (entryline2 - (entryline2 * Limiter));
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. For example:

> @netarchitech When I ran this without the "Limiter" I got 233 results...After plugging in the Limiter, the scan returned 3 results...
The Hashtag (#) prevents a line of code from executing, so when it is placed at the beginning of a line of code that code will not run. For example:

Rich (BB code):
plot breakout = close > (entryline1 + (entryline1 * Limiter));
#plot breakdown = close < (entryline2 - (entryline2 * Limiter));
The breakdown code will not run in this case. The breakout code will run...

As for the scan you ran:

> @Likos These are the after hours searches for #breakdown set 0.50 to $10.00 stocks
You can increase the "Limiter" to say 0.10 from 0.05 to see how many stocks are left on the list...

Hope this helps...

Good Luck and Good Trading :)


 
Last edited:
L

Likos

Member
VIP
@netarchitech This is amazing... Blows my mind on so many levels... May I suggest one thing? How would you feel implementing say an MFI AKA money flow index? Call me crazy, but what if the search can be a little more tweaked narrowing down an ideal price strength focus growth/trending than just an accumulation focus on any sort of breakout/breakdown? Prior to playing a lot of scans/indicators (over 50) it makes more sense the strength of money flow is more ideal than just volume. I say this with great emphasize simply because 1) Volume can be misleading 2)Avg.Volume can be applied nearly the same 3) unpredictable outcome due to a change in direction regardless of which way the scale goes - up or down



Overall, what matters to most in any trades prior to my learning experience are momentum, pr, resistance/support, MFI, so far...

One more question, would changing def MarketOpenTime = 0930 to 830 have an impact in anyway?

 
Last edited:
netarchitech

netarchitech

New member
@Likos As for the possibility of adding an MFI filter, I would have to take a look over the weekend. What criteria are you looking for? Also, the more filters placed on a result set, the more likely you won't get any results...

You could change the def MarketOpenTime to whatever time value you want, perhaps 0800 instead of 0830 to correspond with the start of pre-market trading...

 
Last edited:
L

Likos

Member
VIP
@netarchitech Mostly under All NASDAQ Stocks.

 
Last edited:
netarchitech

netarchitech

New member
OK...I was thinking what MFI value you were looking for...For example, under 20 or over 80...

 
Last edited:
L

Likos

Member
VIP
@netarchitech Not sure or what period days would be ideal for day scanning.

 
Last edited:
netarchitech

netarchitech

New member
@Likos OK...no problem...I'll see what I can do... :)

 
Last edited:
netarchitech

netarchitech

New member
@Likos Unfortunately, I have bad news...with my rather meager thinkscripting skills, I tried to incorporate the MFI filter with the scan. but it stated "No Matching Symbols", no matter how I tried to configure it :( On the upside, you can still use the original scan :)

Good Luck and Good Trading...

 
Last edited:
L

Likos

Member
VIP
@netarchitech Could I challenge you to implement a KST script ? (Know sure thing aka the indicator). &#128524;

 
Last edited:
netarchitech

netarchitech

New member
@Likos Well I thought I was up to your challenge, but, in the end, the combination of the two scans yielded no results :( Maybe if there is a knowledgeable thinkscripter out there, they can mash the two scans together...

Good Luck and Good Trading :)

 
Last edited:
1

15minofpham

New member
netarchitech or anyone,

How would you convert this scan code into a column so it can show the pct above the OR high/low?

Thanks again!


 
Last edited:
BenTen

BenTen

Administrative
Staff
VIP
Warehouse
@15minofpham You can use this code:

Rich (BB 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);
 
Last edited:

Top