#### vince s

##### New member
can someone help me make a script that plots the high and low of the first 15 min candle with a 50% line and cloud that extends from open to next days close??

Solution
can someone help me make a script that plots the high and low of the first 15 min candle with a 50% line and cloud that extends from open to next days close??

Since you wanted to extend to the next day close, this required more logic than normal ORB.

Code:
``````input Lookback = 2;
input agg = AggregationPeriod.FIFTEEN_MIN;
input StartTime = 0930;
input EndTime   = 0945;

def startCounter5 = SecondsFromTime(StartTime);
def endCounter5 = SecondsTillTime(EndTime);
def range = if SecondsFromTime(StartTime) >= 0 and SecondsTillTime(EndTime) > 0 then 1 else 0;
def hper = high(period = agg);
def lper = low(period = agg);

def hrange = if range and !range[1]
then hper
else if...``````
can someone help me make a script that plots the high and low of the first 15 min candle with a 50% line and cloud that extends from open to next days close??

Since you wanted to extend to the next day close, this required more logic than normal ORB.

Code:
``````input Lookback = 2;
input agg = AggregationPeriod.FIFTEEN_MIN;
input StartTime = 0930;
input EndTime   = 0945;

def startCounter5 = SecondsFromTime(StartTime);
def endCounter5 = SecondsTillTime(EndTime);
def range = if SecondsFromTime(StartTime) >= 0 and SecondsTillTime(EndTime) > 0 then 1 else 0;
def hper = high(period = agg);
def lper = low(period = agg);

def hrange = if range and !range[1]
then hper
else if range
then if hper > hrange[1]
then hper
else hrange[1]
else hrange[1];

def lrange = if range and !range[1]
then lper
else if range
then if lper < lrange[1]
then lper
else lrange[1]
else lrange[1];

def ct  = if hrange[1] != hrange and lrange[1] != lrange then ct[1] + 1 else ct[1];
def cct = HighestAll(ct) - ct + 1;

def xH = if cct == Lookback then hrange else if cct <= Lookback - 1 and SecondsFromTime(1600) < 0 then xH[1] else Double.NaN;
plot H = if cct > Lookback + 1 then Double.NaN else xH;
H.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);

def xL = if cct == Lookback then lrange else if cct <= Lookback - 1 and SecondsFromTime(1600) < 0 then xL[1] else Double.NaN;
plot L = xL;
L.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);

plot M = (H + L) / 2;
M.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);

input cloud = yes;

Last edited:

87k+ Posts
217 Online

## The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
• Exclusive indicators
• Proven strategies & setups
• Private Discord community
• Exclusive members-only content
• 1 full year of unlimited support

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?