Market Breath Labels for ThinkorSwim

J007RMC

Well-known member
2019 Donor
Used these labels today seemed to work fine.

Code:
# Market Breath Ratios
# Paris (based on an earlier idea from ESP)
# 11.02.2015
# One Note Download

def UVOL   = close(“$UVOL”);
def DVOL   = close(“$DVOL”);

def UVOLD  = close(“$UVOLI”);
def DVOLD  = close(“$DVOLI”);

def UVOLS  = close(“$UVOLSP”);
def DVOLS  = close(“$DVOLSP”);

def UVOLN  = close(“$UVOL/Q”);
def DVOLN  = close(“$DVOL/Q”);

def UVOLR  = close(“$UVOLRL”);
def DVOLR  = close(“$DVOLRL”);

def SPYRatio =  if (UVOLS >= DVOLS) then (UVOLS / DVOLS) else -(DVOLS / UVOLS);
AddLabel(yes, "S&P500: " + Concat(Round(SPYRatio, 2), ” :1”), if SPYRatio >= 0 then Color.UPTICK else Color.DOWNTICK);

def DJIRatio =  if (UVOLD >= DVOLD) then (UVOLD / DVOLD) else -(DVOLD / UVOLD);
AddLabel(yes, "DJI: " + Concat(Round(DJIRatio, 2), ” :1”), if DJIRatio >= 0 then Color.UPTICK else Color.DOWNTICK);

def NDXRatio =  if (UVOLN >= DVOLN) then (UVOLN / DVOLN) else -(DVOLN / UVOLN);
AddLabel(yes, "QQQ: " + Concat(Round(NDXRatio, 2), ” :1”), if NDXRatio >= 0 then Color.UPTICK else Color.DOWNTICK);

def RUTRatio =  if (UVOLR >= DVOLR) then (UVOLR / DVOLR) else -(DVOLR / UVOLR);
AddLabel(yes, "R2000: " + Concat(Round(RUTRatio, 2), ” :1”), if RUTRatio >= 0 then Color.UPTICK else Color.DOWNTICK);

def NYSERatio =  if (UVOL >= DVOL) then (UVOL / DVOL) else -(DVOL / UVOL);
AddLabel(yes, "NYSE: " + Concat(Round(NYSERatio, 2), ” :1”), if NYSERatio >= 0 then Color.UPTICK else Color.DOWNTICK);
 
Last edited by a moderator:

J007RMC

Well-known member
2019 Donor
Well Im jusying I may not enter a trade if the advance decline levels are red so I look for the market index strength
 

BenTen

Administrative
Staff member
Staff
VIP
Lifetime
@alexR Please be as specific as possible when reporting an issue. What is not working? Can you post a screenshot of the chart?
 

GabrielNY

New member
Hello! I've been helped by a couple badass code writers so far, and I'm hoping for another handout! I have these Market breadth bubbles( Don't remember where I got em from, but they were free, so public information, not proprietary) And I was hoping for a addendum. They work well to show general state of the markets, but Id like to have an arrow up or arrow down next to each reading that shows whether the reading has moved up/down since the last reading. for example, NYSE reading is negative right now, but went from -1.51 to -1.49. still negative, but moved up. or NASD is in the green positive, but went from +1.8 to +1.7. moved down. Is it possible to have a dynamic arrow that can show the direction of each last move as the day goes by? Thanks again to any and all who care to read this and give it a go!

#BREADTH RATIO SCRIPT
#CODED BY JUSTIN WILLIAMS

input ShowZeroLine = yes;
input market = {default NYSE, NASDAQ};

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), ” :1 NYSE”), (if NYSEratio >= 0 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), ” :1 NASD”), (if NASDratio >= 0 then Color.GREEN else Color.RED));
 
Last edited by a moderator:

boogz101

New member
VIP
Hello! I've been helped by a couple badass code writers so far, and I'm hoping for another handout! I have these Market breadth bubbles( Don't remember where I got em from, but they were free, so public information, not proprietary) And I was hoping for a addendum. They work well to show general state of the markets, but Id like to have an arrow up or arrow down next to each reading that shows whether the reading has moved up/down since the last reading. for example, NYSE reading is negative right now, but went from -1.51 to -1.49. still negative, but moved up. or NASD is in the green positive, but went from +1.8 to +1.7. moved down. Is it possible to have a dynamic arrow that can show the direction of each last move as the day goes by? Thanks again to any and all who care to read this and give it a go!

MerryDay just graciously reminded me that I forgot to add the doggone script...foolish of me...

#BREADTH RATIO SCRIPT
#CODED BY JUSTIN WILLIAMS

input ShowZeroLine = yes;
input market = {default NYSE, NASDAQ};

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), ” :1 NYSE”), (if NYSEratio >= 0 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), ” :1 NASD”), (if NASDratio >= 0 then Color.GREEN else Color.RED));

Here is my attempt at it! The label appears if the current value is either greater or lesser than the previous value. Otherwise, it does not show up.
#BREADTH RATIO SCRIPT
#CODED BY JUSTIN WILLIAMS

input ShowZeroLine = yes;
input market = {default NYSE, NASDAQ};

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), ” :1 NYSE”), (if NYSEratio >= 0 then Color.GREEN else Color.RED));
AddLabel(yes, if NYSEratio > NYSEratio[1] then "Up" else if NYSEratio < NYSEratio[1] then "Dn" else "", if NYSEratio > NYSEratio[1] then color.light_green else if NYSEratio < NYSEratio[1] then color.light_red else color.gray);

#Nasdaq Breadth ratio
def NASDratio = if (UVOLQ >= DVOLQ) then (UVOLQ / DVOLQ) else -(DVOLQ / UVOLQ) ;
AddLabel(yes, Concat(Round(NASDratio, 2), ” :1 NASD”), (if NASDratio >= 0 then Color.GREEN else Color.RED));
AddLabel(yes, if NASDratio > NASDratio[1] then "Up" else if NASDratio < NASDratio[1] then "Dn" else "", if NASDratio > NASDratio[1] then color.light_green else if NASDratio < NASDratio[1] then color.light_red else color.gray);
 

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.
Top