OPEN-SOURCE SCRIPT

Intraday Sentiment Dynamics

160
The purpose of this script is to create a structured model of intraday sentiment by analyzing how price behaves relative to VWAP. Instead of treating VWAP deviation as a simple overbought or oversold measure, the script aims to understand the dynamics behind that deviation — how quickly sentiment is shifting, whether that shift is strengthening or weakening, and when abrupt changes in behaviour occur. Its goal is to provide a standardized, volatility‑adjusted framework that helps traders identify trend continuation, trend exhaustion, mean‑reversion setups, and early regime shifts.

To achieve this, the script begins by calculating the difference between the bar’s midpoint and VWAP. This raw deviation is then standardized using a rolling mean and standard deviation, producing a z‑score that expresses how far price is from VWAP in statistical terms. Standardization removes volatility bias, session drift, and asset‑specific scaling issues, making the signal comparable across different market conditions. A weighted moving average smooths this standardized deviation to reduce noise and prepare it for slope‑based analysis.
The core of the script is a slope‑normalization mechanism that measures how the standardized VWAP deviation changes over time. For each bar, the script computes the slope over a user‑defined length, separates positive and negative slope events, and maintains these in arrays that track their recent behaviour. From these arrays, it calculates average magnitudes and standard deviations, allowing it to normalize the current slope into a consistent, volatility‑adjusted scale. This ensures that both small and extreme slope events are interpreted meaningfully.

This normalization function is applied recursively to generate three higher‑order derivatives. The first derivative, velocity, represents the rate at which sentiment is moving toward or away from VWAP. The second derivative, acceleration, measures whether this movement is strengthening or weakening. The third derivative, jerk, captures sudden changes in acceleration and serves as an early indicator of shifts in market behaviour. Together, these derivatives form a multi‑layered behavioural model that reveals the internal structure of intraday sentiment.

The script visualizes these components using distinct color families and filled regions that highlight positive and negative behaviour. Background shading reinforces the dominant direction of each derivative, making it easy to see when sentiment is building, fading, or reversing. The standardized VWAP deviation is plotted alongside these derivatives, and horizontal lines at ±1, ±2, and ±3 standard deviations provide a statistical frame of reference for identifying extreme conditions.

In practical trading terms, the indicator helps identify strong continuation environments when velocity, acceleration, and jerk align in the same direction. It highlights early signs of trend exhaustion when jerk flips before acceleration, often preceding reversals. It supports mean‑reversion trades when VWAP deviation reaches extreme levels and the derivative chain begins to weaken. It also detects regime shifts when jerk spikes, helping traders avoid traps during sudden liquidity events or fake breakouts. By converting VWAP deviation into a structured, derivative‑based model, the script provides a clear and actionable view of intraday sentiment dynamics.

Отказ от ответственности

Информация и публикации не предназначены для предоставления и не являются финансовыми, инвестиционными, торговыми или другими видами советов или рекомендаций, предоставленных или одобренных TradingView. Подробнее читайте в Условиях использования.