Looking for Market Internals Labels for ThinkorSwim

D

drakoniano

New member
Hi how are you guys? I need some help with some labels code indicator because im not a programmer and really don't know much about it. It is possible to program this to trade NQ FUTURE with a green or red alert.


1) VOL ($VOLNDD/$TVOLND)
2)A-D ($ADNDD/100)
3) TICK ($TIKND/100)

Thanks!!
 
markos

markos

Well-known member
VIP
Warehouse
Hi how are you guys? I need some help with some labels code indicator because im not a programmer and really don't know much about it. It is possible to program this to trade NQ FUTURE with a green or red alert.
1) VOL ($VOLNDD/$TVOLND)
2)A-D ($ADNDD/100)
3) TICK ($TIKND/100)
Thanks!!
Hi and welcome to useThinkScript. You have at least two questions here. Give me a few minutes, I should come up with something.
 
markos

markos

Well-known member
VIP
Warehouse
Here is a label, you will have to change it to what you are looking for.
Code:
# Put-Call SP500 Label
# Markos
# useThinkscript Request 7-2019
# http://tos.mx/zGXVIH
 
input SYMB = "$PCSP";
def Data = close(symbol = "$PCSP", period = AggregationPeriod.DAY);
addLabel(1, "SP500 PCRatio = " + Data, if Data < 0
then color.red
else color.green);
# End Code
 
markos

markos

Well-known member
VIP
Warehouse
Here is a PE Ratio Label
Code:
# PE Ratio Label
# Dilbert
# 10.28.2017

def AE = if IsNaN(GetActualEarnings()) then 0 else GetActualEarnings();

plot EPS_TTM = Sum(AE, 292);

def pe = close / EPS_TTM;

AddLabel(yes, "P/E: " + pe, color.MAGENTA);
Here is A/D of SP500 Label
Code:
# AD Label
# Mobius
# Chat Room Request 04.26.2016

input SYMB = "$ADSPD";

def Data = close(symbol = "$ADSPD", period = AggregationPeriod.WEEK);
addLabel(1, "AD = " + Data, if Data < 0
then color.red
else color.green);
# End Code
 
D

drakoniano

New member
Hi how are you? Thanks for your time, gracias por tu tiempo.

What do you mean with PE ratio? I know what you mean but I think thisis the wrong post
Thanks again
 
markos

markos

Well-known member
VIP
Warehouse
Hi how are you? Thanks for your time, gracias por tu tiempo.
What do you mean with PE ratio? I know what you mean but I think this is the wrong post
Thanks again
@drakoniano I added that for good measure. It can be used as a template for other things. Please review the manuals attached. No hay de que!
 
Last edited:
D

drakoniano

New member
Ok gracias Markos , no habia entendido los indicadores pense que eran para otro post puesto que esos no es lo que necesito por el momento
Gracias por tu apoyo
 
markos

markos

Well-known member
VIP
Warehouse
@drakoniano take a look at this:

Use what you need from there and use a template above to create the label you would like.
 
markos

markos

Well-known member
VIP
Warehouse
Hi how are you guys? I need some help with some labels code indicator because im not a programmer and really don't know much about it. It is possible to program this to trade NQ FUTURE with a green or red alert.
1) VOL ($VOLNDD/$TVOLND)
2)A-D ($ADNDD/100)
3) TICK ($TIKND/100)
Thanks!!
TOS cannot be programmed to auto-trade. Lo siento mucho. Sorry.
 
D

drakoniano

New member
Hi Thanks for your answer, is not auto trade is just the internal to indicate the possibility of a big pullback to reverse that permit me to close my position. You know what i mean?
 
markos

markos

Well-known member
VIP
Warehouse
@drakoniano Take a look at this and the information I have above. Everything you need should be here.

Code:
# https://www.reddit.com/r/thewallstreet/comments/7wiyvf/a_beginners_guide_to_market_internals/
Advance/Decline Difference and Ratio - $ADDC (NYSE), $ADSPDC (S&P) or $ADQDC (NQ)

