Market Internals Labels for ThinkorSwim

markos

Well-known member
VIP
Market Internals Labels for ThinkorSwim

Code:
# Put-Call SP500 Label
# Markos
# useThinkscript Request 7-2019
# https://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

5PRpfWvm.jpg


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
 

Attachments

  • 5PRpfWvm.jpg
    5PRpfWvm.jpg
    6.7 KB · Views: 433
Last edited by a moderator:
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
 
Last edited by a moderator:
here are labels for VOLUME RATIOS and A/D on the NYSE, NASDAQ, and SP I hobbled together from a few sources

knzpbG6.jpg


Code:
input market = {default NYSE, NASDAQ, SP};

def UVOL = close("$UVOL");
def DVOL = close("$DVOL");
def UVOLQ = close("$UVOL/Q");
def DVOLQ = close("$DVOL/Q");
def UVOLSP = close("$UVOLSP");
def DVOLSP = close("$DVOLSP");
def Data = close("$ADSPD");

#NYSE Breadth ratio
def NYSEratio =  if (UVOL >= DVOL) then (UVOL / DVOL) else -(DVOL / UVOL);
AddLabel(yes, Concat(Round(NYSEratio, 2), " :1 NYSE VOL"), (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 VOL"), (if NASDratio >= 0 then Color.GREEN else Color.RED));

#SP Breadth ratio
def SPratio =  if (UVOLSP >= DVOLSP) then (UVOLSP / DVOLSP) else -(DVOLSP / UVOLSP) ;
AddLabel(yes, Concat(Round(SPratio, 2), " :1 SP VOL"), (if SPratio >= 0 then Color.GREEN else Color.RED));

# AD Numbers
input SYMB = "$ADD";#Hint SYMB:$ADD for NYSE Adv-Decline Issues
input SYMB2 = "$ADQD";#Hint SYMB2:$ADQD for Nasdaq Adv-Decline Issues
def AD = close(symbol = SYMB);
AddLabel(1, "A/D NYSE: " +  AD, (if AD >= 0 then Color.GREEN else Color.RED));
def AD2 = close(symbol = SYMB2);
AddLabel(1, "A/D NASDAQ: " +  AD2, (if AD2 >= 0 then Color.GREEN else Color.RED));
AddLabel(1, "A/D SP: " + Data, if Data < 0 then color.RED else color.GREEN);
 
Last edited by a moderator:
@bobomatic thanks for the post. Please do all a favor and keep the original author and date at the top of any posting. If you've made changes, that's great. Put your name and date below if you are not the original poster. It's quite ok to make changes to others scripts, just be sure to give them credit. Thanks & welcome.
 
Haven't been around much lately. I'll be scarce for an extended period but will check in as I can. I meant to add the image below a while back but I just came across it. Please note that there is a share at the top of the picture. This is courtesy of BOC, who hangs out in several chat rooms at TOS.... btw, if you don't know what something is, try it and see what it does... I put a call in to TOS Omaha Operations and they couldn't help. There are over 200 TOS Index Indicators here, it is believed that they originated with "shadowtrader", whom ever that may be...

List of Market Internal Tickers

LBm3nWb.png
 
Another symbol I'm using, for quite some time already, is $SPXA200R. I find it really helpful to determine the direction of the market
@Art ! You're a genius! Advanced support told me there was no way to do it. Thank you.
 
Last edited:
I am asking for some help. I am trying to add a label for price net change by symbol. Is it doable? Thank you. Please disregard, I have found the code.

I have been trying to figure out a chart label to show the net price change for $DJI. I managed to get a label to show the current price, but since I'm not a code writer, I have been unsuccessful piecing together one for net change. Below is the study for price I pieced together. Could someone point me in the right direction? Thank you.

Code:
input TICKER_1 = "$DJI";
input PRICE_TYPE = close;

def PRICE_1 = Close(ticker_1);

AddLabel(yes, "Price: " + Price_1, Color.LIGHT_GRAY);
 
Last edited:
@Rojo Grande, here's a label I found somewhere, can't remember where. I modified it to also show the net change of a chosen symbol. When checking it against /ES and $DJI, it appeared to work fine - run/test it and let me know if it works. :)

Code:
#DailyandNetChangeLabels
#Original author unknown
#Pensar - 06/17/2020 - Added net change label, user inputs for symbol and label selection

input symbol = "$DJI";
input Chg_From_Open_Label = yes;
input Net_Chg_Label = yes;

def begin = open(symbol, AggregationPeriod.DAY);
def end = close(symbol, AggregationPeriod.DAY);
def DayChg = end - begin;
def PctDayChg = (end / begin) - 1;

def c = close(symbol, AggregationPeriod.DAY);
def NetChg = c - c[1];
def PctNetChg = (c / c[1]) - 1;

AddLabel(Chg_From_Open_Label, "Chg from Open: " + (DayChg) + " points, " + AsPercent(PctDayChg), if DayChg > 0 then Color.GREEN else if DayChg < 0 then color.RED else color.LIGHT_GRAY);

AddLabel(Net_Chg_Label, "Net Chg: " + (NetChg) + " points, " + AsPercent(PctNetChg), if NetChg > 0 then Color.GREEN else if NetChg < 0 then color.RED else color.LIGHT_GRAY);

#end code
 
Hello,

Looking for some help with a basic script. I would like to have the major indexing current pricing on my charts. I have looked for examples but havent been able to get it to work.

Any examples available to help me get started.
 

NYSE Breadth Indices

SymbolDescriptionMarket Data Package Required
$ADDNYSE Advancing Issues – Declining Issues DifferenceNYSE
$VOLDNYSE Up Volume – Down Volume DifferenceNYSE
$VOLDCNYSE Up Volume – Down Volume Difference (Composite)NYSE



AMEX Breadth Indices

SymbolDescriptionMarket Data Package Required
$ADADAMEX Advancing Issues – Declining Issues DifferenceAMEX
$VOLAD AMEX Up Volume – Down Volume DifferenceAMEX
$VOLADCAMEX Up Volume – Down Volume Difference (Composite)AMEX



NASDAQ Breadth Indices

SymbolDescriptionMarket Data Package Required
$ADQDNASDAQ Advancing Issues – Declining Issues DifferenceNASDAQ
$VOLQDNASDAQ Up Volume – Down Volume DifferenceNASDAQ



Dow 30 Breadth Indices

SymbolDescriptionMarket Data Package Required
$ADVIDow Jones Industrials Advancing IssuesNASDAQ and NYSE
$DECLIDow Jones Industrials Declining IssuesNASDAQ and NYSE
$UNCHIDow Jones Industrials Unchanged IssuesNASDAQ and NYSE
$ADIDDow Jones Industrials Advancing Issues – Declining Issues DifferenceNASDAQ and NYSE
$UVOLIDow Jones Industrials Up VolumeNASDAQ and NYSE
$UVOLICDow Jones Industrials Up Volume (Composite)NASDAQ and NYSE
$DVOLIDow Jones Industrials Down VolumeNASDAQ and NYSE
$DVOLICDow Jones Industrials Down Volume (Composite)NASDAQ and NYSE
$TVOLIDow Jones Industrials Total VolumeNASDAQ and NYSE
$TVOLICDow Jones Industrials Total Volume (Composite)NASDAQ and NYSE
$VOLIDDow Jones Industrials Up Volume – Down Volume DifferenceNASDAQ and NYSE
$VOLIDCDow Jones Industrials Up Volume – Down Volume Difference (Composite)NASDAQ and NYSE
$TRINIDow Jones Industrials Short Term Trade IndexNASDAQ and NYSE
$TRINICDow Jones Industrials Short Term Trade Index (Composite)NASDAQ and NYSE



NASDAQ 100 Breadth Indices

SymbolDescriptionMarket Data Package Required
$ADVNDNASDAQ 100 Advancing IssuesNASDAQ
$DECLNDNASDAQ 100 Declining IssuesNASDAQ
$UNCHNDNASDAQ 100 Unchanged IssuesNASDAQ
$ADNDDNASDAQ 100 Advancing Issues – Declining Issues DifferenceNASDAQ
$UVOLNDNASDAQ 100 Up VolumeNASDAQ
$DVOLNDNASDAQ 100 Down VolumeNASDAQ
$TVOLNDNASDAQ 100 Total VolumeNASDAQ
$VOLNDDNASDAQ 100 Up Volume – Down Volume DifferenceNASDAQ
$TIKNDNASDAQ 100 Cumulative Tick IndexNASDAQ
$TRINNDNASDAQ 100 Short Term Trade IndexNASDAQ



S&P 500 Breadth Indices

SymbolDescriptionMarket Data Package Required
$ADVSPS&P 500 Advancing IssuesAMEX, NASDAQ and NYSE
$DECLSPS&P 500 Declining IssuesAMEX, NASDAQ and NYSE
$UNCHSPS&P 500 Unchanged IssuesAMEX, NASDAQ and NYSE
$ADSPDS&P 500 Advancing Issues – Declining Issues DifferenceAMEX, NASDAQ and NYSE
$UVOLSPS&P 500 Up VolumeAMEX, NASDAQ and NYSE
$UVOLSPCS&P 500 Up Volume (Composite)AMEX, NASDAQ and NYSE
$DVOLSPS&P 500 Down VolumeAMEX, NASDAQ and NYSE
$DVOLSPCS&P 500 Down Volume (Composite)AMEX, NASDAQ and NYSE
$TVOLSPS&P 500 Total VolumeAMEX, NASDAQ and NYSE
$TVOLSPCS&P 500 Total Volume (Composite)AMEX, NASDAQ and NYSE
$VOLSPDS&P 500 Up Volume – Down Volume DifferenceAMEX, NASDAQ and NYSE
$VOLSPDCS&P 500 Up Volume – Down Volume Difference (Composite)AMEX, NASDAQ and NYSE
$TIKSPS&P 500 Cumulative Tick IndexAMEX, NASDAQ and NYSE
$TIKSPCS&P 500 Cumulative Tick Index (Composite)AMEX, NASDAQ and NYSE
$TRINSPS&P 500 Short Term Trade IndexAMEX, NASDAQ and NYSE
$TRINSPCS&P 500 Short Term Trade Index (Composite)AMEX, NASDAQ and NYSE



Russell 2000 Breadth Indices

SymbolDescriptionMarket Data Package Required
$ADVRLRussell 2000 Advancing IssuesAMEX, NASDAQ and NYSE
$DECLRLRussell 2000 Declining IssuesAMEX, NASDAQ and NYSE
$UNCHRLRussell 2000 Unchanged IssuesAMEX, NASDAQ and NYSE
$ADRLDRussell 2000 Advancing Issues – Declining Issues DifferenceAMEX, NASDAQ and NYSE
$UVOLRLRussell 2000 Up VolumeAMEX, NASDAQ and NYSE
$UVOLRLCRussell 2000 Up Volume (Composite)AMEX, NASDAQ and NYSE
$DVOLRLRussell 2000 Down VolumeAMEX, NASDAQ and NYSE
$DVOLRLCRussell 2000 Down Volume (Composite)AMEX, NASDAQ and NYSE
$TVOLRLRussell 2000 Total VolumeAMEX, NASDAQ and NYSE
$TVOLRLCRussell 2000 Total Volume (Composite)AMEX, NASDAQ and NYSE
$VOLRLDRussell 2000 Up Volume – Down Volume DifferenceAMEX, NASDAQ and NYSE
$VOLRLDCRussell 2000 Up Volume – Down Volume Difference (Composite)AMEX, NASDAQ and NYSE
$TIKRLRussell 2000 Cumulative Tick IndexAMEX, NASDAQ and NYSE
$TIKRLCRussell 2000 Cumulative Tick Index (Composite)AMEX, NASDAQ and NYSE
$TRINRLRussell 2000 Short Term Trade IndexAMEX, NASDAQ and NYSE
$TRINRLCRussell 2000 Short Term Trade Index (Composite)AMEX, NASDAQ and NYSE



Breadth Indices Utilizing all US Stocks

SymbolDescriptionMarket Data Package Required
$ADVUSAll US Advancing IssuesAMEX, NASDAQ and NYSE
$DECLUSAll US Declining IssuesAMEX, NASDAQ and NYSE
$UNCHUSAll US Unchanged IssuesAMEX, NASDAQ and NYSE
$ADUSDAll US Advancing Issues – Declining Issues DifferenceAMEX, NASDAQ and NYSE
$UVOLUSAll US Up VolumeAMEX, NASDAQ and NYSE
$UVOLUSCAll US Up Volume (Composite)AMEX, NASDAQ and NYSE
$DVOLUSAll US Down VolumeAMEX, NASDAQ and NYSE
$DVOLUSCAll US Down Volume (Composite)AMEX, NASDAQ and NYSE
$TVOLUSAll US Total VolumeAMEX, NASDAQ and NYSE
$TVOLUSCAll US Total Volume (Composite)AMEX, NASDAQ and NYSE
$VOLUSDAll US Up Volume – Down Volume DifferenceAMEX, NASDAQ and NYSE
$VOLUSDCAll US Up Volume – Down Volume Difference (Composite)AMEX, NASDAQ and NYSE
$TIKUSAll US Cumulative Tick IndexAMEX, NASDAQ and NYSE
$TIKUSCAll US Cumulative Tick Index (Composite)AMEX, NASDAQ and NYSE
$TRINUSAll US Short Term Trade IndexAMEX, NASDAQ and NYSE
$TRINUSCAll US Short Term Trade Index (Composite)AMEX, NASDAQ and NYSE
 
Great job guys, I really like this idea for labels. Here is a modified version I put together for SP500. Maybe it will be useful for some of the other futures traders.

Code:
#Original labels code from Markos and Bobomatic https://usethinkscript.com/threads/market-internals-labels-for-thinkorswim.833/

# Modified by MTG 10/2023 to include $TRIN, $Put/Call ratio, Vix for Futures, Percent of SP500 stocks trading above their (50, 100, and 200)day averages, and $TICK for SP500 - 10/2023

##############################################################

# Weighted A/D
# concept from shadowtrader.net
# coded by TWOO
# https://www.spglobal.com/spdji/en/indices/equity/sp-500/#data
# sector-breakdown
# modified by CWPARKER23
# modifiedTrueRange by Sam4COK @ 07/2022
# modified by MTG to show full sector name and include Overall ratio sum 9/2023

###############################################################

input market = {default NYSE, NASDAQ, SP};
input open_time = 930;
input length = 12;
input ShowLabel = yes;
def price1 = close(symbol = "/vx", period = AggregationPeriod.DAY);
input length1 = 45; #SMA length for VIX of futures
input displace1 = 0;

def SMA1 = Average(price1[-displace1], length1);
# Market Internal Labels
input SYMB = "$ADSPDc"; #Hint SYMB:$ADSPD for SP500 Adv-Decline Issues - composites include the data from all exchanges
input SYMB2 = "$TIKSPc"; #Hint SYMB2:$tIKSP for SP500 Tick
input Symb3 = "$TRINSPc"; #Hint symb: $TrinSp for SP500 Trin
input Symb4 = "$PCSP"; #Hint symb: $PCSP Put/Call Ratio SP500
input Symb5 = "$ADVSPC"; #Hint symb: $ADVSPC Advance Issues Composite SP500 Trin
input Symb6 = "$DECLSPC"; #Hint symb: $DECLSPC Decline Issues SP500
input symb7 = "/vx"; #Hint symb: /vx is volatility index
input symb8 = "$SPXA50R"; #Hint this is the percent of SP500 Stocks trading above their 50 day average
input symb9 = "$SPXA100R"; #Hint this is the percent of SP500 Stocks trading above their 100 day average
input symb10 = "$SPXA200R"; #Hint this is the percent of SP500 Stocks trading above their 200 day average
input InformationTechnology = 26.8; # xlkwt
input HealthCare = 15.1; # xlvwt
input Financials = 10.8; # xlfwt
input ConsumerDiscretionary = 10.5; # xlywt
input Communications = 8.9; # xlcwt
input Industrials = 7.8; # xliwt
input ConsumerStaples = 7.0; # xlpwt
input Energy = 4.4; # xlewt
input Utilities = 3.1; # xluwt
input RealEstate = 2.9; # xlrewt
input Materials = 2.6; # xlbwt

def na = Double.NaN ;
def SectorCount = 11;
def Scale = 5000;
def displace = 0;

#### COLORS
DefineGlobalColor("Bullish", Color.CYAN);
DefineGlobalColor("Bearish", Color.PINK);
DefineGlobalColor("Channel", CreateColor(100, 181, 246));

#SP500 ETF sectors percent change
script PC {
    input Symbol = "SPX";
    def isFirstBar = GetTime() == RegularTradingStart(GetYYYYMMDD()) + 1;
    def O = if isFirstBar then close(Symbol) else O[1];
    def C = close(Symbol);
    plot PctChg = (C - O) / O;
}
def xlkPctChg = PC("XLK");
def xlyPctChg = PC("XLY");
def xlvPctChg = PC("XLV");
def xlfPctChg = PC("XLF");
def xlcPctChg = PC("XLC");
def xliPctChg = PC("XLI");
def xlpPctChg = PC("XLP");
def xlrePctChg = PC("XLRE");
def xlePctChg = PC("XLE");
def xlbPctChg = PC("XLB");
def xluPctChg = PC("XLU");

def xlkSizing = xlkPctChg * InformationTechnology;
def xlvSizing = xlvPctChg * HealthCare;
def xlySizing = xlyPctChg * ConsumerDiscretionary;
def xlfSizing = xlfPctChg * Financials;
def xlcSizing = xlcPctChg * Communications;
def xliSizing = xliPctChg * Industrials;
def xlpSizing = xlpPctChg * ConsumerStaples;
def xleSizing = xlePctChg * Energy;
def xlreSizing = xlrePctChg * RealEstate;
def xlbSizing = xlbPctChg * Materials;
def xluSizing = xluPctChg * Utilities;

def combinedSizing = Scale * (
xlkSizing +
xlvSizing +
xlySizing +
xlfSizing +
xlcSizing +
xliSizing +
xlpSizing +
xleSizing +
xlreSizing +
xlbSizing +
xluSizing
) / SectorCount;

# Weighted_AD
def Weighted_AD = if !IsNaN(combinedSizing) then combinedSizing else na;

# SPX Non_Weighted_AD
def spxcombinedSizing = Scale *
(xlkPctChg +
xlvPctChg +
xlyPctChg +
xlfPctChg +
xlcPctChg +
xliPctChg +
xlpPctChg +
xlePctChg +
xlrePctChg +
xlbPctChg +
xluPctChg);

#SP500 ETF sectors BUBBLE
script pct {
    input Symbol = "SPX";
    def aggregationPeriod = AggregationPeriod.DAY;
    def price = open(Symbol, period = aggregationPeriod);
    def diff = close (Symbol) - open(Symbol, period = aggregationPeriod);
    plot d_pct = 100 * diff / price;
}

def XLK_d_pct = pct(“XLK”) ;
def XLV_d_pct = pct(“XLV”) ;
def XLY_d_pct = pct(“XLY”) ;
def XLC_d_pct = pct(“XLC”) ;
def XLF_d_pct = pct(“XLF”) ;
def XLI_d_pct = pct(“XLI”) ;
def XLP_d_pct = pct(“XLP”) ;
def XLRE_d_pct = pct(“XLRE”) ;
def XLB_d_pct = pct(“XLB”) ;
def XLU_d_pct = pct(“XLU”) ;
def XLE_d_pct = pct(“XLE”) ;

# 11 Sector total percent values
def SumOfPctValues = XLK_d_pct + XLV_d_pct + XLY_d_pct + XLC_d_pct + XLF_d_pct + XLI_d_pct + XLP_d_pct + XLRE_d_pct + XLB_d_pct + XLU_d_pct + XLE_d_pct;

def UVOLSP = close("$UVOLSPc");
def DVOLSP = close("$DVOLSPc");
def Data = close("$ADSPDc");

# Calculate secondary periods
def AD = close(symbol = SYMB, period = AggregationPeriod.DAY);
def TK = close(symbol = SYMB2, period = AggregationPeriod.DAY);
def TR = close(symbol = Symb3, period = AggregationPeriod.DAY);
def PutCall = close(symbol = Symb4, period = AggregationPeriod.DAY);
def VX = close (symbol = symb7, period = AggregationPeriod.DAY);
def SP50 = close (symbol = symb8, period = AggregationPeriod.DAY);
def SP100 = close (symbol = symb9, period = AggregationPeriod.DAY);
def SP200 = close (symbol = symb10, period = AggregationPeriod.DAY);

# Calculate AD2 with aggregation period DAY
def AD2 = close(Symb5, period = AggregationPeriod.DAY) / close(Symb6, period = AggregationPeriod.DAY);


# SP Breadth ratio
def SPratio = if (UVOLSP >= DVOLSP) then (UVOLSP / DVOLSP) else -(DVOLSP / UVOLSP);

# Add Labels

#Weighted A/D Ratio
AddLabel(ShowLabel, "Weighted A/D SP500: " + Round(SumOfPctValues, 2), (if SumOfPctValues > 0 then Color.GREEN else if SumOfPctValues < 0 then Color.RED else Color.YELLOW));
#Unweighted A/D ratio
AddLabel(yes, " A/D S&P500: " + AD2, if AD2 >= 0 then Color.GREEN else Color.RED);
# A/D value
AddLabel(yes, "A/D SP500: " + AD, if AD >= 0 then Color.GREEN else Color.RED);
#Tick for SP500
AddLabel(yes, "TikSP: " + TK, if TK >= 0 then Color.GREEN else Color.RED);
#Trin for SP500
AddLabel(yes, "TrinSP: " + TR, if TR >= 1.3 then Color.RED else if TR <= .6 then Color.GREEN else Color.YELLOW);
#Put/Call Ratio for SP500
AddLabel(yes, "Put/Call Ratio SP500: " + PutCall, if putcall >= 1 then Color.RED else if putcall <= .1 then Color.GREEN else Color.YELLOW);
#Up/Down Volume for SP500
AddLabel(yes, Concat(Round(SPratio, 2), " :SP Vol"), if SPratio >= 0 then Color.GREEN else Color.RED);
#Vix for Futures
AddLabel(yes, "VIX SP500: " + vx, if vx >= sma1 then Color.cyan else if vx <= sma1 then Color.yellow else Color.YELLOW);
#Percent of SP500 stocks trading above 50 day average
AddLabel(yes, " SP(50)Day: " + sp50, if sp50>= 0 then Color.GREEN else Color.RED);
#Percent of SP500 stocks trading above 100 day average
AddLabel(yes, " SP(100)Day: " + sp100, if sp100>= 0 then Color.GREEN else Color.RED);
#Percent of SP500 stocks trading above 200 day average
AddLabel(yes, " SP(200)Day: " + sp200, if sp200 >= 0 then Color.GREEN else Color.RED);

#End Code

Description of labels from left to right:

Label 1) = SP500 Weighted A/D Ratio using sector weights
Label 2) = SP500 Unweighted A/D Ratio
Label 3) = SP500 A/D chart value
Label 4) = SP500 Tick value
Label 5) = SP500 Trin value
Label 6) = SP500 Put/Call Ratio
Label 7) = SP500 Up-Down Volume
Label 8) = SP500 Vix value
Label 9) = SP500 Stocks trading above their 50-day simple avg
Label 10) = SP500 Stocks trading above their 100-day simple avg
Label 11) = SP500 Stocks trading above their 200-day simple avg

