Opening Range Breakout Indicator Labels

mbrennan5

New member
Original Link: https://usethinkscript.com/threads/opening-range-breakout-indicator-for-thinkorswim.16/

I created this "view" of the ORB to get a high-level view of which stocks tend to trend above their ORB more frequently. (Really I just turned off everything but Tgt lines). You can pretty quickly scroll through a bunch of tickers and see which ones trended to Tgt's and how many tgts by the number of lines present.

This got me thinking.. is there a way to create a label that would keep stats on ORB's? <I have an idea of the logic, but not how it'd work. I watch ORB on intraday charts, but would need to keep the stats for each day to compare to all the other days and create "batting averages". Something like:
If ORB high triggered but closed below ORB record as a failed breakout
If price closed above ORB but below Tgt1 record as ORB_held
If price closed between tgt1 and tgt2 record as t1_HIT, > Tgt2 = t2_HIT
Number of days on the chart

Labels:
Failed breakout/Days on chart = %failure...
Orb_held/Days = %orbheld
etc etc for tgts hit


http://tos.mx/HouFMYR
Pretty much what I'm already visually showing, just a way to count it up. How often did it occur? Is that aspect possible?
 
Last edited by a moderator:
Solution
Original Link: https://usethinkscript.com/threads/opening-range-breakout-indicator-for-thinkorswim.16/

I created this "view" of the ORB to get a high-level view of which stocks tend to trend above their ORB more frequently. (Really I just turned off everything but Tgt lines). You can pretty quickly scroll through a bunch of tickers and see which ones trended to Tgt's and how many tgts by the number of lines present.

This got me thinking.. is there a way to create a label that would keep stats on ORB's? <I have an idea of the logic, but not how it'd work. I watch ORB on intraday charts, but would need to keep the stats for each day to compare to all the other days and create "batting averages". Something like:
If ORB high...
Original Link: https://usethinkscript.com/threads/opening-range-breakout-indicator-for-thinkorswim.16/

I created this "view" of the ORB to get a high-level view of which stocks tend to trend above their ORB more frequently. (Really I just turned off everything but Tgt lines). You can pretty quickly scroll through a bunch of tickers and see which ones trended to Tgt's and how many tgts by the number of lines present.

This got me thinking.. is there a way to create a label that would keep stats on ORB's? <I have an idea of the logic, but not how it'd work. I watch ORB on intraday charts, but would need to keep the stats for each day to compare to all the other days and create "batting averages". Something like:
If ORB high triggered but closed below ORB record as a failed breakout
If price closed above ORB but below Tgt1 record as ORB_held
If price closed between tgt1 and tgt2 record as t1_HIT, > Tgt2 = t2_HIT
Number of days on the chart

Labels:
Failed breakout/Days on chart = %failure...
Orb_held/Days = %orbheld
etc etc for tgts hit


http://tos.mx/HouFMYR
Pretty much what I'm already visually showing, just a way to count it up. How often did it occur? Is that aspect possible?


this study will count how many times a test signal triggers during previous days,
and compare it to the count of signals today.

replace the section , test data , with your signal(s)
copy the 3rd section, calcs, as needed for each signal.

there are 3 labels to display stats on 1 signal
there are 2 test bubbles to display variable values.

Ruby:
# stats_orb_00

# count triggers of x1 , a test signal caused by 2 averages crossing 
# stop at prev day
# count the days on chart
# calc a daily avg of x1,  total / days
# compare avg to the count of x1 today
# use day of week to determine when a new day starts

def na = double.nan;
def bn = barnumber();
def istoday = if GetLastDay() == GetDay() then 1 else 0;
def dow = GetDayOfWeek(GetYYYYMMDD());
def newday = if dow <> dow[1] then 1 else 0;
def daycnt = if bn == 1 then 1
  else if (newday and !isnan(close))then daycnt[1] + 1
  else daycnt[1];
def dayqty = highestall( if !isnan(close) then daycnt else 0);
def revdaycnt = if newday then (dayqty - daycnt)+1
  else revdaycnt[1];

