I need to add a HighestHigh and LowestLow horizontal line to my TRIN indicator. I added the six lines at bottom of code below but it's not working, Thank you.
Code:
input ShowZeroLine = yes;
input market = {default NYSE, NASDAQ};
#input period = 30; # user-defined period
def UVOL = close("$UVOL");
def DVOL = close("$DVOL");
def UVOLQ = close("$UVOL/Q");
def DVOLQ = close("$DVOL/Q");
#NYSE Breadth ratio
def NYSEratio = if (UVOL >= DVOL) then (UVOL / DVOL) else -(DVOL / UVOL);
AddLabel(yes, Concat(Round(NYSEratio, 2), ":NYSE"), (if NYSEratio >= 0 and NYSEratio < 2 then Color.YELLOW else if NYSEratio >= 2 then Color.GREEN else Color.RED));
#Nasdaq Breadth ratio
def NASDratio = if (UVOLQ >= DVOLQ) then (UVOLQ / DVOLQ) else -(DVOLQ / UVOLQ);
AddLabel(yes, Concat(Round(NASDratio, 2), ":NASD"), (if NASDratio >= 0 and NASDratio < 2 then Color.YELLOW else if NASDratio >= 2 then Color.GREEN else Color.RED));
#ZeroLine
plot zeroline = if ShowZeroLine then 0 else Double.NaN;
zeroline.AssignValueColor(if NYSEratio > 0 then Color.GREEN else Color.RED);
zeroline.SetLineWeight(1);
zeroline.HideTitle();
zeroline.HideBubble();
#Histogram Function
plot Breadth = if market then NASDratio else NYSEratio;
Breadth.AssignValueColor(if Breadth >= 0 then Color.GREEN else Color.RED);
Breadth.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
Breadth.SetLineWeight(1);
#Horizontal lines at highest and lowest levels
plot HixB = HighestAll(Breadth);
HixB.SetDefaultColor(Color.RED);
HixB.SetStyle(Curve.MEDIUM_DASH);
plot LwxB = LowestAll(Breadth);
LwxB.SetDefaultColor(Color.GREEN);
LwxB.SetStyle(Curve.MEDIUM_DASH);
Last edited by a moderator: