# Extend Daily S/R Lines a defined number of days

#### javin82

##### New member
I am trying to connect two points with a solid line and would like to extend the line past the second point. (extended to the right)

I am using the enableApproximation function and don't know if that is the best option. What am I doing wrong?

def high = high;
plot highs = if high > high[1] then high else double.nan;
highs.setstyle(curve.firm);
highs.enableapproximation();

I have spent considerable time looking for code to allow this or that I could gobble together but came up empty, so I am posting this for some help. The following code shows 4 specific lines on a chart that consistently "draw" price on the intraday time frames. The Regular Session Daily Open, the previous day's Close, High, and Low. The image shows these and illustrates how useful they can be on followup days. The image illustrates that a High on Day 1 in the Image caught the low of both Day 3 and 4 and reversed the stock, both for a nice trade.

I would like to modify the code to allow for EXTENDING the Close, High, and Low lines for a defined number of days forward (with an input parameter), say 5 days or whatever. Can anyone assist me? Much appreciated for any suggestions.

Bob
Code:
``````#Daily_Lines
input AP = AggregationPeriod.DAY;

def open = open(period = AP);
def high = high(period = AP);
def low = low(period = AP);

plot DOp = open(period = AP);
DOp.SetDefaultColor(Color.YELLOW);
DOp.SetPaintingStrategy(PaintingStrategy.Dashes);
DOp.HideTitle();
DOp.HideBubble();

plot yCl = close(period = AP)[1];
yCl.SetPaintingStrategy(PaintingStrategy.Dashes);
yCl.SetDefaultColor(Color.DARK_ORANGE);
yCl.HideTitle();
yCl.HideBubble();

plot yHi = high(period = AP)[1];
yHi.SetDefaultColor(Color.GREEN);
yHi.SetPaintingStrategy(PaintingStrategy.Dashes);
yHi.HideTitle();
YHi.HideBubble();

plot yLo = low(period = AP)[1];
yLo.SetDefaultColor(Color.RED);
yLo.SetPaintingStrategy(PaintingStrategy.Dashes);
yLo.HideTitle();
YLo.HideBubble();``````

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