this would have been alot easier to understand if you would have said,
i'd like horizontal lines , based on the candles identified by the
TD movingavgcrossover study.
showing a chart picture with unrelated lines on it, made it even more confusing.
i stared at the image and read the study names and the symbol, and guessed that you wanted lines drawn from the high and low, of candles identified by arrows from that crossover study.
your chart image shows
negg 10y month
movingavgcrossover( 4,8, ema, ema, below)
and a 2nd study with ( .... , above)
i copied the TD study and added code to draw lines and changed how it draws arrows ( so 1 study will draw both up and down arrows)
can choose to
...turn off the 2 average lines
...turn off up arrows or down arrows, and their horizontal lines
Ruby:
# movingavgcrossover02
# add horz lines from candle with up arrow and down arrow
# change arrow code , to show both up and down with 1 study
# movingavgcrossover
# TD Ameritrade IP Company, Inc. (c) 2009-2021
input price = close;
input length1 = 4;
input length2 = 8;
input averageType1 = AverageType.exponential;
input averageType2 = AverageType.exponential;
#input crossingType = {default above, below};
input show_cross_up_lines = yes;
input show_cross_down_lines = yes;
input show_average_lines = yes;
def avg1 = MovingAverage(averageType1, price, length1);
def avg2 = MovingAverage(averageType2, price, length2);
def na = double.nan;
plot line1 = if show_average_lines then avg1 else na;
plot line2 = if show_average_lines then avg2 else na;
line1.setdefaultcolor(color.yellow);
line2.setdefaultcolor(color.cyan);
def crossup = avg1 crosses above avg2;
def crossdwn = avg1 crosses below avg2;
#plot signal = crosses(avg1, avg2, crossingType == CrossingType.above);
#signal.DefineColor("Above", color.green);
#signal.DefineColor("Below", color.magenta);
#signal.AssignValueColor(if crossingType == CrossingType.above then signal.color("Above") else signal.color("Below"));
#signal.SetPaintingStrategy(if crossingType == CrossingType.above
# then PaintingStrategy.BOOLEAN_ARROW_UP
# else PaintingStrategy.BOOLEAN_ARROW_DOWN);
plot xup = if show_cross_up_lines then crossup else na;
plot xdwn = if show_cross_down_lines then crossdwn else na;
xup.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
xdwn.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_down);
xup.setdefaultColor(color.green);
xdwn.setdefaultColor(color.magenta);
xup.setlineweight(3);
xdwn.setlineweight(3);
# add horz lines from candle with up arrow and down arrow
def uphi = if (show_cross_up_lines and (avg1 crosses above avg2)) then high else uphi[1];
def uplo = if (show_cross_up_lines and (avg1 crosses above avg2)) then low else uplo[1];
def dwnhi = if (show_cross_down_lines and (avg1 crosses below avg2)) then high else dwnhi[1];
def dwnlo = if (show_cross_down_lines and (avg1 crosses below avg2)) then low else dwnlo[1];
plot uph = uphi;
plot upl = uplo;
plot dwnh = dwnhi;
plot dwnl = dwnlo;
uph.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
upl.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
dwnh.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
dwnl.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
uph.setdefaultColor(color.green);
upl.setdefaultColor(color.blue);
dwnh.setdefaultColor(color.magenta);
dwnl.setdefaultColor(color.red);
#