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
# 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);






Very nice stuff! Can’t wait to use it in real action at the start of the new year 2010!
That’s weird — I’m not getting email notification of thinkScripter stuff any more.
Adam,
The emails only go out once a day around 11:00 pm I believe.
Eric
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
Thanx Eric,
Always appreciate your efforts.
Good luck in your trading as well.
Peace-
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.
Thanx Eric,
Good luck to all in 2010. year!
Eric, how would you limit the ratio to just 2 decimel places
You da man! great stuff. How about one using the $uvol-$dvol???
Charlie
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?