Opening Range (ORB) Watchlist Column for ThinkorSwim

E

ezrollin

Member
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)
What time frame? Would you care to share a screenshot of said 2nd fib? I dont know 2nd fib, I know 38% or 61% Thanks
 
technicallydreaming

technicallydreaming

Member
Could this be edited to reflect time beyond the first half hour of the market, comparing general range of the previous day price?
 
V

VicD

Member
@technicallydreaming yes, but you would have to bring in the logic to put in the overnight high and low. Below is the study I use to show prior day and premarket open and close on my chart. If you edit the column to show above, below, or inside the premarket, please post it here.

Code:
# Custom Multi Plot ThinkScript by 7of9 for BRT
# edited 3/5/19

# Inputs

input PlotPreMktLinesHrsPastOpen = 0;

input PlotRegMktLinesHrsPastOpen = 0;

input PlotYesterdayMktLinesHrsPastOpen = 0;

input PlotActiveRegMktLinesOnPrevDays = 0;

input DisplayPreMarketPriceBubbles = yes;

input DisplayCurrentDayPriceBubbles = yes;

input DisplayPreviousDayPriceBubbles = yes;

# Pre market / Regular market definitions

def ExtPMOut = PlotPreMktLinesHrsPastOpen * 3610000;

def ExtRMOut = PlotRegMktLinesHrsPastOpen * 3610000;

def ExtYMOut = PlotYesterdayMktLinesHrsPastOpen * 3610000;

def MktPlot = GetLastDay() - PlotActiveRegMktLinesOnPrevDays <= GetDay() and GetLastYear() - 0 <= GetYear();

def PMhrs = RegularTradingStart (GetYYYYMMDD()) > GetTime();

def RMhrs = RegularTradingStart (GetYYYYMMDD()) < GetTime();

def PMplots = RegularTradingStart (GetYYYYMMDD()) > GetTime() - ExtPMOut;

def RMplots = RegularTradingStart (GetYYYYMMDD()) > GetTime() - ExtRMOut;

def YMplots = RegularTradingStart (GetYYYYMMDD()) > GetTime() - ExtYMOut;

def PMStart = RMhrs[1] and PMhrs;

def RMStart = PMhrs[1] and RMhrs;

def PMHigh = CompoundValue(1, if PMStart then high else if PMhrs then Max(high, PMHigh[1]) else PMHigh[1], 0);

def PMLow = CompoundValue (1, if PMStart then low else if PMhrs then Min(low, PMLow[1]) else PMLow[1], 0);

def bar = BarNumber();

def highBar = if PMhrs and high == PMHigh then bar else Double.NaN;

def lowBar = if PMhrs and low == PMLow then bar else Double.NaN;

# Current price line tracker code

plot PriceLine = HighestAll (if IsNaN(close[-1]) and !IsNaN(close) then close else Double.NaN);

PriceLine.SetDefaultColor (Color.GRAY);
PriceLine.SetStyle (Curve.SHORT_DASH);

# Pre market open code

def HidePMO = if GetAggregationPeriod() <= AggregationPeriod.FIFTEEN_MIN then yes else no;

def day = GetDay();

def PMopenBar = day != day[1];

def PMOpen = if PMopenBar then open else PMOpen[1];

plot PMO = if HidePMO and MktPlot and PMplots then PMOpen else Double.NaN;

PMO.SetDefaultColor (CreateColor (234, 136, 255));

# Pre market high code

def HidePMH = if GetAggregationPeriod() <= AggregationPeriod.FIFTEEN_MIN then yes else no;

def PMHighBar = if bar == HighestAll(highBar) then PMHigh else PMHighBar[1];

plot PMH = if HidePMH and PMplots and PMHighBar > 0 then PMHighBar else Double.NaN;

PMH.SetDefaultColor (CreateColor (116, 189, 232));

# Pre market low code

def HidePML = if GetAggregationPeriod() <= AggregationPeriod.FIFTEEN_MIN then yes else no;

def PMLowBar = if bar == HighestAll(lowBar) then PMLow else PMLowBar[1];

plot PML = if HidePML and PMplots and PMLowBar > 0 then PMLowBar else Double.NaN;

PML.SetDefaultColor (CreateColor (116, 189, 232));

# Current day open code

def HideCDO = if GetAggregationPeriod() <= AggregationPeriod.FIFTEEN_MIN then yes else no;

