$NYSI - McClellan Summation Index for ThinkorSwim

@Joshua @generic

Hey Guys,

I figured it out. I tackled it from another angle based on the pointer @generic gave. Instead of depending on the Advance/Decline Line (Daily) reference used in the AdvanceDeclineCumulativeAvg indicator, I sought to replace this reference with the actual definition of Advance/Decline Line Daily. But in doing this, the definitions of advnDecl, advances, and declines HAVE TO BE ABOVE the percent change and cumulative calculations.

Lastly, are you guys coders? If so, alognside furthering my knowledge of thinkscript I plan on learning python. If any of you know this coding language and can point me in the right direction for self-study it'll be greatly appreciated.

-----

declare lower;

input exchange = {default NYSE, NASDAQ, AMEX, NQ_100, SP_500};
input length = 252;

def advances;
def declines;
switch (exchange) {
case NYSE:
advances = close("$ADVN");
declines = close("$DECN");
case NASDAQ:
advances = close("$ADVN/Q");
declines = close("$DECN/Q");
case AMEX:
advances = close("$ADVA");
declines = close("$DECA”);
case NQ_100:
advances = close("$ADVND");
declines = close("$DECLND");
case SP_500:
advances = close("$ADVSP");
declines = close("$DECLSP");
}

def advnDecl = (advances - declines) / (advances + declines);

def advnDecnPctChg = 1000 * advndecl;
def cumAdvnDecn = cumAdvnDecn[1] + if !IsNaN(advnDecnPctChg) then advnDecnPctChg else 0;


plot CumulAD = if !IsNaN(advnDecnPctChg) then cumAdvnDecn else Double.NaN;
plot AvgCumulAD = if !IsNaN(close) then Sum(if !IsNaN(CumulAD) then CumulAD else 0, length) / Sum(if !IsNaN(CumulAD) then 1 else 0, length) else Double.NaN;

CumulAD.DefineColor("Above", Color.UPTICK);
CumulAD.DefineColor("Below", Color.DOWNTICK);
CumulAD.AssignValueColor(if CumulAD > AvgCumulAD then CumulAD.Color("Above") else CumulAD.Color("Below"));
AvgCumulAD.SetDefaultColor(GetColor(7));
 

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

StockCharts Indicator List
  • $BPINDU Dow Bullish %
  • $BPCOMPQ Nasdaq Bullish %
  • $BPNDX Nasdaq 100 Bullish %
  • $BPNYA NYSE Bullish %
  • $BPOEX S&P 100 Bullish %
  • $BPSPX S&P 500 Bullish %
  • $BPDISC Consumer Discretionary Bullish %
  • $BPSTAP Consumer Staples Bullish %
  • $BPENER Energy Bullish %
  • $BPFINA Financials Bullish %
  • $BPHEAL Healthcare Bullish %
  • $BPINDY Industrials Bullish %
  • $BPMATE Materials Bullish %
  • $BPINFO Tech Bullish %
  • $BPTELE Telecom Bullish %
  • $BPUTIL Utilities Bullish %
  • $AMAD AMEX Advancers-Decliners
  • $NAAD Nasdaq Advancers-Decliners
  • $NYAD NYSE Advancers-Decliners
  • $AMHL AMEX New Highs-New Lows
  • $NAHL Nasdaq New Highs-New Lows
  • $NYHL NYSE New Highs-New Lows
  • $NAUD Nasdaq Advance-Decline Volume
  • $NYUD NYSE Advance-Decline Volume
  • $NASI Nasdaq Summation Index
  • $NYSI NYSE Summation Index
  • $CPC Put/Call
  • $DOWA50R Dow % of stocks above 50 MA
  • $DOWA200R Dow % of stocks above 200 MA
  • $NAA50R Nasdaq % of stocks above 50 MA
  • $NAA200R Nasdaq % of stocks above 200 MA
  • $NDXA50R Nas 100 % of stocks above 50 MA
  • $NDXA200R Nas 100 % of stocks above 200 MA
  • $NYA50R NYSE % of stocks above 50 MA
  • $NYA200R NYSE % of stocks above 200 MA
  • $OEXA50R S&P 100 % of stocks above 50 MA
  • $OEXA200R S&P 100 of stocks above 200 MA
  • $SPXA50R S&P 500 % of stocks above 50 MA
  • $SPXA200R S&P 500 % of stocks above 200 MA
is there an option to add $CPC advance and decline too?
 

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
298 Online
Create Post

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