This internal shows you the total number of advancing vs declining stocks in the NYSE or Nasdaq Composite. If 1800 stocks are positive for the day and 500 are down, you'll get a reading of 1300. Since there are a limited number of stocks in the composites, this metric has a cap.

The $ADDC and the ratio of advancing ($ADVN) to declining ($DECN) issues give us market breadth. If the Nasdaq is up today, how many stocks are pushing it up? Is it a broad-based rally or is a green day the result of only a small portion of the market. Naturally, you will likely find choppier days closer to 0. Rallies and steep drops will begin to pull more and more stocks up/down as the day wears on. This is the most basic indicator here and forms the basis for the subject at hand.

A reading of +800 or so means stocks are advancing roughly 2 to 1, which can be a good signal. The inverse is true for bearish conditions, but anything too close to 0 is no signal at all.

Since these two have charts, it is useful to see how things change over time. Because we cannot get a chart of the a/d ratio it is more useful as a number. Thus, the following script:

Advance/Decline Ratio Thinkscript

Here's a little gift. I only later realized Thinkorswim's advance/decline is a study, but we can get a simple number output with this that fits on any chart as a green/red label for bullish/bearish conditions and use it for any of the major indexes. For the mathematically challenged, 1.3 basically means 30% more stocks are advancing today vs declining in that index, while a reading as low as 0.3 means only 30% of stocks are advancing. I used composites as they include the data from all exchanges. Rip off the C in the code for these symbols if you for some reason want only the main source (if so tell me why!).

REMOVE THE (#) SIGN IN FRONT OF THE LINE YOU WANT TO USE.

#Use this if you want to see the ratio as a study beneath your chart, then copy the others you need.

#declare lower;

#Switch any below def to plot to see the NYSE Composite advance decline ratio as a chart.    Def will give us the label

#def adratio = close("$ADVNC") / close("$DECNC");

#Addlabel(yes, adratio + " Adv/Dec", if adratio >= 1 then color.green else color.red);

#Uncomment the below to show Nasdaq Composite Advance Decline

#def adrationasdaq = close("$ADVNC/Q") / close("$DECNC/Q");

#Addlabel(yes, adrationasdaq + " Adv/Dec NQ", if adrationasdaq >= 1 then color.green else color.red);

#Uncomment below to show S&P 500 Composite Advance Decline

#def adratiosp = close("$ADVSPC") / close("$DECLSPC");

#Addlabel(yes, adratiosp + " Adv/Dec S&P", if adratiosp >= 1 then color.green else color.red);

#All 3 can be used together if you like, and will show separate labels. You can also find the advance decline info for the Russell and Dow, just swap the symbols in or copy one of the script blocks.

As for using this, I want to know how broad a rally is. Is this thing really going to break out, or am I about to get whipsawed by a shitty market that's almost 50/50? It's no good on its own but in combination with the next one can be a pretty damned big clue as to whether we will have a trending day.

Volume Difference and Totals - $VOLDC $VOLSPDC and $VOLNDDC

These two show the total difference in volume going into stocks advancing vs those declining. Unlike the Advance Declinne Ratio it is immensely useful to view as a chart itself because on a really bloody day, or a strong rally, the numbers will grow relatively from one day to another. It is useful to know what type of volume has been seen in the market recently.

$UVOL and $DVOL show the amounts separately - throw a /Q or SP on the end to get this for the nasdaq or S&P by themselves. It is important to note that these are a cumulative total, but it can go down. This is because a stock in the down volume category can move to the up volume category when it goes green for the day. Its cumulative volume is subtracted from the dvol category and added to the uvol category as a result of its improved status.

You choose which of these is right for you - either the pairing of UVOL and DVOL or the simple difference by itself. If you use the difference, you can plot a 0 line in your trading software to easily see when it is positive vs negative. Numbers can range into the billions here so it's useful to do this. Here's how in thinkorswim. Make a simple study and name it zeroline and you can use it in anything like this:

plot zeroline = 0;
Good Luck and Good Trading
 

Top