input test1_bubbles_daycnt = no;
addchartbubble(test1_bubbles_daycnt , low*0.996, 
dow + " dow\n" +
newday + " new\n" +
daycnt + " cnt\n" +
dayqty + " qty\n" +
revdaycnt + " rev"
,color.yellow, no);


# -----------------------------------
# -----------------------------------
# -----------------------------------

# test data. 
# replace this with actual signal

# x1 - test data - crossing of 2 avgs
input avg1_len = 10;
input avg1_type =  AverageType.simple;
def ma1 = MovingAverage(avg1_type, close, avg1_len);

input avg2_len = 40;
input avg2_type =  AverageType.simple;
def ma2 = MovingAverage(avg2_type, close, avg2_len);

# use avg crossings as trigger test signal
def xup = if bn == 1 then 0 else if ma1 crosses ma2 then 1 else 0;

input show_test_arrows = yes;
plot up1 = if (show_test_arrows and xup) then low else na;
up1.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
up1.SetDefaultColor(Color.green);
up1.setlineweight(3);
up1.hidebubble();

input show_lines = yes;
plot z1 = if show_lines then ma1 else na;
z1.setdefaultcolor(color.cyan);
plot z2 = if show_lines then ma2 else na;
z2.setdefaultcolor(color.yellow);

# test signal
def x1 = xup;

# -----------------------------------
# -----------------------------------
# -----------------------------------

# calcs
# count the x1 triggers,  up thru yesterday

def x1_total = if bn == 1 then 0
  else if istoday then x1_total[1]
  else if x1 then (x1_total[1] + 1)
  else x1_total[1];

# subtract 1 from qty, don't include today in avg
def x1_dayavg = x1_total / (dayqty - 1);

# count of todays signals
def x1_today = if bn == 1 then 0
  else if istoday and x1 then (x1_today[1] + 1)
  else x1_today[1];

# compare todays count of signals to previous days
def x1_ratio = if !istoday then 0 else round(x1_today/x1_dayavg, 1);

# ---------------------------------------------

input show_x1_labels = yes;
addlabel(show_x1_labels, "prev days, x1 avg: " + x1_dayavg, color.yellow);
addlabel(show_x1_labels, "current day, x1 count: " + x1_today, color.yellow);
addlabel(show_x1_labels, "current/past, x1 ratio: " + x1_ratio, color.yellow);

# ---------------------------------------------

input test2_bubbles_x1_stats = no;
addchartbubble(test2_bubbles_x1_stats, low*0.997,
 bn + "\n" +
 x1 + " x1\n" +
 x1_total + " ttl\n" +
 x1_dayavg + " avg\n" +
 x1_today + " today\n" +
 x1_ratio + " ratio\n" +
 daycnt + " cnt\n" 
, (if istoday then color.yellow else color.gray), no);
#
 
Solution

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

Original Link: https://usethinkscript.com/threads/opening-range-breakout-indicator-for-thinkorswim.16/

I created this "view" of the ORB to get a high-level view of which stocks tend to trend above their ORB more frequently. (Really I just turned off everything but Tgt lines). You can pretty quickly scroll through a bunch of tickers and see which ones trended to Tgt's and how many tgts by the number of lines present.

This got me thinking.. is there a way to create a label that would keep stats on ORB's? <I have an idea of the logic, but not how it'd work. I watch ORB on intraday charts, but would need to keep the stats for each day to compare to all the other days and create "batting averages". Something like:
If ORB high triggered but closed below ORB record as a failed breakout
If price closed above ORB but below Tgt1 record as ORB_held
If price closed between tgt1 and tgt2 record as t1_HIT, > Tgt2 = t2_HIT
Number of days on the chart

Labels:
Failed breakout/Days on chart = %failure...
Orb_held/Days = %orbheld
etc etc for tgts hit


http://tos.mx/HouFMYR
Pretty much what I'm already visually showing, just a way to count it up. How often did it occur? Is that aspect possible?
I am looking for the same, did you figure out based on the reply how to get this, I have not been able to make it work yet.
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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