This was modified for SP500 Futures but of course, it can be used for other futures, stocks, etc by changing the settings and/or the code to replace the default tickers.

This is literally my third post and I'm super new to Thinkscript so any ideas or pointers on how to make the script better I'm all ears (eyes)

SP500 Labels pic.PNG
 
Great job guys, I really like this idea for labels. Here is a modified version I put together for SP500. Maybe it will be useful for some of the other futures traders.

Code:
#Original labels code from Markos and Bobomatic https://usethinkscript.com/threads/market-internals-labels-for-thinkorswim.833/

# Modified by MTG 10/2023 to include $TRIN, $Put/Call ratio, Vix for Futures, Percent of SP500 stocks trading above their (50, 100, and 200)day averages, and $TICK for SP500 - 10/2023

##############################################################

# Weighted A/D
# concept from shadowtrader.net
# coded by TWOO
# https://www.spglobal.com/spdji/en/indices/equity/sp-500/#data
# sector-breakdown
# modified by CWPARKER23
# modifiedTrueRange by Sam4COK @ 07/2022
# modified by MTG to show full sector name and include Overall ratio sum 9/2023

###############################################################

input market = {default NYSE, NASDAQ, SP};
input open_time = 930;
input length = 12;
input ShowLabel = yes;
def price1 = close(symbol = "/vx", period = AggregationPeriod.DAY);
input length1 = 45; #SMA length for VIX of futures
input displace1 = 0;

