All indicators

VWAP and BB strategy

Sep 20, 2020

Static chart image
Volume BasedSignalsChannelsMoney ManagementMoving AveragesVolatility

The VWAP and BB strategy indicator is a comprehensive trading tool that identifies trend-following entry points by combining volume-weighted price analysis with mean reversion volatility bands. It aims to capture long positions when the price shows strength relative to the session average while recovering from recent oversold conditions within a trending environment.

Usage

The strategy is primarily designed for long-only positions, utilizing a combination of trend filters and volatility breakouts. Users can monitor the interaction between the price, the VWAP, and the Bollinger Bands to determine entry and exit points.

The core logic for a long entry involves:

  • Trend Confirmation: The Fast EMA must be above the Slow EMA, and the price must be trading above the VWAP.
  • Dip Detection: The script looks for a recent "dip" where the price touched or crossed the Lower Bollinger Band within the last 10 candles, signaling a potential mean reversion opportunity within a larger uptrend.
  • Take Profit: A position is typically closed when the price crosses above the Upper Bollinger Band.
  • Position Management: The strategy allows for "pyramiding" or adding to an existing position if the price pulls back toward the VWAP while maintaining the overall bullish structure.

Details

The script integrates three primary technical components:

  1. Exponential Moving Averages (EMA): Used to define the macro trend direction. By default, it checks the relationship between a fast and slow EMA.
  2. Volume Weighted Average Price (VWAP): Serves as a dynamic benchmark for value. The strategy requires the price to be above this level to ensure bullish momentum.
  3. Bollinger Bands (BB): Used to identify volatility extremes. The strategy includes a custom function isPriceDippedBb to scan historical bars for a touch of the lower band, ensuring the entry happens after a temporary retracement.

The strategy also offers two calculation methods for the "dip" condition: standard price interaction with the bands or a calculation based on the %B (percentage bandwidth) oscillator.

Settings

Moving Averages

  • Fast EMA: Sets the length for the faster trend-tracking moving average.
  • Slow EMA: Sets the length for the slower trend-tracking moving average.

Bollinger Bands

  • BB SMA Length: The period used for the middle band (SMA) calculation.
  • BB Source: The price source used for Bollinger Band calculations (default is Close).
  • StdDev: The multiplier for the standard deviation to determine band width.
  • Offset: Shifts the Bollinger Bands forward or backward on the chart.

Strategy Settings

  • Strategy To Use: Choose between "BB" (price-based dip detection) or "BB_percentageB" (using %B oscillator logic).
  • Stop Loss %: Sets the percentage-based stop loss from the average entry price.

FAQ

How do I interpret the blue bars on the chart?

The blue bar coloring indicates that the strategy currently has an active long position.

What is the purpose of the "Add" signal?

The "Add" signal allows the strategy to increase the position size if the price remains above the VWAP but drops below the average entry price, effectively scaling into a winning trend during pullbacks.

How can I access the VWAP and BB strategy?

You can get access on the LuxAlgo Library for charting platforms like TradingView, MetaTrader (MT4/MT5), and NinjaTrader for free.

Free indicator

Get free access to this indicator on the platforms below.

TradingView
NinjaTrader
MetaTrader 4/5

Unlock the entire LuxAlgo Library

Every indicator, every strategy, full charts, and complete access to Quant — our AI agent.