VHF Pass Node

Vertical Horizontal Filter — Series Input

MomentumTrend StrengthPass

Overview

The VHF Pass Node computes the Vertical Horizontal Filter on a series input. VHF measures the degree of trend vs. chop in a price series — dividing the net directional movement (vertical) by the total path length (horizontal) over a lookback period.

Developed by Adam White, VHF is a market regime indicator that answers the question: "Is the market trending or ranging?" High VHF values indicate trending behavior where price moves efficiently in one direction. Low VHF values indicate choppy, sideways markets where price oscillates without meaningful direction.

Formula

Numerator (vertical) = max(close, n) − min(close, n)
Denominator (horizontal) = Σ|close[i] − close[i−1]| for i in [1, n]
VHF = Numerator / Denominator
Output range: [0, ∞), typically [0, 1]. High values (>0.4) = trending; low values (<0.2) = ranging.
Warm-up: period bars.

Parameters

ParameterDefaultDescription
period28Lookback period for both the range and the sum of absolute changes

Inputs & Outputs

SlotDirectionTypeDescription
inputInput{ values, timestamps }Price or any numeric series
valuesOutput(number | null)[]VHF values (typically 0–1); nulls during warm-up
timestampsOutputnumber[]Unix timestamps aligned to input

Use Cases

Strategy Regime Switching

Use VHF to switch between trend-following and mean-reversion strategies. When VHF > 0.4, activate trend-following systems; when VHF < 0.2, switch to range-bound strategies. This adaptive approach reduces losses from applying the wrong strategy to the wrong market regime.

Signal Quality Filter

Gate trend-following signals (MACD crossovers, moving average crossovers) through a VHF filter — only allow signals when VHF is above a threshold. This significantly reduces false signals during choppy, low-trend-strength periods.

Adaptive Period Selection

Use VHF to dynamically adjust indicator periods — apply shorter EMA periods when VHF is high (trending) for faster signals, and longer periods when VHF is low (ranging) for smoother, less whipsaw-prone outputs.

Tips & Best Practices

Calibrate Thresholds by Instrument

The commonly cited 0.4/0.2 thresholds are a starting point. Different instruments and timeframes have different typical VHF ranges. Examine historical VHF distribution for your specific instrument and set thresholds at the 75th and 25th percentiles.

Lagging by Design

VHF is a lagging indicator — it identifies regime after it has already been established. Use it for sustained regime confirmation rather than early detection. For earlier signals, combine with shorter-period indicators like PFE Pass.

Direction-Agnostic

VHF measures trend strength but not direction. A high VHF could mean a strong uptrend or strong downtrend. Always combine VHF with a directional indicator (e.g., the sign of ROC or RSI relative to midline) to determine which way to trade.

Related Indicators