def SMA1 = Average(price1[-displace1], length1);
# Market Internal Labels
input SYMB = "$ADSPDc"; #Hint SYMB:$ADSPD for SP500 Adv-Decline Issues - composites include the data from all exchanges
input SYMB2 = "$TIKSPc"; #Hint SYMB2:$tIKSP for SP500 Tick
input Symb3 = "$TRINSPc"; #Hint symb: $TrinSp for SP500 Trin
input Symb4 = "$PCSP"; #Hint symb: $PCSP Put/Call Ratio SP500
input Symb5 = "$ADVSPC"; #Hint symb: $ADVSPC Advance Issues Composite SP500 Trin
input Symb6 = "$DECLSPC"; #Hint symb: $DECLSPC Decline Issues SP500
input symb7 = "/vx"; #Hint symb: /vx is volatility index
input symb8 = "$SPXA50R"; #Hint this is the percent of SP500 Stocks trading above their 50 day average
input symb9 = "$SPXA100R"; #Hint this is the percent of SP500 Stocks trading above their 100 day average
input symb10 = "$SPXA200R"; #Hint this is the percent of SP500 Stocks trading above their 200 day average
input InformationTechnology = 26.8; # xlkwt
input HealthCare = 15.1; # xlvwt
input Financials = 10.8; # xlfwt
input ConsumerDiscretionary = 10.5; # xlywt
input Communications = 8.9; # xlcwt
input Industrials = 7.8; # xliwt
input ConsumerStaples = 7.0; # xlpwt
input Energy = 4.4; # xlewt
input Utilities = 3.1; # xluwt
input RealEstate = 2.9; # xlrewt
input Materials = 2.6; # xlbwt

