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();



gmIQI0z.png
 

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
327 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