Intraday Range Using Daily Bars

sbtyme

New member
Does anyone have an indicator showing open, high, low, close from the previous daily candle that will work on an intraday range bar chart? Thanks!
 
Solution
Does anyone have an indicator showing open, high, low, close from the previous daily candle that will work on an intraday range bar chart? Thanks!

This will plot the HLOC os range bars (renko/rangebars).
Use the lookback to determine which day's regular trading hours to use (0=Today; 1 = yesterday; ...).
Optional labels and movable bubbles are included.
Option to showtodayonly to display the lookback HLOC only on today's data.
If future bars duplicate the value of the first HLOC, the lines will start plotting at the last duplicate.

Screenshot 2024-01-19 132811.png
Code:
#Range Bars HLOC
input lookback      = 1;
input showtodayonly = yes;
def ymd    = GetYYYYMMDD();
def count  = if !IsNaN(close) and ymd != ymd[1] then count[1] + 1 else count[1]...
Does anyone have an indicator showing open, high, low, close from the previous daily candle that will work on an intraday range bar chart? Thanks!

This will plot the HLOC os range bars (renko/rangebars).
Use the lookback to determine which day's regular trading hours to use (0=Today; 1 = yesterday; ...).
Optional labels and movable bubbles are included.
Option to showtodayonly to display the lookback HLOC only on today's data.
If future bars duplicate the value of the first HLOC, the lines will start plotting at the last duplicate.

Screenshot 2024-01-19 132811.png
Code:
#Range Bars HLOC
input lookback      = 1;
input showtodayonly = yes;
def ymd    = GetYYYYMMDD();
def count  = if !IsNaN(close) and ymd != ymd[1] then count[1] + 1 else count[1];
def cond  = HighestAll(count) - count ;

## High
def hh         = if IsNaN(close) then hh[1] else
CompoundValue(1, if cond == lookback  and SecondsFromTime(0930)[1] < 0 and SecondsFromTime(0930) >= 0
                 then high
                 else if cond == lookback and SecondsFromTime(1600) < 0 and high > hh[1]
                 then high
                 else hh[1] , high);
def hhbn       = if  cond == lookback and high == hh 
                 then BarNumber()
                 else hhbn[1];
plot hhplot    = if showtodayonly and GetDay() != GetLastDay()
                 then Double.NaN   
                 else if BarNumber() >= HighestAll(hhbn)
                 then hh
                 else Double.NaN;

## Low
def ll         = if IsNaN(close) then ll[1] else
CompoundValue(1, if  cond == lookback and SecondsFromTime(0930)[1] < 0 and SecondsFromTime(0930) >= 0
                 then low
                 else if cond == lookback and SecondsFromTime(1600) < 0 and low < ll[1]
                 then low
                 else ll[1] , low);
def llbn       = if cond == lookback and low == ll
                 then BarNumber()
                 else llbn[1];
plot llplot    = if showtodayonly and GetDay() != GetLastDay()
                 then Double.NaN   
                 else if BarNumber() >= HighestAll(llbn)
                 then ll
                 else Double.NaN;
## Open
def oo         = if IsNaN(close) then oo[1] else
CompoundValue(1, if cond == lookback  and SecondsFromTime(0930)[1] < 0 and SecondsFromTime(0930) >= 0
                 then open
                 else oo[1] , open);
def oobn       = if cond == lookback and SecondsFromTime(1600) < 0 and open == oo
                 then BarNumber()
                 else oobn[1];
plot ooplot    = if showtodayonly and GetDay() != GetLastDay()
                 then Double.NaN   
                 else if cond <= lookback and BarNumber() >= HighestAll(oobn)
                 then oo
                 else Double.NaN;

## Close
def cc         = if IsNaN(close) then cc[1] else
CompoundValue(1, if cond == lookback and SecondsFromTime(0930)[1] < 0 and SecondsFromTime(0930) >= 0
                 then close
                 else if cond == lookback and SecondsFromTime(1600) < 0
                 then close
                 else cc[1] , close);
def ccbn       = if cond == lookback and SecondsFromTime(1600) < 0 and close == cc
                 then BarNumber()
                 else ccbn[1];
plot ccplot    = if showtodayonly and GetDay() != GetLastDay()
                 then Double.NaN   
                 else if cond <= lookback and BarNumber() >= HighestAll(ccbn)
                 then cc
                 else Double.NaN;

hhplot.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
llplot.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
ooplot.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
ccplot.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);


## Labels
input showlabels = 1;
AddLabel(showlabels, "High: " + hh + " Low: " + ll + " Open: " + oo + " Close: " + cc, Color.WHITE);

## Bubbles
input showbubbles = yes;
input bubblemover = 2;
def   mover = showbubbles and IsNaN(close[bubblemover]) and !IsNaN(close[bubblemover + 1]);

AddChartBubble(mover, hhplot, "H-" + lookback + " " + astext(hhplot), hhplot.TakeValueColor());
AddChartBubble(mover, llplot, "L-" + lookback + " " + astext(llplot), llplot.TakeValueColor());
AddChartBubble(mover, ooplot, "O-" + lookback + " " + astext(ooplot), ooplot.TakeValueColor());
AddChartBubble(mover, ccplot, "C-" + lookback + " " + astext(ccplot), ccplot.TakeValueColor());

#
 
Solution

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

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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