OPEN-SOURCE SCRIPT
Smart Money vs Retail Osc

What This Indicator Does-
The Smart Money vs Retail Oscillator tries to answer one question on every bar: who is controlling price right now — institutions or retail traders? It does this by splitting volume into directional flows, smoothing them at two different speeds, and plotting the difference as two lines. When those lines cross, it signals a potential shift in control.
The Core Idea: Two Speeds of Volume-
The entire indicator is built on one insight — institutions and retail traders behave differently in volume.
Smart Money (institutions) acts fast. When a large fund decides to accumulate or distribute, it moves volume in sharp, decisive bursts. A short EMA captures this.
Retail traders act slow. They chase price, react to news, and pile in after a move is already underway. A long EMA captures this lag.
By measuring the same thing (directional volume bias) at two different speeds, the gap between the two lines reveals who is leading the current move.
Step 1 — Volume Decomposition
Every bar's volume is classified as either bullish or bearish based on whether the candle closed up or down. This is a simplified but effective proxy — a green candle's volume is attributed to buyers, a red candle's to sellers. There is no partial split; each bar is fully assigned to one side.
Step 2 — The Two Oscillators
Smart Money (Yellow Line):
Uses a 7-period EMA. The result is a ratio between -1 and +1 — positive when bulls dominate short-term volume, negative when bears do. The division by total EMA normalizes for overall volume level, so a high-volume session doesn't automatically appear more bullish.
Retail (Purple Line):
Uses a 21-period EMA — exactly 3× slower. By the time this line shifts, the smart money line has already reacted and often reversed. The gap between them, both in timing and direction, is the signal.
Step 3 — Normalization to a 0–3 Scale
Raw ratios are hard to read visually and vary across instruments. Both lines are normalised using a 100-bar rolling window:
Yellow line (SM) is scaled to the full 0–3 range — it swings freely from bottom to top, showing extremes clearly. A reading near 3.0 means SM volume is as bullish as it has been in the last 100 bars. Near 0.0 means maximum bearishness.
Purple line (RT) is compressed to 0.8–2.2 — it never reaches the extremes. This is intentional. Retail sentiment is naturally more stable and mean-reverting. Compressing it into the middle band means:
When yellow is above purple, SM is more bullish than retail → institutions are leading bulls
When yellow is below purple, SM is more bearish than retail → institutions are leading bears
When they overlap, neither side has conviction
Step 4 — The Crossover Signals (Triangles)
This is the primary output most traders use.
Green triangle (▲) — Yellow crosses above purple. Smart Money volume bias has overtaken Retail volume bias. Institutions are now leading to the upside. This tends to appear before a price move rather than during it, because SM acts faster.
Red triangle (▼) — Yellow crosses below purple. Smart Money has flipped bearish relative to Retail. Institutions are now leading to the downside, or distributing into retail buying.
The threshold (sig_thresh, default 0.15) is the minimum gap between the two lines at the moment of crossing. This filters out tangential crosses where the lines barely graze each other and immediately reverse — those are noise, not signals. Set it lower (toward 0.01) and nearly every crossing will produce a triangle. Set it higher (toward 0.20) and only strong, decisive crossovers fire.
The threshold doesn't affect when a cross happens — it only decides whether that cross is significant enough to plot.
Step 5 — Regime Detection
pinereg_label =
adx > 22 and vol_ratio > 1.1 ? "TREND" :
vol_ratio > 1.8 and adx < 22 ? "MANIP" :
adx < 14 and vol_ratio < 0.85 ? "CHOP" :
adx < 18 and vol_ratio < 0.95 ? "RANGE" : "TREND"
The regime classifies the type of market you're in, using two inputs:
ADX (14) — measures trend strength, not direction. High ADX = strong trend. Low ADX = directionless.
Vol ratio — current bar's volume vs its 14-bar SMA. Greater than 1.0 = above-average volume.
Label Meaning Implication for signals TREND ADX > 22, volume elevated Crossover signals are most reliable here RANGE ADX < 18, volume low Signals work but moves are shallower CHOP ADX very low, volume very low Both lines oscillate randomly — treat signals with caution MANIP(manipulation) Volume spike but ADX low Large volume without directional conviction — often stop hunts or news spikes. Most unreliable.
Step 6 — Control State
This is a real-time label derived directly from the gap between the two lines right now (not just at crossovers). It answers: who is currently in control, even between crossover signals?
SMART — yellow is meaningfully above purple. Institutions have the upper hand.
RETAIL — purple is meaningfully above yellow. Retail sentiment is dominating, often a sign of late-stage moves.
BALANCE — the lines are within threshold of each other. No clear dominance — a crossover may be imminent.
Step 7 — Trend Bias
A simple EMA 20/50 crossover on price (not volume). This gives the indicator directional context — the table shows BUY or SELL to indicate which side the medium-term price trend favors. It doesn't suppress signals but helps you decide which crossover signals to act on: buy triangles in a BUY regime, sell triangles in a SELL regime.
Step 8 — Status (EXIT Detection)
ta.cross fires on any crossing (both over and under). When it fires, STS flips to EXIT for that bar, flagging that a position entered on the previous signal may now want to be closed. This also triggers the pink background band (alongside high-volume bars), making exit zones visually obvious on the chart.
Step 9 — Pink Background Bands
The fuchsia/pink background appears in two situations:
Volume spike — the bar's volume is more than 1.8× its average. These bars often mark institutional entries, reversals, or trap moves. Worth watching regardless of the line positions.
Line crossover — any cross between yellow and purple. Confirms the triangle signal visually at the bar level, making the transition easy to spot even without looking at the triangle markers.
How to Read It in Practice?
Bullish setup: Yellow line is below purple → starts rising → crosses above purple → green triangle appears → CTRL flips to SMART → TREND shows BUY → REG shows TREND. All four aligned = high-conviction long signal.
Bearish setup: Yellow line is above purple → starts falling → crosses below purple → red triangle appears → CTRL flips to RETAIL (retail is now leading, SM has stepped back) → TREND shows SELL → REG shows TREND. All four aligned = high-conviction short signal.
Exit: A pink band appears on a crossover bar — STS flips to EXIT. This is the indicator telling you the dynamic between SM and Retail has shifted, and the reason you entered the trade may no longer be valid.
Ignore: REG shows MANIP and a triangle fires. Volume spiked but ADX is low — likely a stop hunt or news-driven move with no follow-through. The indicator will still draw the triangle, but the regime label is your warning to stay out.
Disclaimer: This indicator is for educational purposes only. Always practice proper risk management and combine with your own analysis before making trading decisions. Happy trading.
The Smart Money vs Retail Oscillator tries to answer one question on every bar: who is controlling price right now — institutions or retail traders? It does this by splitting volume into directional flows, smoothing them at two different speeds, and plotting the difference as two lines. When those lines cross, it signals a potential shift in control.
The Core Idea: Two Speeds of Volume-
The entire indicator is built on one insight — institutions and retail traders behave differently in volume.
Smart Money (institutions) acts fast. When a large fund decides to accumulate or distribute, it moves volume in sharp, decisive bursts. A short EMA captures this.
Retail traders act slow. They chase price, react to news, and pile in after a move is already underway. A long EMA captures this lag.
By measuring the same thing (directional volume bias) at two different speeds, the gap between the two lines reveals who is leading the current move.
Step 1 — Volume Decomposition
Every bar's volume is classified as either bullish or bearish based on whether the candle closed up or down. This is a simplified but effective proxy — a green candle's volume is attributed to buyers, a red candle's to sellers. There is no partial split; each bar is fully assigned to one side.
Step 2 — The Two Oscillators
Smart Money (Yellow Line):
Uses a 7-period EMA. The result is a ratio between -1 and +1 — positive when bulls dominate short-term volume, negative when bears do. The division by total EMA normalizes for overall volume level, so a high-volume session doesn't automatically appear more bullish.
Retail (Purple Line):
Uses a 21-period EMA — exactly 3× slower. By the time this line shifts, the smart money line has already reacted and often reversed. The gap between them, both in timing and direction, is the signal.
Step 3 — Normalization to a 0–3 Scale
Raw ratios are hard to read visually and vary across instruments. Both lines are normalised using a 100-bar rolling window:
Yellow line (SM) is scaled to the full 0–3 range — it swings freely from bottom to top, showing extremes clearly. A reading near 3.0 means SM volume is as bullish as it has been in the last 100 bars. Near 0.0 means maximum bearishness.
Purple line (RT) is compressed to 0.8–2.2 — it never reaches the extremes. This is intentional. Retail sentiment is naturally more stable and mean-reverting. Compressing it into the middle band means:
When yellow is above purple, SM is more bullish than retail → institutions are leading bulls
When yellow is below purple, SM is more bearish than retail → institutions are leading bears
When they overlap, neither side has conviction
Step 4 — The Crossover Signals (Triangles)
This is the primary output most traders use.
Green triangle (▲) — Yellow crosses above purple. Smart Money volume bias has overtaken Retail volume bias. Institutions are now leading to the upside. This tends to appear before a price move rather than during it, because SM acts faster.
Red triangle (▼) — Yellow crosses below purple. Smart Money has flipped bearish relative to Retail. Institutions are now leading to the downside, or distributing into retail buying.
The threshold (sig_thresh, default 0.15) is the minimum gap between the two lines at the moment of crossing. This filters out tangential crosses where the lines barely graze each other and immediately reverse — those are noise, not signals. Set it lower (toward 0.01) and nearly every crossing will produce a triangle. Set it higher (toward 0.20) and only strong, decisive crossovers fire.
The threshold doesn't affect when a cross happens — it only decides whether that cross is significant enough to plot.
Step 5 — Regime Detection
pinereg_label =
adx > 22 and vol_ratio > 1.1 ? "TREND" :
vol_ratio > 1.8 and adx < 22 ? "MANIP" :
adx < 14 and vol_ratio < 0.85 ? "CHOP" :
adx < 18 and vol_ratio < 0.95 ? "RANGE" : "TREND"
The regime classifies the type of market you're in, using two inputs:
ADX (14) — measures trend strength, not direction. High ADX = strong trend. Low ADX = directionless.
Vol ratio — current bar's volume vs its 14-bar SMA. Greater than 1.0 = above-average volume.
Label Meaning Implication for signals TREND ADX > 22, volume elevated Crossover signals are most reliable here RANGE ADX < 18, volume low Signals work but moves are shallower CHOP ADX very low, volume very low Both lines oscillate randomly — treat signals with caution MANIP(manipulation) Volume spike but ADX low Large volume without directional conviction — often stop hunts or news spikes. Most unreliable.
Step 6 — Control State
This is a real-time label derived directly from the gap between the two lines right now (not just at crossovers). It answers: who is currently in control, even between crossover signals?
SMART — yellow is meaningfully above purple. Institutions have the upper hand.
RETAIL — purple is meaningfully above yellow. Retail sentiment is dominating, often a sign of late-stage moves.
BALANCE — the lines are within threshold of each other. No clear dominance — a crossover may be imminent.
Step 7 — Trend Bias
A simple EMA 20/50 crossover on price (not volume). This gives the indicator directional context — the table shows BUY or SELL to indicate which side the medium-term price trend favors. It doesn't suppress signals but helps you decide which crossover signals to act on: buy triangles in a BUY regime, sell triangles in a SELL regime.
Step 8 — Status (EXIT Detection)
ta.cross fires on any crossing (both over and under). When it fires, STS flips to EXIT for that bar, flagging that a position entered on the previous signal may now want to be closed. This also triggers the pink background band (alongside high-volume bars), making exit zones visually obvious on the chart.
Step 9 — Pink Background Bands
The fuchsia/pink background appears in two situations:
Volume spike — the bar's volume is more than 1.8× its average. These bars often mark institutional entries, reversals, or trap moves. Worth watching regardless of the line positions.
Line crossover — any cross between yellow and purple. Confirms the triangle signal visually at the bar level, making the transition easy to spot even without looking at the triangle markers.
How to Read It in Practice?
Bullish setup: Yellow line is below purple → starts rising → crosses above purple → green triangle appears → CTRL flips to SMART → TREND shows BUY → REG shows TREND. All four aligned = high-conviction long signal.
Bearish setup: Yellow line is above purple → starts falling → crosses below purple → red triangle appears → CTRL flips to RETAIL (retail is now leading, SM has stepped back) → TREND shows SELL → REG shows TREND. All four aligned = high-conviction short signal.
Exit: A pink band appears on a crossover bar — STS flips to EXIT. This is the indicator telling you the dynamic between SM and Retail has shifted, and the reason you entered the trade may no longer be valid.
Ignore: REG shows MANIP and a triangle fires. Volume spiked but ADX is low — likely a stop hunt or news-driven move with no follow-through. The indicator will still draw the triangle, but the regime label is your warning to stay out.
Disclaimer: This indicator is for educational purposes only. Always practice proper risk management and combine with your own analysis before making trading decisions. Happy trading.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.