Market Sentiment Oscillator

Overview
The Market Sentiment Oscillator is a Pine Script v6 indicator for TradingView that assesses market context with a composite oscillator. It blends MACD, RSI, and Volume Price Trend (VPT) into a normalized score, with optional multi-timeframe (MTF) averaging and optional trail lines to visualize recent extremes. Weighting and normalization are used to keep the scale consistent across symbols and timeframes. A compact status table summarizes sentiment, trend, and turning-point markers.
How It Works
• Composite score: finalScore = 0.4 · MACD_hist + 0.4 · ((RSI − 50)/50) + 0.2 · VPT_norm. MACD/RSI emphasize momentum; VPT_norm (z-score of a cumulative VPT) adds volume context.
• MTF (optional): The same score is computed on a higher timeframe (default: 1H) and averaged with the chart-TF score for broader context. MTF requests use lookahead_off.
• Neutral buffer: Readings within ±0.2 (default) are treated as neutral to reduce noise.
• Markers: Early turning points are labeled Hypothetical; labels switch to Verified after a fixed bar count.
• Trails (visual only): Lines connect recent extreme highs/lows of the oscillator, with optional dashed previews and short forward extensions for illustration.
Key Features
• Composite Sentiment Score: Structured blend of MACD, RSI, and normalized VPT.
• Multi-Timeframe Context: Optional averaging with a higher timeframe score.
• Visual Trails: Extreme-to-extreme lines and optional previews for context (charting aid).
• Adaptive Coloring: Gradient or solid coloring based on direction and magnitude.
• Turning-Point Markers: Hypothetical and Verified labels for tops/bottoms.
• Status Table: Summarizes sentiment state, trend, and recent turning-point info.
• Customizable: MACD/RSI/VPT inputs, neutral zone, colors, visibility.
What It Displays
A composite, normalized view of momentum and volume context, with optional higher-timeframe blending and visual trails to help interpret shifts between bearish, neutral, and bullish conditions.
Originality
Original Pine v6 implementation using TradingView built-ins: ta.macd, ta.rsi, ta.cum, ta.sma, ta.stdev, ta.pivothigh, ta.pivotlow, and request.security.
Common Uses
• Reviewing momentum context alongside volume influence.
• Illustrating shifts between bearish/neutral/bullish conditions.
• Adding higher-timeframe context to a lower-timeframe view.
Configuration Notes
Set MACD (default 12/26/9), RSI (default 14), and VPT options. Choose a higher timeframe (default 1H) if using MTF. Adjust the neutral zone (default ±0.2), coloring mode, and visibility of trails and table.
Repainting & Limitations
• MTF: Uses lookahead_off to avoid higher-timeframe repainting.
• Pivots/labels: Turning-point pivots are verified only after the required right bars close; “Hypothetical” labels are early and may update intra-bar.
• Trails/previews: Visual aids only; previews and short forward extensions can update while a bar is forming.
Legal Disclaimer
This indicator is for informational and educational purposes only—not investment, financial, or trading advice. Past performance does not guarantee future results; trading involves risk of loss. Provided “as is” without warranties. Consult a qualified professional before making decisions.
نص برمجي للمستخدمين المدعوين فقط
يمكن فقط للمستخدمين الذين تمت الموافقة عليهم من قبل المؤلف الوصول إلى هذا البرنامج النصي. ستحتاج إلى طلب الإذن والحصول عليه لاستخدامه. يتم منح هذا عادةً بعد الدفع. لمزيد من التفاصيل، اتبع تعليمات المؤلف أدناه أو اتصل TradingScriptSolutions مباشرة.
لا توصي TradingView بالدفع مقابل برنامج نصي أو استخدامه إلا إذا كنت تثق تمامًا في مؤلفه وتفهم كيفية عمله. يمكنك أيضًا العثور على بدائل مجانية ومفتوحة المصدر في نصوص مجتمعنا.
تعليمات المؤلف
إخلاء المسؤولية
نص برمجي للمستخدمين المدعوين فقط
يمكن فقط للمستخدمين الذين تمت الموافقة عليهم من قبل المؤلف الوصول إلى هذا البرنامج النصي. ستحتاج إلى طلب الإذن والحصول عليه لاستخدامه. يتم منح هذا عادةً بعد الدفع. لمزيد من التفاصيل، اتبع تعليمات المؤلف أدناه أو اتصل TradingScriptSolutions مباشرة.
لا توصي TradingView بالدفع مقابل برنامج نصي أو استخدامه إلا إذا كنت تثق تمامًا في مؤلفه وتفهم كيفية عمله. يمكنك أيضًا العثور على بدائل مجانية ومفتوحة المصدر في نصوص مجتمعنا.