Broad market index / quantifytools- Overview
Broad market index is a market breadth based oscillator, depicting broad market trend by analysing ratio between symbols moving up and symbols moving down in a given market. When market breadth is positive, more symbols are going up and when negative, more symbols are going down. As markets tend to correlate, broad market trend dictates likely path for all individual symbols that make up the market.
This tool provides market breadth for US equities (based on NYSE advancers - decliners) and ability to build two custom breadth baskets with up to 39 symbols included in each. Market breadth can be customized with variety of smoothing options, weighting and threshold modes to find most optimal rules for trend following. Performance of the model is reflected on metrics showing percentage of up/down moves during bullish/bearish states.
Example
↑ 63% = 63% of price moves during positive breadth state are to the upside
↓ 59% = 59% of price moves during negative breadth state are to the downside
Breadth state is colorized on line and chart according to its state (negative/positive/equilibrium) and direction (trending up/down). Upper and lower bands depict historical turning points in breadth for identifying extremes in broad market trend. Triangles mark breadth thrusts, in other words abnormally large moves in breadth at either upper or lower extreme. Breadth thrusts can serve as early signs of broad market trend reverting.
- Concept and features
By default, market breadth is calculated based on NYSE advancers - decliners, usable for all major indices that depict broad markets in US equities (SP500, QQQ, IWM). Users can also build 2 custom breadth baskets consisting of up to 39 symbols for defining broad market on other asset classes, such as cryptocurrencies. Custom baskets are suitable for any chart that fairly represents a market as a whole.
Example
Basket consisting of cryptocurrencies = Use on CRYPTOCAP:TOTAL (all cryptocurrencies aggregated)
Basket consisting of healthcare stocks = Use on AMEX:XLV (healthcare sector ETF)
Breadth line can be further refined using various smoothing options (SMA, EMA, HMA, RMA, WMA), threshold method and weights. By default, threshold (dividing line between bullish and bearish states) is set to fixed at 0, depicting an equilibrium where equal amount of symbols are going up and down.
Threshold mode can also be set to Dynamic, switching threshold to a moving average of the breadth line. Fundamental functionality still remains, breadth line above threshold marks bullish state and below threshold marks bearish state. Difference here is that the threshold no longer depicts a point of equilibrium, but simply a smoothed version of the breadth line itself, which can catch turns in broad market trend earlier.
Breadth basket can be adjusted to volatility of the viewed chart, causing an overstating of breadth on high volatility and understating on low volatility. Weighting takes into account magnitude of up/down moves, which can provide better relevance for trend following purposes.
- Practical guide
Example #1 : Broad market trend
The utility of market breadth is based on the idea that markets correlate and individual symbols making up the market will eventually join the broad market trend. With this in mind, going against broad market is like swimming upstream, it's going to be the hard way. A well performing basket with clear skew for upside and downside on respective breadth states can be used to form directional bias for trades and risk on/off regimes for investing.
Example #2 : Broad market reversals
Thrusts signify two things: a historical extreme in breadth and an aggressive move to the opposite direction. Thrusts are valuable clues for exhaustion in broad market trend, potentially leading to a reversal.
Example #3 : Breadth/price divergences
Market breadth and price diverging signify events where most symbols that make up the market are going one way but a few high weight symbols (big tech for SP500) are going the other way. In other words, only a few symbols are moving the market while general interest and intention is to the other direction. Divergences in breadth and price are not ideal for sustainable trend and can be expected to eventually revert to the direction of broad market.
Oscilador de McClellan
McClellan Indicators (Oscillator, Summation Index w/ RSI & MACD)Four indicators in one based on the McClellan Oscillator for both the NYSE and Nasdaq exchanges. Designed to be used in conjunction with each other- plot the Oscillator (Osc), Summation Index (MSI), and RSI/MACD of the MSI on both your SPX and Nasdaq chart. Select the exchange and indicator within the settings. These tools are secondary- but when the signals are combined with the action of the index and stocks can be helpful in identifying market turns and trend strength.
McClellan Oscillator--
The Osc is a market breadth tool that uses a fast and slow EMA based on the difference between advancing and declining stocks on the exchange. Used primarily to identify breadth thrusts, divergences, and extremes (oversold/overbought). Plot horizontal levels to see when the market internals are extremely overbought or oversold, and take note of when the Osc is declining while the market is advancing or vice versa.
McClellan Summation Index--
For intermediate trends the MSI is a running total of the Osc which can be used to confirm the strength of a trend, and spot potential reversals. A 10 period ema is included on this indicator, where crossovers can aid in spotting the change in trend of market internals, and divergences can identify when market internals are not in line with the trend. Shading is applied for when the internals are in a bullish or bearish trend.
Two additional indicators are the RSI and MACD of the Summation Index. An overbought or oversold MSI RSI generally indicates a strong trend in the market internals, however you may want to take note when the RSI stalls and begins to "hook" in the opposite direction. This indicator has signals to show when the market internals may be turning and to be on lookout for trend change.
Similarly- the MACD of the MSI identifies the strength of the trend, and crossovers can be used to help spot reversals. Shading is included in this indicator to spot the bullish/bearish trend of internals.
Crypto McClellan Oscillator (SLN Fix)This is an adaption of the Mcclellan Oscillator for crypto. Instead of tracking the S&P500 it tracks a selection of cryptos to make sure the indicator follows this sector instead.
Full credit goes to the creator of this indicator: Fadior. It has since been fixed by SLN.
The following description explains the standard McClellan Oscillator. Full credit to Investopedia , my fav source of financial explanations.
The same principles applies to its use in the crypto sector, but please be cautious of the last point, the limitations. Since crypto is more volatile, that could amplify choppy behavior.
This is not financial advice, please be extremely cautious. This indicator is only suitable as a confirmation signal and needs support of other signals to be profitable.
This indicator usually produces the best signals on slightly above daily time frame. I personally like 2 or 3 day, but you have to find the settings suitable for your trading style.
What Is the McClellan Oscillator?
The McClellan Oscillator is a market breadth indicator that is based on the difference between the number of advancing and declining issues on a stock exchange, such as the New York Stock Exchange (NYSE) or NASDAQ.
The indicator is used to show strong shifts in sentiment in the indexes, called breadth thrusts. It also helps in analyzing the strength of an index trend via divergence or confirmation.
The McClellan Oscillator formula can be applied to any stock exchange or group of stocks.
A reading above zero helps confirm a rise in the index, while readings below zero confirm a decline in the index.
When the index is rising but the oscillator is falling, that warns that the index could start declining too. When the index is falling and the oscillator is rising, that indicates the index could start rising soon. This is called divergence.
A significant change, such as moving 100 points or more, from a negative reading to a positive reading is called a breadth thrust. It may indicate a strong reversal from downtrend to uptrend is underway on the stock exchange.
How to Calculate the McClellan Oscillator
To get the calculation started, track Advances - Declines on a stock exchange for 19 and 39 days. Calculate a simple average for these, not exponential moving average (EMA).
Use these simple values as the Prior Day EMA values in the 19- and 39-day EMA formulas.
Calculate the 19- and 39-day EMAs.
Calculate the McClellan Oscillator value.
Now that the value has been calculated, on the next calculation use this value for the Prior Day EMA. Start calculating EMAs for the formula instead of simple averages.
If using the adjusted formula, the steps are the same, except use ANA instead of using Advances - Declines.
What Does the McClellan Oscillator Tell You?
The McClellan Oscillator is an indicator based on market breadth which technical analysts can use in conjunction with other technical tools to determine the overall state of the stock market and assess the strength of its current trend.
Since the indicator is based on all the stocks in an exchange, it is compared to the price movements of indexes that reflect that exchange, or compared to major indexes such as the S&P 500.
Positive and negative values indicate whether more stocks, on average, are advancing or declining. The indicator is positive when the 19-day EMA is above the 39-day EMA, and negative when the 19-day EMA is below the 39-day EMA.
A positive and rising indicator suggests that stocks on the exchange are being accumulated. A negative and falling indicator signals that stocks are being sold. Typically such action confirms the current trend in the index.
Crossovers from positive to negative, or vice versa, may signal the trend has changed in the index or exchange being tracked. When the indicator makes a large move, typically of 100 points or more, from negative to positive territory, that is called a breadth thrust.
It means a large number of stocks moved up after a bearish move. Since the stock market tends to rise over time, this a positive signal and may indicate that a bottom in the index is in and prices are heading higher overall.
When index prices and the indicator are moving in different directions, then the current index trend may lack strength. Bullish divergence occurs when the oscillator is rising while the index is falling. This indicates the index could head higher soon since more stocks are starting to advance.
Bearish divergence is when the index is rising and the indicator is falling. This means fewer stocks are keeping the advance going and prices may start to head lower.
Limitations of Using the McClellan Oscillator
The indicator tends to produce lots of signals. Breadth thrusts, divergence, and crossovers all occur with some frequency, but not all these signals will result in the price/index moving in the expected direction.
The indicator is prone to producing false signals and therefore should be used in conjunction with price action analysis and other technical indicators.
The indicator can also be quite choppy, moving between positive and negative territory rapidly. Such action indicates a choppy market, but this isn't evident until the indicator has made this whipsaw move a few times.
Good luck and a big thanks to Fadior!
[Unxi]McClellan Summation Index for DAX 30 (GER30) [modified]About McClellan Summation Index
The McClellan Summation Index is a market breadth indicator which was developed by Sherman and Marian McClellan. It is based on the McClellan Oscillator and add its values together, effectively running a total. The index goes up when the McClellan Oscillator is positive and goes down when it is negative. Signals can be derived from the index crossing the middle line (bullish when it's crossing up and bearish when it's crossing down). Other potential signals include divergences and overbought and oversold conditions. The indicator is best used in combination with other analysis techniques.
About this implementation
This version here is a modification of the McClellan Summation Index.
It runs the simple version of the McClellan Oscillator and uses the simple method to calculate the Summation Index. No ratios are used in this implementation.
Further information:
- It can only be used on the DAX index ( DAX 30 or GER 30)
- It only considers the DAX 30 stocks
- The data window will provide a summary about rising and declining stocks
- The data window will output the last change for each of the 30 stocks
- The script is pretty slow because it has to calculate the change for each bar individually (instead of receiving a complete calculation from the stock exchange).
DISCLAIMER
This script was mainly written for educational purposes (training myself how to write custom indicatotors).
As you can see, the code is really messy.
FOR YOUR INFORMATION: This script will work on any time period. It is recommended to use it with timeperiod = 1d, though. Just use whatever timeperiod you are comfortable with, the indicator will automatically adjust accordingly.
Credits
Based on the simple version of aftabmk and of code from lazybear.
[Unxi]McClellan Oscillator for TECDAX [modified]This version is for use with the German TecDax index only!
About McClellan Oscillator
Developed by Sherman and Marian McClellan, the McClellan Oscillator is a breadth indicator derived from Net Advances, the number of advancing issues less the number of declining issues. Subtracting the 39-day exponential moving average of Net Advances from the 19-day exponential moving average of Net Advances forms the oscillator.
As the formula reveals, the McClellan Oscillator is a momentum indicator that works similar to MACD .
McClellan Oscillator signals can be generated with breadth thrusts, centerline crossovers, overall levels and divergences.
About my version
This version here is a modification, though:
- It can only be used on the German TECDAX index
- It only considers the TECDAX stocks
- The data window will provide a summary about rising and declining stocks
- The data window will output the last change for each of the 30 stocks
The script is pretty slow because it has to calculate the change for each bar individually (instead of receiving a complete calculation from the stock exchange).
This script will work on any time period. Just use whatever timeperiod you are comfortable with, the indicator will automatically adjust accordingly. It is recommended to use it with timeperiod = 1d, though.
DISCLAIMER
This script was mainly written for educational purposes (training myself how to write custom indicatotors).
As you can see, the code is really messy. Feel free to provide your feedback in the comments!
Credits
Based on the simple version of aftabmk
You can find the original version by searching for McClellan Oscillator for nifty 50.
Also got some inspiration from lazybear's version and from danarn's "Crypto McClellan Oscillator".
McClellan Oscillator for DAX (GER30) [aftabmk modified]About McClellan Oscillator
Developed by Sherman and Marian McClellan, the McClellan Oscillator is a breadth indicator derived from Net Advances, the number of advancing issues less the number of declining issues. Subtracting the 39-day exponential moving average of Net Advances from the 19-day exponential moving average of Net Advances forms the oscillator.
As the formula reveals, the McClellan Oscillator is a momentum indicator that works similar to MACD .
McClellan Oscillator signals can be generated with breadth thrusts, centerline crossovers, overall levels and divergences.
About my version
This version here is a modification, though:
- It can only be used on the DAX index (DAX 30 or GER 30)
- It only considers the DAX 30 stocks
- The data window will provide a summary about rising and declining stocks
- The data window will output the last change for each of the 30 stocks
BUG
I am only publishing this version because I am not sure if my current version is saved when I leave tradingview.com without publishing the script.
This version still contains a bug - the if/else clauses do not correctly recognize declining stocks. So the oscillator should not be used as it is.
Working on it these days. Feel free to provide feedback!
Stuff I am working on
- Coloring the area green/red according to the value
- Fixing this bug/making this script more efficient
DISCLAIMER
This script was mainly written for educational purposes (training myself how to write custom indicatotors).
As you can see, the code is really messy.
Credits
Based on the simple version of aftabmk
You can find the original version by searching for McClellan Oscillator for nifty 50.
McClellan Oscillator for nifty 50This is a indicator which indicates breath of the market.
If found relevant do let me know!!
Only handpicked relevant 20 stocks (20 +ve indicator+ 20 -ve indicator) from different sector .
As there is the limit of 40 script allowed only.
Further modifications might be there if the limit is increased to 100 (50 +50 indicator) .
Double Mcclellan OscilatorPlots two Mcclellan Oscillators.
First MCO is plotted as the histogram using traditional n values of 19 and 39. Histogram is green when the oscillator is greater than 0.
Second MCO is plotted as the lime green and pink line. N values for the second oscillator should be lower than the first so that it has a shorter window length.
Advance/decline can be calculated using NYSE or NASDAQ stocks.
Capitalization of BTC vs. Top 5 US CorporationsThis script displays the capitalization of Bitcoin as a percentage of the capitalization of 5 large US corporations: Apple, Microsoft, Amazon, Google, Facebook. According to www.tradingview.com these are (at the current time) the largest US companies.
[KY]McClellan Summation Index RSIThis script contains McClellan Summation Index(MSI) and McClellan Oscillator(MO)
(1) What is McClellan Summation Index(MSI)
McClellan Summation Index(MSI) is a breadth indicator derived the McClellan Oscillator(MO),
which is a breadth indicator based on Net Advances (advancing issues less declining issues).
The Summation Index is simply a running total of the McClellan Oscillator values.
To identify the market direction, I prefer to use the relative strength(RSI) of MSI rather than MSI itself
because MSI is a summation so it's difficult to compare with previous market patterns. So I use RSI applied MSI.
Reference: Stockcharts.com has a nice set of detailed explanation about MSI.
school.stockcharts.com
(2) How to use this script
- Add this script to your chart.
- You can choose one of two options ("MSI RSI" or "MO").
- You can also choose the market from three options ("Nasdaq", "NYSE", "Nasdaq+NYSE")
(3) "MSI RSI" or "MO"
a) "MSI RSI"
For swing trade(sevelal weeks), MSI RSI is much better to identify the broad market direction.
I backtested last several years of S&P500. The result was not symmetrical between MT bear/bull market.
For bull side, when MSI RSI curls up from the bottom(e.g. RSI 30 level), 90% of times out of them the market rallied.
For bear side, when MSI RSI rolles over to downside from the top(e.g. RSI 70 level), only 60% of times out of them the market declined.
So the market tends to hit negatively diverrgent high from advancing/declining issues perspective. Be careful to use MSI oscilator.
b) "MO"
For short term trade(intraday, 2-3 days of holding), MO is better because MSI is a summation so lags several days. MO is quick.
MO is sometimes very noisy, so you need to draw trendlines or horizontal levels to compare with the previous cases.
For beginners, I recommend to use "MSI RSI".
McClellan Oscillator [CC]The McClellan Oscillator was created by Sherman and Marian McClellan and it is essentially a MACD of the advancing and declining symbols of the day and is best used as a comparison with the biggest stocks such as my example Apple but that is just my opinion. I pulled the symbol names from a Trading View blog so I'm not 100% sure if they are accurate so please let me know if I'm wrong. Buy when the indicator is over 0 and sell when it falls below 0 but keep in mind that these values are for the market itself and not the individual symbol.
This was a special request so let me know if you would like me to publish more scripts or if you want something custom done!
Note: I'm republishing this because the original script couldn't be found in searches so this will fix that.
Crypto McClellan OscillatorMcClellan Oscillator for cryptocurrency, taking into account only the top 40 cryptos.
Original code was by LazyBear.
McClellan Oscillator [LazyBear ~ modified]The McClellan Oscillator is a market breadth indicator developed by Sherman and Marian McClellan.
It is calculated from Net Advances, which is the number of advancing issues minus the number of declining issues. Subtracting the 39-day exponential moving average of Net Advances from the 19-day exponential moving average of Net Advances forms the oscillator.
The McClellan Oscillator can be traded with breadth thrusts, centerline crossovers and divergences.
The original code was written by LazyBear - I just modified it to add together all advancing and declining issues from all stock exchanges (NYSE + NASDAQ + others), to make it available on the hourly time frame and also add alerts.