HighestHigh & LowestLow lines for TRIN indicator

OCTrader

New member
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:
Solution
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 /...
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);
Trin is a lower pane indicator. Try adding at the top of your code: declare lower;
 
Solution

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