def na = Double.NaN ;
def SectorCount = 11;
def Scale = 5000;
def displace = 0;

#### COLORS
DefineGlobalColor("Bullish", Color.CYAN);
DefineGlobalColor("Bearish", Color.PINK);
DefineGlobalColor("Channel", CreateColor(100, 181, 246));

#SP500 ETF sectors percent change
script PC {
    input Symbol = "SPX";
    def isFirstBar = GetTime() == RegularTradingStart(GetYYYYMMDD()) + 1;
    def O = if isFirstBar then close(Symbol) else O[1];
    def C = close(Symbol);
    plot PctChg = (C - O) / O;
}
def xlkPctChg = PC("XLK");
def xlyPctChg = PC("XLY");
def xlvPctChg = PC("XLV");
def xlfPctChg = PC("XLF");
def xlcPctChg = PC("XLC");
def xliPctChg = PC("XLI");
def xlpPctChg = PC("XLP");
def xlrePctChg = PC("XLRE");
def xlePctChg = PC("XLE");
def xlbPctChg = PC("XLB");
def xluPctChg = PC("XLU");

def xlkSizing = xlkPctChg * InformationTechnology;
def xlvSizing = xlvPctChg * HealthCare;
def xlySizing = xlyPctChg * ConsumerDiscretionary;
def xlfSizing = xlfPctChg * Financials;
def xlcSizing = xlcPctChg * Communications;
def xliSizing = xliPctChg * Industrials;
def xlpSizing = xlpPctChg * ConsumerStaples;
def xleSizing = xlePctChg * Energy;
def xlreSizing = xlrePctChg * RealEstate;
def xlbSizing = xlbPctChg * Materials;
def xluSizing = xluPctChg * Utilities;

