OPEN-SOURCE SCRIPT
Market Sentiment Trend Gauge [LevelUp]

Market Sentiment Trend Gauge simplifies technical analysis by mathematically combining momentum, trend direction, volatility position, and comparison against a market benchmark, into a single trend score from -100 to +100. Displayed in a separate pane below your chart, it resolves conflicting signals from RSI, moving averages, Bollinger Bands, and market correlations, providing clear insights into trend direction, strength, and relative performance.
THE PROBLEM MARKET SENTIMENT TREND GAUGE (MSTG) SOLVES
Traditional indicators often produce conflicting signals, such as RSI showing overbought while prices rise or moving averages indicating an uptrend despite market underperformance. MSTG creates a weighted composite score to answer: "What's the overall bias for this asset?"
KEY COMPONENTS AND WEIGHTINGS
The trend score combines
▪ Momentum (25%): Normalized 14-period RSI, capped at ±100.
▪ Trend Direction (35%): 10/21-period EMA relationships,
▪ Volatility Position (20%): Price position, 20-period Bollinger Bands, capped at ±100.
▪ Market Comparison (20%): Daily performance vs. SPY benchmark, capped at ±100.
Final score = Weighted sum, smoothed with 5-period EMA.
INTERPRETING THE MSTG CHART
Trend Score Ranges and Colors
▪ Bright Green (>+30): Strong bullish; ideal for long entries.
▪ Light Green (+10 to +30): Weak bullish; cautiously favorable.
▪ Gray (-10 to +10): Neutral; avoid directional trades.
▪ Light Red (-10 to -30): Weak bearish; exercise caution.
▪ Bright Red (<-30): Strong bearish; high-risk for longs, consider shorts.
Reference Lines
▪ Zero Line (Gray): Separates bullish/bearish; crossovers signal trend changes.
▪ ±30 Lines (Dotted, Green/Red): Thresholds for strong trends.
▪ ±60 Lines (Dashed, Green/Red): Extreme strength zones (not overbought/oversold); manage risk (tighten stops, partial profits) but trends may persist.
Background Colors
▪ Green Tint (>+20): Bullish environment; favorable for longs.
▪ Red Tint (<-20): Bearish environment; caution for longs.
▪ Light Gray Tint (-20 to +20): Neutral/range-bound; wait for signals.
Extreme Readings vs. Traditional Signals
MSTG ±60 indicates maximum alignment of all factors, not reversals (unlike RSI >70/<30). Use for risk management, not automatic exits. Strong trends can sustain extremes; breakdowns occur below +30 or above -30.
INFORMATION TABLE INTERPRETATION
Trend Score Symbols
▲▲ >+30 strong bullish
▲ +10 to +30
● -10 to +10 neutral
▼ -30 to -10
▼▼ <-30 strong bearish
Colors: Green (positive), White (neutral), Red (negative).
Momentum Score
+40 to +100 strong bullish
0 to +40 moderate bullish
-40 to 0 moderate bearish
-100 to -40 strong bearish
Market vs. Stock
▪ Green: Stock outperforming market
▪ Red: Stock underperforming market
Example Interpretations:
-0.45% / +1.23% (Green): Market down, stock up = Strong relative strength
+2.10% / +1.50% (Red): Both rising, but stock lagging = Relative weakness
-1.20% / -0.80% (Green): Both falling, but stock declining less = Defensive strength
UNDERSTANDING EXTREME READINGS VS TRADITIONAL OVERBOUGHT/OVERSOLD
⚠️ Critical distinctions
Traditional Overbought/Oversold Signals:
▪ Single indicator (like RSI >70 or <30) showing momentum excess
▪ Often suggests immediate reversal or pullback expected
▪ Based on "price moved too far, too fast" concept
MSTG Extreme Readings (±60):
▪ Composite alignment of 4 different factors (momentum, trend, volatility, relative strength)
▪ Indicates maximum strength in current direction
▪ NOT a reversal signal - means "all systems extremely bullish/bearish"
Key Differences:
▪ RSI >70: "Price got ahead of itself, expect pullback"
▪ MSTG >+60: "Everything is extremely bullish right now"
▪ Strong trends can maintain extreme MSTG readings during major moves
▪ Breakdowns happen when MSTG falls below +30, not at +60
Proper Usage of Extreme Readings:
▪ Risk Management: Tighten stops, take partial profits
▪ Position Sizing: Reduce new position sizes at extremes
▪ Trend Continuation: Watch for sustained extreme readings in strong markets
▪ Exit Signals: Look for breakdown below +30, not reversal from +60
TRADING WITH MSTG
Quick Assessment
1. Check trend symbol for direction.
2. Confirm momentum strength.
3. Note relative performance color.
Examples:
▲▲ 55.2 (Green), Momentum +28.4, Outperforming: Strong buy setup.
▼ -18.6 (Red), Momentum -43.2, Underperforming: Defensive positioning.
Entry Conditions
▪ Long: stock outperforming market
- Score >+30 (bright green)
- Sustained green background
- ▲▲ symbol,
▪ Short: stock underperforming market
- Score <-30 (bright red)
- Sustained red background
- ▼▼ symbol
Avoid Trading When:
▪ Gray zone (-10 to +10).
▪ Rapid color changes or frequent zero-line crosses (choppy market).
▪ Gray background (range-bound).
Risk Management:
▪ Stop Loss: Exit on zero-line crossover against position.
▪ Take Profit: Partial at ±60 for risk control.
▪ Position Sizing: Larger when signals align; smaller in extremes or mixed conditions.
KEY ADVANTAGES
▪ Unified View: Weighted composite reduces noise and conflicts.
▪ Visual Clarity: 5-color system with gradients for rapid recognition.
▪ Market Context: Relative strength vs. SPY identifies leaders/laggards.
▪ Flexibility: Works across timeframes (1-min to weekly); customizable table.
▪ Noise Reduction: EMA smoothing minimizes false signals.
EXAMPLES
Strong Bull: Trend Score 71.9, Momentum Score 76.9

