Advance/Decline Box

Here’s a Sunday afternoon quickie for my loyal readers. While playing with some of the recently added new toys in thinkScript, I build this quick study that displays the Advance Decline Ratio or Advancing-Declining Issues in a little box at the upper left. You can select if you want the A/D Ratio or A-D Issues in the study properties panel. I set the coloring up such that the box is red if the value has worsened from the previous bar or green if it has improved. As with all indicators which pull the $ADVN and $DECN data, it will not work on TICK charts. Best of luck trading in the new year! – Eric

Advance Decline Box

# TS_AdvanceDeclineBox
# thinkscripter@gmail.com
# Last Update 12 MAY 2010

def A = close("$ADVN");
def D = close ("$DECN");
def ADL = A - D;
def ADR = if A > D then A / D else -D / A;
input mode = {default Ratio, Issues};
def modeSwitch = if mode == mode.Ratio then 1 else 0;

AddChartLabel(yes, concat(
if modeSwitch then ADR else ADL, concat(" ",
if modeSwitch then ":1  A/D RATIO" else " A/D LINE")),
if modeSwitch then if ADR > ADR[1] then color.green else color.red else if ADL > ADL[1] then color.green else color.red);
This entry was posted in Indicator and tagged , , , . Bookmark the permalink.

11 Responses to Advance/Decline Box

  1. Tankobu says:

    Very nice stuff! Can’t wait to use it in real action at the start of the new year 2010!

  2. Adam says:

    That’s weird — I’m not getting email notification of thinkScripter stuff any more.

  3. Adam says:

    Happy New Year Fellow thinkers and ‘Scripters!

    Eric — have you developed a way to draw trend lines? I tinkered with the trig functions in the “manual” example, but they don’t seem to work (for me) … just wondering … I want to automatically plot some of what Augen is talking about (with the lower study you’ve already published in the TSBundle.)

    Also, isn’t there a doc somewhere that explains all the Bundle studies; and how to set up a chart to use them? (I know there’s elaborate instructions for setting up autofibs and the other “beast” studies, but I thought for sure there was a single doc with all that gathered together.)

    • I haven’t really attempted trend lines as of yet…
      No studies document any more. There was at once but the information is the same as the Indicators tab on the blog so I discontinued the document.
      -Eric

  4. RappidFyre says:

    Thanx Eric,

    Always appreciate your efforts.

    Good luck in your trading as well.

    Peace-

  5. DS says:

    Great Stuff – Thanks – tweaked it to “declare on_volume” to get it to show on the volume box – so I can hide when I toggle volume off…..Great Stuff Thanks.

  6. Felix says:

    Thanx Eric,
    Good luck to all in 2010. year!

  7. Jay Vince-Cruz says:

    Eric, how would you limit the ratio to just 2 decimel places

  8. CharlieR says:

    You da man! great stuff. How about one using the $uvol-$dvol???
    Charlie

  9. Tony says:

    Really slick, thank you. What code modification would be
    needed to have a trend count included? Today this indicator turned
    red as it declined from the previous day. Great, I like that. If it
    goes down again tomorrow, and the day after, it would be cool if it
    showed that it had been down 3 days in a row with something like a
    “(3)”. Hard to do?

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>