def combinedSizing = Scale * (
xlkSizing +
xlvSizing +
xlySizing +
xlfSizing +
xlcSizing +
xliSizing +
xlpSizing +
xleSizing +
xlreSizing +
xlbSizing +
xluSizing
) / SectorCount;

# Weighted_AD
def Weighted_AD = if !IsNaN(combinedSizing) then combinedSizing else na;

# SPX Non_Weighted_AD
def spxcombinedSizing = Scale *
(xlkPctChg +
xlvPctChg +
xlyPctChg +
xlfPctChg +
xlcPctChg +
xliPctChg +
xlpPctChg +
xlePctChg +
xlrePctChg +
xlbPctChg +
xluPctChg);

#SP500 ETF sectors BUBBLE
script pct {
    input Symbol = "SPX";
    def aggregationPeriod = AggregationPeriod.DAY;
    def price = open(Symbol, period = aggregationPeriod);
    def diff = close (Symbol) - open(Symbol, period = aggregationPeriod);
    plot d_pct = 100 * diff / price;
}

def XLK_d_pct = pct(“XLK”) ;
def XLV_d_pct = pct(“XLV”) ;
def XLY_d_pct = pct(“XLY”) ;
def XLC_d_pct = pct(“XLC”) ;
def XLF_d_pct = pct(“XLF”) ;
def XLI_d_pct = pct(“XLI”) ;
def XLP_d_pct = pct(“XLP”) ;
def XLRE_d_pct = pct(“XLRE”) ;
def XLB_d_pct = pct(“XLB”) ;
def XLU_d_pct = pct(“XLU”) ;
def XLE_d_pct = pct(“XLE”) ;

