Market Breadth

This indicator will plot market breadth for the NYSE or NASDAQ in one of four ways:

1) Advancing/Declining Issues Ratio
2) Advancing-Declining Issues Total
3) Advancing/Declining Volume Ratio
4) Advancing-Declining Volume Total

Market Breadth

Market Breadth

# MARKETBREADTH
# http://www.thinkscripter.com
# thinkscripter@gmail.com
# Last Update 21 Jan 2009

declare lower;

input display = {default ADIssuesRatio, ADIssues, ADVolumeRatio, ADVolume};
input market = {default NYSE, NASDAQ};

def advancing = if(market, close("$advn/q"), close("$advn"));
def declining =  if(market, close("$decn/q"), close("$decn"));
def advVolume = if(market, close("$uvol/q"), close("$uvol"));
def decVolume = if(market, close("$dvol/q"), close("$dvol"));

plot Breadth;

switch(display) {
  case ADIssuesRatio:
    Breadth = if(advancing > declining, (advancing / declining), (-declining / advancing));
  case ADIssues:
    Breadth = advancing - declining;
  case ADVolume:
    Breadth = advVolume - decVolume;
case ADVolumeRatio:
    Breadth = if( advVolume > decVolume, (advVolume / decVolume), (-decVolume / advVolume));
}

Breadth.AssignValueColor(if Breadth >= 0.0 then color.green else color.red);
Breadth.SetPaintingStrategy(paintingStrategy.HISTOGRAM);
Breadth.SetLineWeight(3);

plot ZeroLine = 0.0;
ZeroLine.SetDefaultColor(color.white);
This entry was posted in Indicator and tagged , , , , . Bookmark the permalink.

4 Responses to Market Breadth

  1. scottie says:

    Do you know where I can get the code for a mac based system?

  2. patacon says:

    GReat stuff!!
    Thanks for sharing!

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>