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

rlohmeyer

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



 

Similar threads

Top