def CDOpen = if !day then Double.NaN else open (period = "day");

plot CDO = if HideCDO and MktPlot and RMplots then CDOpen else Double.NaN;

CDO.SetDefaultColor (Color.WHITE);
CDO.SetStyle (Curve.SHORT_DASH);

#Current day high code

def HideCDH = if GetAggregationPeriod() <= AggregationPeriod.FIFTEEN_MIN then yes else no;

def CDHigh = if !day then Double.NaN else high (period = "day");

plot CDH = if HideCDH and MktPlot and RMplots then CDHigh else Double.NaN;

CDH.SetDefaultColor (Color.GREEN);
CDH.SetStyle (Curve.SHORT_DASH);

#Current day low code

def HideCDL = if GetAggregationPeriod() <= AggregationPeriod.FIFTEEN_MIN then yes else no;

def CDLow = if !day then Double.NaN else low (period = "day");

plot CDL = if HideCDL and MktPlot and RMplots then CDLow else Double.NaN;

CDL.SetDefaultColor (Color.RED);
CDL.SetStyle (Curve.SHORT_DASH);

#Previous day high code

def HidePDH = if GetAggregationPeriod() <= AggregationPeriod.FIFTEEN_MIN then yes else no;

def PDHigh = if !day then Double.NaN else high (period = "day")[1];

plot PDH = if HidePDH and MktPlot and YMplots then PDHigh else Double.NaN;

PDH.SetDefaultColor (CreateColor (153, 255, 153));
PDH.SetStyle (Curve.SHORT_DASH);

#Previous day low code

def HidePDL = if GetAggregationPeriod() <= AggregationPeriod.FIFTEEN_MIN then yes else no;

def PDLow = if !day then Double.NaN else low (period = "day")[1];

plot PDL = if HidePDL and MktPlot and YMplots then PDLow else Double.NaN;

PDL.SetDefaultColor (CreateColor (255, 126, 156));
PDL.SetStyle (Curve.SHORT_DASH);

#Previous day close code

def HidePDC = if GetAggregationPeriod() <= AggregationPeriod.FIFTEEN_MIN then yes else no;

def PDClose = if !day then Double.NaN else close (period = "day")[1];

plot PDC = if HidePDC and MktPlot and YMplots then PDClose else Double.NaN;

PDC.SetDefaultColor (CreateColor (231, 190, 0));
PDC.SetStyle (Curve.SHORT_DASH);

#Pre market bubbles code

def PMBubbles = if GetAggregationPeriod() <= AggregationPeriod.FIFTEEN_MIN then DisplayPreMarketPriceBubbles else no;

AddChartBubble (PMopenBar and PMBubbles, PMO, ("PMO:") + PMO,
CreateColor (204, 204, 255));

AddChartBubble (highBar and PMBubbles, PMH, ("PMH:") + PMH,
CreateColor (204, 204, 255));

AddChartBubble (lowBar and PMBubbles, PML, ("PML:") + PML,
CreateColor (204, 204, 255), no);

#Current day bubbles code

def CDBubbles = if GetAggregationPeriod() <= AggregationPeriod.FIFTEEN_MIN then DisplayCurrentDayPriceBubbles else no;

def CDFirstBar = SecondsFromTime (0800) >= 0 and SecondsFromTime (0800) < 60;

AddChartBubble (CDFirstBar and CDBubbles, CDO, ("CDO:") + CDO,
CreateColor (204, 204, 255));

AddChartBubble (CDFirstBar and CDBubbles, CDH, ("CDH:") + CDH,
CreateColor (204, 204, 255));

AddChartBubble (CDFirstBar and CDBubbles, CDL, ("CDL:") + CDL,
CreateColor (204, 204, 255), no);

#Previous day bubbles code

def PDBubbles = if GetAggregationPeriod() <= AggregationPeriod.FIFTEEN_MIN then DisplayPreviousDayPriceBubbles else no;

def PDFirstBar = SecondsFromTime (0700) >= 0 and SecondsFromTime (0700) < 60;

AddChartBubble (PDFirstBar and PDBubbles, PDH, ("PDH:") + PDH,
CreateColor (204, 204, 255));

AddChartBubble (PDFirstBar and PDBubbles, PDL, ("PDL:") + PDL,
CreateColor (204, 204, 255), no);