# 11 Sector total percent values
def SumOfPctValues = XLK_d_pct + XLV_d_pct + XLY_d_pct + XLC_d_pct + XLF_d_pct + XLI_d_pct + XLP_d_pct + XLRE_d_pct + XLB_d_pct + XLU_d_pct + XLE_d_pct;

def UVOLSP = close("$UVOLSPc");
def DVOLSP = close("$DVOLSPc");
def Data = close("$ADSPDc");

# Calculate secondary periods
def AD = close(symbol = SYMB, period = AggregationPeriod.DAY);
def TK = close(symbol = SYMB2, period = AggregationPeriod.DAY);
def TR = close(symbol = Symb3, period = AggregationPeriod.DAY);
def PutCall = close(symbol = Symb4, period = AggregationPeriod.DAY);
def VX = close (symbol = symb7, period = AggregationPeriod.DAY);
def SP50 = close (symbol = symb8, period = AggregationPeriod.DAY);
def SP100 = close (symbol = symb9, period = AggregationPeriod.DAY);
def SP200 = close (symbol = symb10, period = AggregationPeriod.DAY);

# Calculate AD2 with aggregation period DAY
def AD2 = close(Symb5, period = AggregationPeriod.DAY) / close(Symb6, period = AggregationPeriod.DAY);


# SP Breadth ratio
def SPratio = if (UVOLSP >= DVOLSP) then (UVOLSP / DVOLSP) else -(DVOLSP / UVOLSP);

# Add Labels

#Weighted A/D Ratio
AddLabel(ShowLabel, "Weighted A/D SP500: " + Round(SumOfPctValues, 2), (if SumOfPctValues > 0 then Color.GREEN else if SumOfPctValues < 0 then Color.RED else Color.YELLOW));
#Unweighted A/D ratio
AddLabel(yes, " A/D S&P500: " + AD2, if AD2 >= 0 then Color.GREEN else Color.RED);
# A/D value
AddLabel(yes, "A/D SP500: " + AD, if AD >= 0 then Color.GREEN else Color.RED);
#Tick for SP500
AddLabel(yes, "TikSP: " + TK, if TK >= 0 then Color.GREEN else Color.RED);
#Trin for SP500
AddLabel(yes, "TrinSP: " + TR, if TR >= 1.3 then Color.RED else if TR <= .6 then Color.GREEN else Color.YELLOW);
#Put/Call Ratio for SP500
AddLabel(yes, "Put/Call Ratio SP500: " + PutCall, if putcall >= 1 then Color.RED else if putcall <= .1 then Color.GREEN else Color.YELLOW);
#Up/Down Volume for SP500
AddLabel(yes, Concat(Round(SPratio, 2), " :SP Vol"), if SPratio >= 0 then Color.GREEN else Color.RED);
#Vix for Futures
AddLabel(yes, "VIX SP500: " + vx, if vx >= sma1 then Color.cyan else if vx <= sma1 then Color.yellow else Color.YELLOW);
#Percent of SP500 stocks trading above 50 day average
AddLabel(yes, " SP(50)Day: " + sp50, if sp50>= 0 then Color.GREEN else Color.RED);
#Percent of SP500 stocks trading above 100 day average
AddLabel(yes, " SP(100)Day: " + sp100, if sp100>= 0 then Color.GREEN else Color.RED);
#Percent of SP500 stocks trading above 200 day average
AddLabel(yes, " SP(200)Day: " + sp200, if sp200 >= 0 then Color.GREEN else Color.RED);

#End Code

Description of labels from left to right:

Label 1) = SP500 Weighted A/D Ratio using sector weights
Label 2) = SP500 Unweighted A/D Ratio
Label 3) = SP500 A/D chart value
Label 4) = SP500 Tick value
Label 5) = SP500 Trin value
Label 6) = SP500 Put/Call Ratio
Label 7) = SP500 Up-Down Volume
Label 8) = SP500 Vix value
Label 9) = SP500 Stocks trading above their 50-day simple avg
Label 10) = SP500 Stocks trading above their 100-day simple avg
Label 11) = SP500 Stocks trading above their 200-day simple avg

This was modified for SP500 Futures but of course, it can be used for other futures, stocks, etc by changing the settings and/or the code to replace the default tickers.

This is literally my third post and I'm super new to Thinkscript so any ideas or pointers on how to make the script better I'm all ears (eyes)

View attachment 19878

Awesome script. Is there a way to turn off certain labels? If not, is there a way just to create a script for the weighted AD logic ? Thanks!
 
Awesome script. Is there a way to turn off certain labels? If not, is there a way just to create a script for the weighted AD logic ? Thanks!
Thanks for the comment I think that is a great suggestion. I've updated the code to include the option to toggle labels on/off individually.
Code:
#Original labels code from Markos and Bobomatic https://usethinkscript.com/threads/market-internals-labels-for-thinkorswim.833/

# Modified by MTG 10/2023 to include $TRIN, $Put/Call ratio, Vix for Futures, Percent of SP500 stocks trading above their (50, 100, and 200)day averages, and $TICK for SP500 - 10/2023
# Modified by MTG 10/2023 to include the option to turn on/off each label from the suggestion of hboogie

