Vertical Horizontal Filter (VHF): Complete Guide for Algorithmic Trading

The Vertical Horizontal Filter (VHF) is a trend identification indicator that tells you whether a market is trending or moving sideways — before you commit to a strategy. Adam White developed the Vertical Horizontal Filter and introduced it in Futures magazine in 1991. Unlike most indicators that tell you where price is going, VHF tells you what kind of market you are in right now. That distinction is essential for algorithmic traders: a momentum strategy thrives in a trending market and fails in a ranging one, while a mean reversion strategy does the opposite. VHF helps you deploy the right approach at the right time.

What Is the Vertical Horizontal Filter?

The Vertical Horizontal Filter is a market regime indicator that measures the ratio of net price movement to total price movement over a defined period. A high VHF reading tells you the market has moved consistently in one direction — the definition of a trend. A low VHF reading tells you the market has moved back and forth without making net progress — the definition of a range. VHF does not tell you whether price is going up or down. It only tells you whether it is going anywhere at all. This makes it a filter rather than a signal. Use it alongside directional indicators to switch between trending and ranging strategies automatically. For a comparison with a similar trend-strength tool, see our guide on the Average Directional Index (ADX).

How Is the Vertical Horizontal Filter Calculated?

VHF compares two things over the same lookback period — typically 28 bars.

The numerator is the difference between the highest closing price and the lowest closing price over that period. This represents the net range the market covered — the vertical distance from top to bottom.

The denominator is the sum of all the absolute day-to-day closing price changes over that same period. This represents the total distance the market actually traveled, counting every up and down step. The VHF divides the net range by the total traveled distance. If the market trended cleanly, the net range will be large relative to all those individual steps. VHF will be high. If the market churned sideways, the net range will be small relative to all the back-and-forth movement. VHF will be low. StockCharts ChartSchool covers additional VHF calculation examples for those who want a deeper reference.

How to Read Vertical Horizontal Filter Signals?

VHF produces a continuous line with no upper or lower bound. Read it through these thresholds and direction changes.

  • VHF above 0.4: The market is trending. Trend-following strategies — momentum entries, moving average crossovers, breakout systems — are operating in their preferred environment.
  • VHF below 0.3: The market is ranging. Mean reversion strategies — RSI fade entries, Bollinger Band reversals, oscillator signals — are operating in their preferred environment.
  • VHF rising: A trend is developing. Consider switching from range-bound to trend-following rules.
  • VHF falling: The trend is exhausting. Consider switching from trend-following to mean reversion rules.

These thresholds are guidelines, not fixed rules. Different assets and timeframes may require different calibration. Test your thresholds in a backtest before applying them live.

What Are the Best Vertical Horizontal Filter Trading Strategies?

VHF works as a filter on top of other strategies — not as a standalone entry signal.

Regime-gated trend following: Apply a momentum or moving average crossover strategy only when VHF sits above 0.4. When VHF drops below that threshold, stop taking new trend entries and wait for the regime to return. This prevents momentum strategies from triggering in choppy, sideways conditions where they typically lose money.

Regime-gated mean reversion: Apply RSI or oscillator-based reversal strategies only when VHF sits below 0.3. When VHF rises above that threshold, stop taking reversion entries. A strong trend makes mean reversion signals dangerous — price can stay far from its average for far longer than expected.

Regime transition entries: A rising VHF from below 0.3 signals that a range is potentially breaking into a trend. This transition zone — VHF crossing up through 0.3 toward 0.4 — can serve as an early trigger to prepare for trend entries before the move fully develops.

Multi-strategy switching: Run two separate strategy modules — one trend, one mean reversion — and use VHF to determine which module operates at any given time. This approach reduces dead periods where neither strategy type is active.

What Are Common Vertical Horizontal Filter Mistakes to Avoid?

Trading VHF directly as a signal: VHF tells you the market regime. It does not tell you to buy or sell. Treating a rising VHF as a buy signal or a falling VHF as a sell signal produces poor results because VHF has no directional component.

Using too short a lookback period: A VHF calculated over 5 or 10 bars reacts too quickly to short-term price noise. The standard 28-bar period smooths out intraday choppiness and reflects a more reliable regime reading. Shorten it only with strong backtested justification.

Applying fixed thresholds across all markets: A threshold of 0.4 works well on some assets and timeframes and poorly on others. Stocks, crypto, and commodities all have different natural volatility profiles. Always calibrate your VHF thresholds for the specific market and timeframe you are trading.

Ignoring transitions: A VHF moving from 0.35 to 0.41 carries more information than a static reading at 0.41. Direction of change matters. A rising VHF is a different signal than a falling VHF at the same absolute level.

How to Build Vertical Horizontal Filter Strategies in Arrow Algo?

Arrow Algo includes the Vertical Horizontal Filter block in its visual indicator library. Add it to your strategy canvas with a single drag. Set the lookback period in the block settings — the default of 28 bars is a sensible starting point for most crypto pairs on a daily or 4-hour timeframe.

To build a regime-gated strategy, add a condition block that checks whether VHF is above your trend threshold. Connect the output of that condition to the enable input of your trend strategy module. Add a second condition block checking whether VHF is below your range threshold. Connect that to the enable input of your mean reversion module. Only one module runs at a time depending on the current regime reading. Arrow Algo's visual builder wires these connections with simple block links — no formulas or programming required.

To detect regime transitions, add a crossover block comparing the current VHF value against your threshold level. Use the crossover event as a trigger to send an alert or begin preparing entries for the new regime type. The entire setup stays visual and adjustable at every stage.

What Are the Key Takeaways?

  • The Vertical Horizontal Filter identifies whether a market is trending or ranging
  • High VHF signals a trend; low VHF signals a range
  • VHF is a filter — it has no directional component and does not signal buy or sell
  • Standard lookback is 28 periods; typical thresholds are 0.4 for trending and 0.3 for ranging
  • Use VHF to gate trend-following and mean reversion strategies so each runs only in its preferred environment
  • Calibrate thresholds per asset and timeframe through backtesting
  • Arrow Algo's visual builder lets you wire VHF as a regime filter without writing any code
Educational disclaimer: This content is for educational purposes only and does not constitute financial advice. Trading involves significant risk and you should only trade with capital you can afford to lose. Past performance is not indicative of future results.

Disclaimer: The information provided in this article is for educational purposes only and does not constitute financial advice. Trading involves significant risk and you should only trade with capital you can afford to lose. Past performance is not indicative of future results. Always conduct your own research before making any trading decisions.

Ready to build your own automated trading strategies without writing a single line of code? Start for free at Arrow Algo and join thousands of traders who’ve made the switch to systematic trading.

About the Author

Author Bio