AddChartBubble (PDFirstBar and PDBubbles, PDC, ("PDC:") + PDC,
CreateColor (204, 204, 255));

plot PMHclose = PMH;
plot ArrowUp = Crosses(close, PMHclose, CrossingDirection.ABOVE);
ArrowUp.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);


plot PMLclose = PML;
plot ArrowDown = Crosses(close, PMLclose, CrossingDirection.BELOW);
ArrowDown.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);

Alert(ArrowUp, " ", Alert.BAR, Sound.Chimes);
Alert(ArrowDown, " ", Alert.BAR, Sound.Bell);
 
Last edited by a moderator:
V

VicD

Member
@ezrollin Target levels on the fibonacci extensions are T1: 161.8% and T2 261.8%.

The logic:

input fibext1 = .272;
input fibext2 = .618;
input fibext3 = 1.618;
input fibext4 = 2.618;

I don't know how to insert image here, it asks for a URL. Alas. If you overlay the fib extensions on the 5 minute bar, it will be the exact match
 
K

KKaiser

Member
VIP
@VicD Thanks for detail explanation. Could you please share TOS link of your chart if you don't mind. Thank you.
 
V

VicD

Member
Thanks for sharing. I am trying to figure out the lower studies. I could not understand the lower studies dots and triangles. in the TMO bar. Can you please guide me to the post i can get grip of it. Thanks
@HighBredCloud can probably explain it better to you. But they are multi period Fisher at the top, super trend, and trend magic at the bottom. Here is the working version on the lower time frame. https://tos.mx/NUeALnn and I changed the name of it to reflect HBC's contribution. BTW, If you try to go it to say a 15 minute- daily time frames you need to make sure that ALL the timeframes are updated.
 
M

MJP

New member
I am creating an alert column in my scan and I need to first define to use later the High during the first 15 minutes of the regular trading session of that day. I though gettime would make it work but having no luck. I also tried using def Active = secondsTillTime(0930) > 0 and secondsFromTime(0945) > 0 in a formula, but that just makes the column active during that time period. Suggestions?
 
P

Patrick_Hu

New 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.
Hi Markos,
Do you have a watchlist column script to indicate whether the stock breaks prior day high or prior day low? If you have it, could you share it with me?

Thanks.
 
A

alphabeta

Member
@VicD this is great indicator is it possible to extend line of pre market line thank you
 
R

rwfarrell

New member
I am curious if someone can assist. I have this watchlist script for an Open Range Breakout High. I am trying to reverse the instructions to plot the Open Range Breakout Low to the downside. However, once I remove the # the dominant script the Red takes over.

Code:
def Active = SecondsFromTime(0930) > 0 and SecondsTillTime(1000) >= 0;
def ORBH = if Active and !Active[1] then high else if Active and high > ORBH[1] then high else ORBH[1];
plot scan = !Active and close > ORBH;

assignbackgroundcolor(if ORBH then color.green else color.black);

AddLabel (yes, if ORBH then "ORBH" else " ");

AssignBackgroundColor (if ORBH then color.GREEN else color.LIGHT_GRAY);


#def Active1 = SecondsFromTime(0930) > 0 and SecondsTillTime(1000) >= 0;
#def ORBL = if Active1 and !Active1[1] then low else if Active1 and low < ORBL[1] then low else ORBL[1];
#def scan1 = !Active1 and close < ORBL;

#AddLabel (yes, if ORBL then "ORBL" else " ");

#AssignBackgroundColor (if ORBL then color.RED else color.LIGHT_GRAY);
 
V

Vimal Mittal

Member
@markos Can you tell me if I need to setup which time frame or aggregation? 5 min, 15 min, 30 min? Thanks.

@VicD Great it works ! However, can we create an alert too by messaging through the bell in TOS? Thanks.
 
H

HighBredCloud

Well-known member
VIP
How about instead of showing ABOVE or BELOW or INSIDE...there is a bar count that displays GREEN for ABOVE or RED for BELOW the ORB that can be sorted...That way you can see what stock looks good based on how many bars are ABOVE or BELOW the ORB to get into from the watchlist...Anyone is able to do that?
 
BenTen

BenTen

Administrative
Staff
VIP
@HighBredCloud Interesting idea. @diazlaz and I were talking about this last week. Going to tag him in here just in case he has a watchlist column for that.
 
Top