OPEN-SOURCE SCRIPT

Uptrick: Volume Weighted Bands

6 900
Introduction
This indicator, Uptrick: Volume Weighted Bands, overlays dynamic, volume-informed trend channels directly on the chart. By fusing price and volume data through volume-weighted and exponential moving averages, the script forms a core trend line with adaptive bandwidth controlled by volatility. It is designed to help traders identify trend direction, breakout entries, and extended conditions that may warrant take-profits or pullback re-entries.

Overview
The Volume Weighted Bands system is built around a trend line calculated by averaging a Volume Weighted Moving Average (VWMA) and an Exponential Moving Average (EMA), both over a configurable lookback period. This hybrid trend baseline is then smoothed further and expanded into dynamic upper and lower bands using an Average True Range (ATR) multiplier. These bands adapt with market volatility and shift color based on prevailing price action, helping traders quickly identify bullish, bearish, or neutral conditions.

Originality and Unique Features
This script introduces originality by blending both price and volume in the core trend calculation, a technique that is more responsive than traditional moving average bands. Its multi-mode visualization (cloud, single-band, or line-only), combined with selective buy/sell signals, makes it flexible for discretionary and algorithmic strategies alike. Optional modules for take-profit signals based on z-score deviation and RSI slope, as well as buy-back detection logic with cooldown filters, offer practical tools for managing trades beyond simple entries.

Explanation of Inputs
Every user input in this script is included to give the trader control over behavior and visual presentation:
  • Trend Length (len): Defines the lookback window for both the VWMA and EMA, controlling the sensitivity of the core trend baseline. A lower value makes the bands more reactive, while a higher value smooths out short-term noise.

  • Extra Smoothing (smoothLen): Applies an additional EMA to the blended VWMA/EMA average. This second-level smoothing ensures the central trend line reacts gradually to shifts in price.

  • Band Width (ATR Multiplier) (bandMult): Multiplies the ATR to create the width of the upper and lower bands around the trend line. Larger values widen the bands, capturing more volatility, while smaller values narrow them.

  • ATR Length (atrLen): Sets the length of the ATR used in calculating band width and signal offsets. Longer values produce smoother band boundaries.

  • Show Buy/Sell Signals (showSignals): Toggles the primary crossover/crossunder entry signals, which are labeled when the close crosses the upper or lower band.

  • Visual Mode (visualMode): Allows selection between three display modes:

    --> Cloud: Shows both bands and the central trend line with a shaded background.

    スナップショット

    --> Single Band: Displays only the active (upper or lower) band depending on trend state, with gradient fill to price.

    スナップショット

    --> Line Only: Shows only the trend line for a minimal visual profile.

    スナップショット
  • Take Profit Signals (enableTP): Enables a z-score-based profit-taking signal system. Signals occur when price deviates significantly from the trend line and RSI confirms exhaustion.

  • TP Z-Score Threshold (tpThreshold): Sets the z-score deviation required to trigger a take-profit signal. Higher values reduce the frequency of signals, focusing on more extreme moves.

  • Re-Entries (enableBuyBack): Enables logic to signal when price reverts into the band after an initial breakout, suggesting a possible re-entry or pullback setup.

  • Buy Back Cooldown (bars) (buyBackCooldown): Defines a minimum bar count before a new buy-back signal is allowed, preventing rapid retriggering in choppy conditions.

  • Buy Offset and Sell Offset: Hidden inputs used to vertically adjust the placement of the Buy ("𝓤𝓹") and Sell ("𝓓𝓸𝔀𝓷") labels relative to the bands. These use ATR units to maintain proportionality across different instruments and timeframes.


Take-Profit Signal Module
The take-profit module uses a z-score of the distance between price and the trend line to detect extended conditions. In bullish trends, a signal appears when price is well above the band and RSI indicates exhaustion; the opposite applies for bearish conditions. A boolean flag is used to prevent retriggering until RSI resets. These signals are plotted with minimalist “X” markers near recent highs or lows, based on whether the market is extended upward or downward.

スナップショット

Re-Entry Logic
The re-entry system identifies instances where price momentarily dips or spikes into the opposite band but closes back inside, implying a continuation of the prevailing trend. This module can be particularly useful for traders managing entries after brief pullbacks. A built-in cooldown period helps filter out noise and prevents signal overloading during fast markets. Visual markers are shown as upward or downward arrows near the relevant candle wicks.

スナップショット

How to Use This Indicator
The basic usage of this indicator follows a directional, signal-driven approach. When a buy signal appears, it suggests entering a long position. The recommended stop loss placement is below the lower band, allowing for some breathing space to accommodate natural volatility. As the position progresses, take partial profits—typically 10% to 15% of the position—each time a take-profit signal (marked with an "X") is shown on the chart.

An optional feature is the buy-back signal, which can be used to re-enter after partial exits or missed entries. Utilizing this can help reduce losses during false breakouts or trend reversals by scaling in more gradually. However, it also means that in strong, clean trends, the full position may not be captured from the start, potentially reducing the total return. It is up to the trader to decide whether to enter fully on the initial signal or incrementally using buy-backs.

When a sell signal appears, the strategy advises fully exiting any long positions and immediately switching to a short position. The short trade follows the same logic: place your stop loss above the upper band with some margin, and again, take partial profits at each take-profit signal.

スナップショット

Visual Presentation and Signal Labels
All signals are plotted with clean, minimal labels that avoid clutter, and are color-coded using a custom palette designed to remain clear across light and dark chart themes. Bullish trends are marked in teal and bearish trends in magenta. Candles and wicks are also colored accordingly to align price action with the detected trend state. Buy and sell entries are marked with "𝓤𝓹" and "𝓓𝓸𝔀𝓷" labels.

Summary
In summary, the Uptrick: Volume Weighted Bands indicator provides a versatile, visually adaptive trend and volatility tool that can serve multiple styles of trading. Through its integration of price, volume, and volatility, along with modular take-profit and buy-back signaling, it aims to provide actionable structure across a range of market conditions.

Disclaimer
This indicator is for educational purposes only. Trading involves risk, and past performance does not guarantee future results. Always test strategies before applying them in live markets.

免責事項

これらの情報および投稿は、TradingViewが提供または保証する金融、投資、取引、またはその他の種類のアドバイスや推奨を意図したものではなく、またそのようなものでもありません。詳しくは利用規約をご覧ください。