All indicators

Machine Learning: VWAP

Oct 31, 2023

Static chart image
Volume BasedSignalsMachine LearningVolatility

The Machine Learning: VWAP indicator uses machine learning algorithms to dynamically identify optimal anchor points for the Volume Weighted Average Price (VWAP). By analyzing price action and volume through lookback lengths amplified by ML logic, the tool aims to reset anchors at crucial trend shifts, providing adaptive overbought and oversold levels similar to Bollinger Bands but with parabolic expansion capabilities.

Usage

The Usage section describes how the script can be used to identify trend direction and momentum shifts. Unlike standard VWAPs that reset on fixed time intervals, this tool resets when price exceeds historical extremes (Highest High/Lowest Low) within a lookback window refined by machine learning.

  • Trend Identification: The central Basis Line (Orange) serves as a trend filter. Price holding above the basis indicates bullish momentum, while price below suggests a bearish trend.
  • Volatility Expansion: The bands expand based on the intensity of price movement and volume. Large volume spikes during price runs cause the bands to widen significantly, creating dynamic support and resistance zones.
  • Signal Interpretation:
    • Bullish Signals: Occur when the price crosses over the Basis line or the Lower level.
    • Bearish Signals: Occur when the price crosses under the Basis line or the Upper level.
  • Manual Mode: By disabling Machine Learning (setting type to "None"), the script functions as a standard anchored VWAP that can be biased toward Bullish, Bearish, or Neutral resets based on user preference.

Details

The script leverages a k-Nearest Neighbour (KNN) approach to determine anchor resets. It evaluates "Fast" and "Slow" data lengths to calculate distances between price points, identifying structural significance in price movement.

When Rational Quadratics are enabled, the source data is smoothed using a kernel function, which improves the performance of machine learning calculations by reducing noise. The indicator also features a multi-reset logic: it triggers a new anchor if the current Low is lower than the Lowest Low of a specific length, or the High is higher than the Highest High, ensuring the VWAP remains relevant to the most recent market structure.

Settings

VWAP Zones

  • VWAP Type: Determines the directional bias for anchor resets (Bullish, Bearish, or Neutral). Note: This is bypassed when Machine Learning is active.
  • Source: The price data used for calculation (default is OHLC4).
  • Lookback Length Type: Choose between a "Static" fixed length or an "Optimal Source" from an external indicator.
  • Static Lookback Length: The period used to determine if price has broken recent extremes to trigger an anchor reset.
  • Standard VWAP Multiplier: Controls the width of the bands when Machine Learning is disabled.

Machine Learning

  • Use Rational Quadratics: Enables a kernel-based smoothing function to improve ML data processing.
  • Signal Type: Filters the source for momentum signals (High/Low, Close, or None).
  • Machine Learning Type: Selects the algorithm (KNN Mean, KNN Exponential, Simple Average, or None).
  • KNN Distance Type: Defines how the algorithm checks for neighbor proximity (Min, Max, or Both).
  • Machine Learning Length: Sets the lookback for the ML data buffer.
  • k-Nearest Neighbour (KNN) Length: Determines how many neighboring data points are accounted for in the average.
  • Fast/Slow ML Data Length: These two settings create the distance calculation used by the KNN algorithm to identify significant price shifts.
  • ML VWAP Multiplier: Controls the band width specifically for the Machine Learning-driven output.

FAQ

How do I interpret the colored background of the VWAP? The color transition (Green/Red) is tied to the slope of the Basis line. If the current basis is higher than the previous bar, the zone turns green (bullish slope); if lower, it turns red (bearish slope).

What is the difference between "Simple Average" and "KNN Average"? The Simple Average applies a basic ML-calculated length to the anchor logic, while KNN (k-Nearest Neighbour) searches for historical similarities in price distance to determine the most statistically significant anchor point.

How can I access this indicator? 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.