OPEN-SOURCE SCRIPT

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!
breadthbreadthindicatorsBreadth IndicatorscryptomarketcryptotradingMcClellan OscillatormcclellanoscillatorOscillators

Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in publication is governed by House rules. You can favorite it to use it on a chart.

Want to use this script on a chart?

Disclaimer