##############################################################

# Weighted A/D
# concept from shadowtrader.net
# coded by TWOO
# https://www.spglobal.com/spdji/en/indices/equity/sp-500/#data
# sector-breakdown
# modified by CWPARKER23
# modifiedTrueRange by Sam4COK @ 07/2022
# modified by MTG to show full sector name and include Overall ratio sum 9/2023

###############################################################

input market = {default NYSE, NASDAQ, SP};
input open_time = 930;
input length = 12;
input ShowLabel = yes; #Weighted A/D Ratio
input ShowLabel_2 = no; #Unweighted A/D ratio
input ShowLabel_3 = no; # A/D value
input ShowLabel_4 = no; #Tick for SP500
input ShowLabel_5 = no; #Trin for SP500
input ShowLabel_6 = no; #Put/Call Ratio for SP500
input ShowLabel_7 = no; #Up/Down Volume for SP500
input ShowLabel_8 = no; #Vix for Futures
input ShowLabel_9 = no; #Percent of SP500 stocks trading above 50 day average
input ShowLabel_10 = no; #Percent of SP500 stocks trading above 100 day average
input ShowLabel_11 = no; #Percent of SP500 stocks trading above 200 day average

def price1 = close(symbol = "/vx", period = AggregationPeriod.DAY);
input length1 = 45; #SMA length for VIX of futures
input displace1 = 0;

def SMA1 = Average(price1[-displace1], length1);
# Market Internal Labels
input SYMB = "$ADSPDc"; #Hint SYMB:$ADSPD for SP500 Adv-Decline Issues - composites include the data from all exchanges
input SYMB2 = "$TIKSPc"; #Hint SYMB2:$tIKSP for SP500 Tick
input Symb3 = "$TRINSPc"; #Hint symb: $TrinSp for SP500 Trin
input Symb4 = "$PCSP"; #Hint symb: $PCSP Put/Call Ratio SP500
input Symb5 = "$ADVSPC"; #Hint symb: $ADVSPC Advance Issues Composite SP500 Trin
input Symb6 = "$DECLSPC"; #Hint symb: $DECLSPC Decline Issues SP500
input symb7 = "/vx"; #Hint symb: /vx is volatility index
input symb8 = "$SPXA50R"; #Hint this is the percent of SP500 Stocks trading above their 50 day average
input symb9 = "$SPXA100R"; #Hint this is the percent of SP500 Stocks trading above their 100 day average
input symb10 = "$SPXA200R"; #Hint this is the percent of SP500 Stocks trading above their 200 day average
input InformationTechnology = 26.8; # xlkwt
input HealthCare = 15.1; # xlvwt
input Financials = 10.8; # xlfwt
input ConsumerDiscretionary = 10.5; # xlywt
input Communications = 8.9; # xlcwt
input Industrials = 7.8; # xliwt
input ConsumerStaples = 7.0; # xlpwt
input Energy = 4.4; # xlewt
input Utilities = 3.1; # xluwt
input RealEstate = 2.9; # xlrewt
input Materials = 2.6; # xlbwt

def na = Double.NaN ;
def SectorCount = 11;
def Scale = 5000;
def displace = 0;

#### COLORS
DefineGlobalColor("Bullish", Color.CYAN);
DefineGlobalColor("Bearish", Color.PINK);
DefineGlobalColor("Channel", CreateColor(100, 181, 246));

#SP500 ETF sectors percent change
script PC {
    input Symbol = "SPX";
    def isFirstBar = GetTime() == RegularTradingStart(GetYYYYMMDD()) + 1;
    def O = if isFirstBar then close(Symbol) else O[1];
    def C = close(Symbol);
    plot PctChg = (C - O) / O;
}
def xlkPctChg = PC("XLK");
def xlyPctChg = PC("XLY");
def xlvPctChg = PC("XLV");
def xlfPctChg = PC("XLF");
def xlcPctChg = PC("XLC");
def xliPctChg = PC("XLI");
def xlpPctChg = PC("XLP");
def xlrePctChg = PC("XLRE");
def xlePctChg = PC("XLE");
def xlbPctChg = PC("XLB");
def xluPctChg = PC("XLU");

def xlkSizing = xlkPctChg * InformationTechnology;
def xlvSizing = xlvPctChg * HealthCare;
def xlySizing = xlyPctChg * ConsumerDiscretionary;
def xlfSizing = xlfPctChg * Financials;
def xlcSizing = xlcPctChg * Communications;
def xliSizing = xliPctChg * Industrials;
def xlpSizing = xlpPctChg * ConsumerStaples;
def xleSizing = xlePctChg * Energy;
def xlreSizing = xlrePctChg * RealEstate;
def xlbSizing = xlbPctChg * Materials;
def xluSizing = xluPctChg * Utilities;

def combinedSizing = Scale * (
xlkSizing +
xlvSizing +
xlySizing +
xlfSizing +
xlcSizing +
xliSizing +
xlpSizing +
xleSizing +
xlreSizing +
xlbSizing +
xluSizing
) / SectorCount;

# Weighted_AD
def Weighted_AD = if !IsNaN(combinedSizing) then combinedSizing else na;

# SPX Non_Weighted_AD
def spxcombinedSizing = Scale *
(xlkPctChg +
xlvPctChg +
xlyPctChg +
xlfPctChg +
xlcPctChg +
xliPctChg +
xlpPctChg +
xlePctChg +
xlrePctChg +
xlbPctChg +
xluPctChg);

#SP500 ETF sectors BUBBLE
script pct {
    input Symbol = "SPX";
    def aggregationPeriod = AggregationPeriod.DAY;
    def price = open(Symbol, period = aggregationPeriod);
    def diff = close (Symbol) - open(Symbol, period = aggregationPeriod);
    plot d_pct = 100 * diff / price;
}

