OPEN-SOURCE SCRIPT

Volume Weighted Trend [QuantAlgo]

546
🟢 Overview

The Volume Weighted Trend indicator identifies statistically significant trend changes by combining volume-weighted price analysis with volatility-based breakout bands. It calculates a Volume Weighted Moving Average (VWMA) as the central trend baseline, then creates dynamic upper and lower bands using Average True Range (ATR) multipliers to define normal volatility boundaries. When price breaks above the upper band or below the lower band, it signals a confirmed trend change, helping traders and investors identify directional shifts driven by both volume-weighted momentum and volatility expansion across different timeframes and markets.
스냅샷
🟢 How It Works

The indicator's core methodology lies in its dual-layer approach combining volume weighting with volatility filtering, where trend changes require both price direction and statistical significance:
Pine Script®
vwma_basis = ta.vwma(close, vwma_length) atr_value = ta.atr(vwma_length) upper_band = vwma_basis + atr_value * atr_multiplier lower_band = vwma_basis - atr_value * atr_multiplier

First, the script calculates the Volume Weighted Moving Average to establish a trend baseline that gives greater weight to periods with higher trading volume, ensuring the trend line reflects significant participation and genuine market conviction rather than low-volume noise.

Then, it measures the Average True Range over the same period to quantify current market volatility:
Pine Script®
atr_value = ta.atr(vwma_length)

Next, dynamic volatility bands are constructed by adding and subtracting ATR-based buffers from the VWMA baseline, creating adaptive boundaries that expand during volatile conditions and contract during calm periods:
Pine Script®
upper_band = vwma_basis + atr_value * atr_multiplier lower_band = vwma_basis - atr_value * atr_multiplier

The trend state is then determined through breakout logic that requires price to exceed these volatility-adjusted boundaries:
Pine Script®
if close > upper_band trend_direction := 1 else if close < lower_band trend_direction := -1

Finally, trend change detection identifies transitions between bullish and bearish states:
Pine Script®
trend_turned_bullish = trend_direction == 1 and trend_direction[1] != 1 trend_turned_bearish = trend_direction == -1 and trend_direction[1] != -1

This creates a robust trend-following system that only signals directional changes when price makes statistically significant moves beyond normal volatility bounds, with volume weighting ensuring the trend reflects meaningful market activity rather than thin-volume spikes.
스냅샷
🟢 Signal Interpretation

▶ Bullish Trend (Price Above Upper Band): When price closes above the upper volatility band, the indicator switches to bullish mode with green/bullish coloring throughout all visual elements = Confirmed uptrend signal for trend-following long positions. The trend remains bullish until price breaks below the lower band, allowing traders to stay positioned during sustained upward momentum without premature exits on minor pullbacks within the band range.

▶ Bearish Trend (Price Below Lower Band): When price closes below the lower volatility band, the indicator switches to bearish mode with red/bearish coloring throughout all visual elements = Confirmed downtrend signal for trend-following short positions or long exit signals. The trend remains bearish until price breaks above the upper band, enabling traders to maintain directional bias through corrective moves that stay within the band boundaries.

▶ Neutral Zone (Price Between Bands): When price trades between the upper and lower volatility bands, the indicator maintains its previous trend direction = Continuation of existing trend during consolidation or normal volatility retracements. This design prevents whipsaws during sideways action by requiring price to make a significant move beyond opposite-side bands to trigger trend reversal, rather than flip-flopping on minor crosses of the VWMA center line.
스냅샷
🟢 Features

▶ Preconfigured Presets: Three optimized parameter sets for different trading approaches and timeframes. "Default" provides balanced trend detection for swing trading on 4-hour and daily charts, filtering noise effectively while capturing meaningful trend changes. "Fast Response" delivers quicker trend signals for intraday trading on 5-minute to 1-hour charts, with tighter bands triggering earlier on breakouts for active traders who can monitor positions closely. "Smooth Trend" focuses on major trend changes for position trading on daily to weekly timeframes, with wider bands filtering out minor fluctuations to identify only primary directional shifts.
스냅샷
▶ Built-in Alerts: Three alert conditions enable automated monitoring of trend changes without constant chart watching. "Bullish Trend Signal" triggers when the indicator switches to bullish mode after price breaks above the upper band, alerting for potential long entries. "Bearish Trend Signal" activates when the indicator switches to bearish mode after price breaks below the lower band, signaling potential short entries or long exits. "Trend Direction Changed" provides a combined alert for any trend transition regardless of direction, allowing traders to monitor both bullish and bearish opportunities with a single alert setup.
스냅샷
▶ Visual Customization: Six color presets (Classic, Aqua, Cosmic, Cyber, Neon, plus Custom) accommodate different chart backgrounds and aesthetic preferences, with coordinated bullish and bearish color schemes applied across all indicator elements. Optional neon glow effect creates layered visual emphasis around the central VWMA line with three overlapping plots at different transparencies, making the trend line more prominent and easier to track (ideal for charts with multiple indicators where visual distinction is important). Optional volatility ribbons display gradient fills between the VWMA and band boundaries, providing visual context for price position relative to breakout thresholds with adjustable band transparency (0-100%) to control prominence. Optional bar coloring tints price bars with trend-appropriate colors during bullish and bearish periods, enabling instant visual confirmation of trend state across multiple timeframes without switching between chart and indicator panels.
스냅샷

면책사항

해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.