T
Traderoid

VHF Node

Vertical Horizontal Filter

IndicatorTrendFilter

Overview

VHF (Vertical Horizontal Filter) compares vertical price movement (directional change) to horizontal price movement (sideways movement), measuring trend orientation. High VHF indicates trending markets (vertical dominates), low VHF indicates ranging/choppy markets (horizontal movement dominates). This simple ratio filters which signals to trade: trend-following in high VHF periods, mean-reversion in low VHF periods.

Unlike momentum oscillators, VHF is purely structural—it measures how markets move, not how much they move. Markets spending 30% of time trending, 70% ranging is captured instantly by VHF. Perfect for strategy selection, preventing trend-following losses in choppy zones and mean-reversion losses during strong trends.

Formula

VHF compares directional to sideways price movement:

1. Calculate Vertical Distance
Vertical = Highest(High, 28) - Lowest(Low, 28)
Highest high minus lowest low in period
2. Calculate Horizontal Movement
Horizontal = SUM(ABS(Close[i] - Close[i-1])) for 28 bars
Total bar-to-bar movement in period
3. Calculate VHF Ratio
VHF = Vertical / Horizontal
Ratio of directional to total movement
Interpretation
VHF above 0.7: Strong trending market, use trend strategies
VHF 0.4-0.7: Normal trending conditions
VHF below 0.4: Choppy/ranging market, use mean-reversion
VHF trend: Rising = trending strengthening, Falling = ranging beginning
VHF cycle: Usually cycles 0.3-0.8 and back repeatedly

Parameters

ParameterTypeDefaultDescription
periodnumber28Lookback period for ratio calculation.
sourceNodeAutoThe root data source node.

💡 Tip: Period 14-28 standard. Period 10 for faster trend detection. Period 40+ for longer-term structure. Shorter = more sensitive to chop, longer = smoother trend view. Typical threshold: above 0.5 = trending, below 0.4 = choppy.

Common Use Cases

1. Strategy Selection Filter

Use trend-following strategies when VHF above 0.5. Use mean-reversion strategies when VHF below 0.4. VHF in middle swing periods = wait for clearer market mode. Automatic strategy selection prevents fighting the market structure.

2. Signal Filtering

Only trade moving average crossovers when VHF above 0.5 (trending). Only trade RSI overbought/oversold when VHF below 0.4 (ranging). Same signal has different probability depending on VHF state. Improves win rate by 10-20% through filtering.

3. Market Structure Recognition

VHF dropping from 0.6 to 0.3 = market transitioning from trending to choppy. VHF rising from 0.3 to 0.6 = market organizing into trend. These transitions alert before price clearly shows new structure.

4. Divergence-Based Trading

Price makes new high but VHF makes lower high = trend weakening to chop starting. Sell before obvious breakdown. Price consolidating but VHF rising = trend about to break out. Structural analysis predicts trend better than price alone.

Advantages & Limitations

Advantages

  • Perfect for strategy selection
  • Measures market structure not momentum
  • Simple calculation, easy to understand
  • Works on all timeframes
  • Reduces losses from trading wrong strategy
!

Limitations

  • Lagging (measures past structure)
  • Doesn't predict trend direction
  • Threshold values need testing
  • Can oscillate around threshold
  • Works best with other indicators

Tips & Best Practices

💡 Use Thresholds Strictly

Define clear rules: VHF above 0.55 = ONLY trend follow. VHF below 0.35 = ONLY mean revert. VHF 0.35-0.55 = STAND ASIDE. Strict rules prevent ambiguity and emotion-based trading decisions.

📊 Smooth VHF for Clarity

Apply 5-bar SMA to VHF to smooth noise. Rising smoothed VHF = clearly trending or trending starting. Falling = clearly ranging or trending ending. Smoothing prevents whipsaw trading decisions.

⚡ Multi-Timeframe Use

Daily VHF above 0.5 = uptrend structural. If hourly VHF below 0.4 = pullback dip-buy. Combine timeframes: trade small pullbacks in larger trends, risk-adjusted by larger-structure VHF.

⚠️ Test Your Thresholds

Standard 0.4/0.5 works for many, but test your specific asset. VHF above 0.45 might be better for stocks, above 0.6 for futures. Backtest reveals optimal threshold for your strategy and market.

Example Strategy

VHF-filtered trend-following strategy:

VHF-Filtered MA Breakout Trade

1Filter Phase

  • Check VHF value
  • VHF above 0.5 = market trending (proceed)
  • VHF below 0.4 = market choppy (skip trading)

2Entry Signal

  • Price crosses above 50-day MA (trend-following setup)
  • Only if VHF above 0.5 (confirming trend structure)
  • Enter long position on breakout

3Exit Condition

  • Price closes below 50-day MA
  • VHF falls below 0.4 (trend ending)
  • Or take profits at 3-5% gain

4Risk Rules

  • Stop below the MA (structure break)
  • NO trading if VHF in 0.35-0.55 range (ambiguous)
  • Risk 1-2% per trade, higher conviction with high VHF

Related Nodes