Neutral: Trend Score 0.1, Momentum Score -9.2

Strong Bear: Trend Score -51.7, Momentum Score -51.5

PERFORMANCE AND LIMITATIONS
Strengths: Trend identification, noise reduction, relative performance versus market.
Limitations: Lags at turning points, less effective in extreme volatility or non-trending markets.
Recommendations: View on multiple timeframes, combine with price action and fundamentals.
THE PROBLEM MARKET SENTIMENT TREND GAUGE (MSTG) SOLVES
Traditional indicators often produce conflicting signals, such as RSI showing overbought while prices rise or moving averages indicating an uptrend despite market underperformance. MSTG creates a weighted composite score to answer: "What's the overall bias for this asset?"
KEY COMPONENTS AND WEIGHTINGS
The trend score combines
▪ Momentum (25%): Normalized 14-period RSI, capped at ±100.
▪ Trend Direction (35%): 10/21-period EMA relationships,
▪ Volatility Position (20%): Price position, 20-period Bollinger Bands, capped at ±100.
▪ Market Comparison (20%): Daily performance vs. SPY benchmark, capped at ±100.
Final score = Weighted sum, smoothed with 5-period EMA.
INTERPRETING THE MSTG CHART
Trend Score Ranges and Colors
▪ Bright Green (>+30): Strong bullish; ideal for long entries.
▪ Light Green (+10 to +30): Weak bullish; cautiously favorable.
▪ Gray (-10 to +10): Neutral; avoid directional trades.
▪ Light Red (-10 to -30): Weak bearish; exercise caution.
▪ Bright Red (<-30): Strong bearish; high-risk for longs, consider shorts.
Reference Lines
▪ Zero Line (Gray): Separates bullish/bearish; crossovers signal trend changes.
▪ ±30 Lines (Dotted, Green/Red): Thresholds for strong trends.
▪ ±60 Lines (Dashed, Green/Red): Extreme strength zones (not overbought/oversold); manage risk (tighten stops, partial profits) but trends may persist.
Background Colors
▪ Green Tint (>+20): Bullish environment; favorable for longs.
▪ Red Tint (<-20): Bearish environment; caution for longs.
▪ Light Gray Tint (-20 to +20): Neutral/range-bound; wait for signals.
Extreme Readings vs. Traditional Signals
MSTG ±60 indicates maximum alignment of all factors, not reversals (unlike RSI >70/<30). Use for risk management, not automatic exits. Strong trends can sustain extremes; breakdowns occur below +30 or above -30.
INFORMATION TABLE INTERPRETATION
Trend Score Symbols
▲▲ >+30 strong bullish
▲ +10 to +30
● -10 to +10 neutral
▼ -30 to -10
▼▼ <-30 strong bearish
Colors: Green (positive), White (neutral), Red (negative).
Momentum Score
+40 to +100 strong bullish
0 to +40 moderate bullish
-40 to 0 moderate bearish
-100 to -40 strong bearish
Market vs. Stock
▪ Green: Stock outperforming market
▪ Red: Stock underperforming market
Example Interpretations:
-0.45% / +1.23% (Green): Market down, stock up = Strong relative strength
+2.10% / +1.50% (Red): Both rising, but stock lagging = Relative weakness
-1.20% / -0.80% (Green): Both falling, but stock declining less = Defensive strength
UNDERSTANDING EXTREME READINGS VS TRADITIONAL OVERBOUGHT/OVERSOLD
⚠️ Critical distinctions
Traditional Overbought/Oversold Signals:
▪ Single indicator (like RSI >70 or <30) showing momentum excess
▪ Often suggests immediate reversal or pullback expected
▪ Based on "price moved too far, too fast" concept
MSTG Extreme Readings (±60):
▪ Composite alignment of 4 different factors (momentum, trend, volatility, relative strength)
▪ Indicates maximum strength in current direction
▪ NOT a reversal signal - means "all systems extremely bullish/bearish"
Key Differences:
▪ RSI >70: "Price got ahead of itself, expect pullback"
▪ MSTG >+60: "Everything is extremely bullish right now"
▪ Strong trends can maintain extreme MSTG readings during major moves
▪ Breakdowns happen when MSTG falls below +30, not at +60
Proper Usage of Extreme Readings:
▪ Risk Management: Tighten stops, take partial profits
▪ Position Sizing: Reduce new position sizes at extremes
▪ Trend Continuation: Watch for sustained extreme readings in strong markets
▪ Exit Signals: Look for breakdown below +30, not reversal from +60
TRADING WITH MSTG
Quick Assessment
1. Check trend symbol for direction.
2. Confirm momentum strength.
3. Note relative performance color.
Examples:
▲▲ 55.2 (Green), Momentum +28.4, Outperforming: Strong buy setup.
▼ -18.6 (Red), Momentum -43.2, Underperforming: Defensive positioning.
Entry Conditions
▪ Long: stock outperforming market
- Score >+30 (bright green)
- Sustained green background
- ▲▲ symbol,
▪ Short: stock underperforming market
- Score <-30 (bright red)
- Sustained red background
- ▼▼ symbol
Avoid Trading When:
▪ Gray zone (-10 to +10).
▪ Rapid color changes or frequent zero-line crosses (choppy market).
▪ Gray background (range-bound).
Risk Management:
▪ Stop Loss: Exit on zero-line crossover against position.
▪ Take Profit: Partial at ±60 for risk control.
▪ Position Sizing: Larger when signals align; smaller in extremes or mixed conditions.
KEY ADVANTAGES
▪ Unified View: Weighted composite reduces noise and conflicts.
▪ Visual Clarity: 5-color system with gradients for rapid recognition.
▪ Market Context: Relative strength vs. SPY identifies leaders/laggards.
▪ Flexibility: Works across timeframes (1-min to weekly); customizable table.
▪ Noise Reduction: EMA smoothing minimizes false signals.
EXAMPLES
Strong Bull: Trend Score 71.9, Momentum Score 76.9
Neutral: Trend Score 0.1, Momentum Score -9.2
Strong Bear: Trend Score -51.7, Momentum Score -51.5
PERFORMANCE AND LIMITATIONS
Strengths: Trend identification, noise reduction, relative performance versus market.
Limitations: Lags at turning points, less effective in extreme volatility or non-trending markets.
Recommendations: View on multiple timeframes, combine with price action and fundamentals.
Skrip open-source
Dengan semangat TradingView yang sesungguhnya, penulis skrip ini telah menjadikannya sumber terbuka, sehingga para trader dapat meninjau dan memverifikasi fungsinya. Hormat untuk penulisnya! Meskipun anda dapat menggunakannya secara gratis, ingatlah bahwa penerbitan ulang kode tersebut tunduk pada Tata Tertib kami.
Access our premium tools: LevelUpTools.net
Join traders in over 40 countries and LevelUp!
Join traders in over 40 countries and LevelUp!
Pernyataan Penyangkalan
Informasi dan publikasi tidak dimaksudkan untuk menjadi, dan bukan merupakan saran keuangan, investasi, perdagangan, atau rekomendasi lainnya yang diberikan atau didukung oleh TradingView. Baca selengkapnya di Persyaratan Penggunaan.
Skrip open-source
Dengan semangat TradingView yang sesungguhnya, penulis skrip ini telah menjadikannya sumber terbuka, sehingga para trader dapat meninjau dan memverifikasi fungsinya. Hormat untuk penulisnya! Meskipun anda dapat menggunakannya secara gratis, ingatlah bahwa penerbitan ulang kode tersebut tunduk pada Tata Tertib kami.
Access our premium tools: LevelUpTools.net
Join traders in over 40 countries and LevelUp!
Join traders in over 40 countries and LevelUp!
Pernyataan Penyangkalan
Informasi dan publikasi tidak dimaksudkan untuk menjadi, dan bukan merupakan saran keuangan, investasi, perdagangan, atau rekomendasi lainnya yang diberikan atau didukung oleh TradingView. Baca selengkapnya di Persyaratan Penggunaan.