🧠 McClellan Oscillator (IRUS Index)
Type: Market Breadth Indicator
Category: Breadth, Momentum
Purpose: Gauge the internal strength of the IRUS index and anticipate trend reversals
📌 Based on
This indicator is built on the concept of advancing vs. declining issues — the number of stocks rising vs. falling each day within the IRUS index (a custom group of 40 Russian stocks).
It calculates the net advances (advancers minus decliners), then applies two exponential moving averages (EMA):
java
Copy
Edit
McClellan Oscillator = EMA_19(Net Advances) - EMA_39(Net Advances)
Where:
Net Advances = Number of advancing stocks - Number of declining stocks
Calculated from a fixed set of 40 IRUS stocks
🧭 What it shows
Above 0 → more stocks are rising: market is internally strong.
Below 0 → more stocks are falling: underlying weakness.
Rising from below -100 → oversold breadth, possible bullish reversal.
Falling from above +100 → overbought breadth, possible correction.
🎯 How to use it
1. Buy/Sell Signals
Buy: Oscillator drops below -100 and turns up → oversold, potential rally.
Sell: Oscillator rises above +100 and turns down → overbought, risk of pullback.
2. Trend Strength Confirmation
Sustained above 0 → confirms bullish trend.
Crosses below 0 → early warning of weakening market breadth.
3. Divergences with IRUS Price
IRUS rises, but Oscillator falls → narrowing leadership, bearish divergence.
IRUS falls, but Oscillator rises → improving breadth, bullish divergence.
⚠️ Notes
The oscillator measures participation, not price.
Works best with daily timeframe.
Does not account for volume or magnitude of price moves.
Use with price action or other indicators for confirmation.
⚙️ Custom Implementation
This version is specifically adapted for the IRUS index, using a fixed list of 40 component stocks.
Optimized for Pine Script v6 and complies with TradingView's request limits (max 40).