def XLK_d_pct = pct(“XLK”) ;
def XLV_d_pct = pct(“XLV”) ;
def XLY_d_pct = pct(“XLY”) ;
def XLC_d_pct = pct(“XLC”) ;
def XLF_d_pct = pct(“XLF”) ;
def XLI_d_pct = pct(“XLI”) ;
def XLP_d_pct = pct(“XLP”) ;
def XLRE_d_pct = pct(“XLRE”) ;
def XLB_d_pct = pct(“XLB”) ;
def XLU_d_pct = pct(“XLU”) ;
def XLE_d_pct = pct(“XLE”) ;

# 11 Sector total percent values
def SumOfPctValues = XLK_d_pct + XLV_d_pct + XLY_d_pct + XLC_d_pct + XLF_d_pct + XLI_d_pct + XLP_d_pct + XLRE_d_pct + XLB_d_pct + XLU_d_pct + XLE_d_pct;

def UVOLSP = close("$UVOLSPc");
def DVOLSP = close("$DVOLSPc");
def Data = close("$ADSPDc");

# Calculate secondary periods
def AD = close(symbol = SYMB, period = AggregationPeriod.DAY);
def TK = close(symbol = SYMB2, period = AggregationPeriod.DAY);
def TR = close(symbol = Symb3, period = AggregationPeriod.DAY);
def PutCall = close(symbol = Symb4, period = AggregationPeriod.DAY);
def VX = close (symbol = symb7, period = AggregationPeriod.DAY);
def SP50 = close (symbol = symb8, period = AggregationPeriod.DAY);
def SP100 = close (symbol = symb9, period = AggregationPeriod.DAY);
def SP200 = close (symbol = symb10, period = AggregationPeriod.DAY);

# Calculate AD2 with aggregation period DAY
def AD2 = close(Symb5, period = AggregationPeriod.DAY) / close(Symb6, period = AggregationPeriod.DAY);


# SP Breadth ratio
def SPratio = if (UVOLSP >= DVOLSP) then (UVOLSP / DVOLSP) else -(DVOLSP / UVOLSP);

# Add Labels

#Weighted A/D Ratio
AddLabel(ShowLabel, "Weighted A/D SP500: " + Round(SumOfPctValues, 2), (if SumOfPctValues > 0 then Color.GREEN else if SumOfPctValues < 0 then Color.RED else Color.YELLOW));
#Unweighted A/D ratio
AddLabel(ShowLabel_2, " A/D S&P500: " + AD2, if AD2 >= 0 then Color.GREEN else Color.RED);
# A/D value
AddLabel(ShowLabel_3, "A/D SP500: " + AD, if AD >= 0 then Color.GREEN else Color.RED);
#Tick for SP500
AddLabel(ShowLabel_4, "TikSP: " + TK, if TK >= 0 then Color.GREEN else Color.RED);
#Trin for SP500
AddLabel(ShowLabel_5, "TrinSP: " + TR, if TR >= 1.3 then Color.RED else if TR <= .6 then Color.GREEN else Color.YELLOW);
#Put/Call Ratio for SP500
AddLabel(ShowLabel_6, "Put/Call Ratio SP500: " + PutCall, if putcall >= 1 then Color.RED else if putcall <= .1 then Color.GREEN else Color.YELLOW);
#Up/Down Volume for SP500
AddLabel(ShowLabel_7, Concat(Round(SPratio, 2), " :SP Vol"), if SPratio >= 0 then Color.GREEN else Color.RED);
#Vix for Futures
AddLabel(ShowLabel_8, "VIX SP500: " + vx, if vx >= sma1 then Color.cyan else if vx <= sma1 then Color.yellow else Color.YELLOW);
#Percent of SP500 stocks trading above 50 day average
AddLabel(ShowLabel_9, " SP(50)Day: " + sp50, if sp50>= 0 then Color.GREEN else Color.RED);
#Percent of SP500 stocks trading above 100 day average
AddLabel(ShowLabel_10, " SP(100)Day: " + sp100, if sp100>= 0 then Color.GREEN else Color.RED);
#Percent of SP500 stocks trading above 200 day average
AddLabel(ShowLabel_11, " SP(200)Day: " + sp200, if sp200 >= 0 then Color.GREEN else Color.RED);

#End Code
 
Another symbol I'm using, for quite some time already, is $SPXA200R. I find it really helpful to determine the direction of the market

Hello friend, could you tell us how you use this symbol to determine the direction of the market and in what time period you see it?
 
Last edited by a moderator:
Hello friend, could you tell us how you use this symbol to determine the direction of the market and in what time period you see it?

The $SPXA200R indicator is a tool for assessing the overall health of the market by measuring the percentage of S&P500 stocks trading above their 200-day moving average.

In 2022, amid the bear market, when fewer than 10% of S&P500 stocks were trading above their 200-day moving average (200ma), it indicated a prevailing bearish sentiment in the market. This suggested that the majority of stocks were not experiencing a bullish trend, rendering the market unfavorable for bullish trades.

During 2023, when more than 40% of S&P500 stocks were consistently trading below their 200ma on numerous days, it implied that a limited number of stocks were primarily influencing market movement. This scenario proved unfavorable for bullish trades, except for select stocks that were driving market momentum.

Subsequently, the onset of the Santa Claus Rally in December 2023 brought about a significant shift. Nearly all S&P500 stocks transitioned to a bullish stance, with a majority trading above their 200ma. This signaled a robust bullish trend in the market, offering favorable opportunities for bullish trades across the majority of the 500 stocks.
AISENZb.png


Market breathe indicators should be reviewed on daily or higher aggregations:
Ruby:
declare lower ;
plot SP200 = close("$SPXA200R");
sp200.setDefaultColor(color.gray);

plot midline = .6 ;
AddCloud(SP200, midline, color.green, color.red);
 
Last edited by a moderator:

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
411 Online
Create Post

Similar threads

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