Vertical Horizontal Filter: Spotting Trends vs Ranges on Nifty
How the VHF spots trending vs ranging Nifty, with real NSE regimes, a worked calculation, option tactics, and Indian F&O tax rules.
Key Takeaways
- 1.The Vertical Horizontal Filter (VHF) is a single number that tells you whether a market like Nifty is trending or just chopping sideways, so you can pick the right strategy.
- 2.VHF equals the range of closing prices over a lookback period divided by the sum of every day to day price change in that same period. A rising VHF means a clean trend, a falling VHF means a range.
- 3.On daily Nifty data a 28 day VHF above roughly 0.40 has historically marked strong directional moves, while readings below about 0.30 have marked sideways, mean reverting phases.
- 4.Real Indian examples matter more than textbook numbers. The October 2021 to June 2022 Nifty downtrend showed high, rising VHF, while the sideways Sep to Nov 2023 phase printed low, flat VHF.
- 5.VHF tells you the type of market, not the direction. Pair it with a moving average for direction and use it to switch between trend following and range trading on Nifty and Bank Nifty.
What the Vertical Horizontal Filter Actually Measures
The Vertical Horizontal Filter (VHF), created by Adam White in 1991, answers one practical question that every Indian trader faces every morning. Is Nifty going somewhere in a straight line, or is it just rattling around in a box? Most indicators fail you because they assume one of those two states. A moving average crossover gets chopped to pieces in a sideways market, while a range oscillator like RSI keeps screaming overbought all the way up in a strong trend. VHF is a regime filter, which means a tool that detects the kind of market you are in before you choose a strategy.
The intuition is geometric, which is where the name comes from. When price travels a long vertical distance using very little back and forth horizontal movement, the market is trending and VHF is high. When price covers almost no net vertical distance but wastes a lot of horizontal movement going up and down, the market is ranging and VHF is low. You are literally measuring how efficiently price converts daily movement into net direction.
This matters on the NSE because Nifty and Bank Nifty spend large stretches of the year in tight ranges punctuated by sharp trending bursts around events like the Union Budget, RBI policy, and quarterly results. Knowing which regime you are in is often worth more than any single entry signal.
The VHF Formula, Written Out Plainly
VHF over a lookback of n periods is defined as the numerator divided by the denominator below. Both parts use the closing price, so VHF is a close based indicator and you do not need intraday highs or lows for the standard version.
- Numerator: the highest closing price in the last n periods minus the lowest closing price in the last n periods. This is the net travel, the vertical distance.
- Denominator: the sum of the absolute change between each close and the close before it, added up across all n periods. This is the total effort, the path length.
- VHF = Numerator divided by Denominator. The result is a ratio, normally between about 0.10 and 0.60 on daily Nifty data with a 28 day window.
Think of it as net distance divided by total distance walked. If you walk 100 metres north in a straight line, both numbers are 100 and the ratio is 1.0, a perfect trend. If you pace 100 metres back and forth but end up where you started, your net distance is near zero and the ratio collapses toward zero, a pure range. Real markets sit between these extremes. The standard lookback is 28 periods, the value Adam White originally proposed.
A Real Worked Example: Nifty in a Trending Week
Let us compute VHF on a short, realistic Nifty sequence so you can see every step. We use a 10 day window here purely so the arithmetic is readable. In live trading you would use 28. The closing levels below are illustrative but sit in the realistic Nifty 50 range and behave like a genuine uptrend leg, the kind seen during the strong run into late 2023.
| Day | Nifty Close | Daily change |Close minus prior close| |
|---|---|---|
| 1 | 19,650 | reference, not counted |
| 2 | 19,720 | 70 |
| 3 | 19,710 | 10 |
| 4 | 19,805 | 95 |
| 5 | 19,880 | 75 |
| 6 | 19,860 | 20 |
| 7 | 19,945 | 85 |
| 8 | 20,010 | 65 |
| 9 | 20,060 | 50 |
| 10 | 20,130 | 70 |
Highest close in the window is 20,130 and the lowest close is 19,650, so the numerator is 20,130 minus 19,650, which equals 480. The denominator is the sum of all the daily changes: 70 plus 10 plus 95 plus 75 plus 20 plus 85 plus 65 plus 50 plus 70, which equals 540. VHF therefore equals 480 divided by 540, which is approximately 0.89. That is a very high reading, correctly flagging a clean, efficient uptrend where almost every point of daily movement went toward net direction.
A reading near 0.89 like the one above is unusually clean and tells you to favour trend following, hold winners, and avoid fading the move. On a real 28 day Nifty chart most trending readings sit in the 0.40 to 0.55 zone, not near 0.90, because longer windows capture more day to day noise in the denominator.
The Same Math in a Ranging Week
Now take a sideways Nifty week, the kind seen during the choppy consolidation between September and November 2023 when the index oscillated around the 19,200 to 19,800 band without a clear winner. Again the closes are illustrative but realistic.
| Day | Nifty Close | Daily change |Close minus prior close| |
|---|---|---|
| 1 | 19,500 | reference, not counted |
| 2 | 19,580 | 80 |
| 3 | 19,490 | 90 |
| 4 | 19,560 | 70 |
| 5 | 19,470 | 90 |
| 6 | 19,540 | 70 |
| 7 | 19,460 | 80 |
| 8 | 19,530 | 70 |
| 9 | 19,455 | 75 |
| 10 | 19,510 | 55 |
The highest close is 19,580 and the lowest is 19,455, so the numerator is just 125. The denominator, the sum of daily changes, is 80 plus 90 plus 70 plus 90 plus 70 plus 80 plus 70 plus 75 plus 55, which equals 680. VHF equals 125 divided by 680, which is approximately 0.18. Notice the denominator is actually larger than in the trending example, because price moved a lot, yet the numerator collapsed because all that movement cancelled out. A reading near 0.18 is a textbook range signal telling you to switch off trend following and consider mean reversion or option selling instead.
Real Nifty Regimes: When VHF Was High vs Low
This is where the original version of this page was weak. It used invented Rs 100 to Rs 104 numbers that no real trader would recognise. Below are actual market phases on Nifty 50 where a 28 day VHF would have behaved very differently, so you can connect the indicator to events you lived through.
| Nifty period | Market behaviour | Typical 28 day VHF state | What it told you |
|---|---|---|---|
| Oct 2021 to Jun 2022 | Sustained downtrend from about 18,600 toward 15,200 | High and rising, roughly 0.40 to 0.50 | Strong directional regime, favour trend following on the short side |
| Mar 2020 COVID crash | Vertical fall from about 12,000 to 7,600 in weeks | Very high, spiking above 0.50 | Extreme one way trend, classic trend following regime but with violent risk |
| Sep to Nov 2023 | Sideways grind in the 19,200 to 19,800 band | Low and flat, roughly 0.20 to 0.28 | Ranging regime, fade extremes, sell premium, avoid breakout chasing |
| Apr to Jul 2023 | Steady recovery uptrend from about 17,300 to 19,700 | Rising into the 0.35 to 0.45 zone | Trend rebuilding, momentum strategies start working again |
| Jul to Sep 2024 | Grind higher with shallow dips toward record highs | Moderate, around 0.30 to 0.40 | Mild trend, trend following works but keep stops realistic |
The exact VHF figure depends on your data source, settings, and whether you smooth it, so treat these as illustrative ranges, not guaranteed values. The point is the pattern. VHF rose and stayed elevated during the 2021 to 2022 decline and the 2020 crash, and it sagged and went flat during the 2023 autumn consolidation. That is exactly the behaviour the indicator is designed to show.
Reading the Numbers: Thresholds That Hold Up on NSE Data
There is no single magic level, but practical thresholds on daily Nifty and Bank Nifty with a 28 day window tend to cluster as below. Bank Nifty is more volatile, so its denominator is larger and its VHF can read slightly lower for the same visual trend. Adjust by feel and by backtesting your own instrument.
| 28 day VHF reading | Likely regime | Suggested posture |
|---|---|---|
| Above 0.45 | Strong trend | Trend follow, ride moving averages, widen targets |
| 0.35 to 0.45 | Developing or moderate trend | Trade with the trend but tighten risk |
| 0.25 to 0.35 | Mixed or transitioning | Reduce size, wait for confirmation |
| Below 0.25 | Range or chop | Mean revert, sell option premium, avoid breakouts |
Two refinements matter more than the absolute level. First, the slope of VHF often signals earlier than the level. A VHF turning up from a low base frequently warns that a range is about to resolve into a trend, before the level crosses any threshold. Second, watch for peaks. When VHF tops out and rolls over from a high reading, the existing trend is often maturing and the easy money in that leg is done, which is a cue to trail stops rather than add aggressively.
Trading Nifty Options Around VHF Regimes
For Indian derivatives traders, the most direct use of VHF is choosing between buying options and selling options. Option buyers need a trend or a fast move to overcome time decay. Option sellers profit when price goes nowhere and decay does the work. VHF maps almost perfectly onto this choice. A high, rising VHF favours buyers of directional options. A low, flat VHF favours non directional sellers such as iron condors or short straddles.
Here is an illustrative trade. Suppose on a Monday the 28 day Nifty VHF has dropped to 0.20, confirming a tight range, and Nifty spot sits at 19,500. A range trader sells a weekly at the money short straddle: sells the 19,500 call and the 19,500 put. Assume the call premium is 90 and the put premium is 85, so total premium collected is 175 points. With the Nifty lot size of 65, the credit received is 175 times 75, which equals Rs 13,125 per lot before costs. If Nifty expires near 19,500 on Tuesday as the low VHF predicted, most of that decays to the seller. If the range had instead broken, say Nifty closes at 19,720, the call is 220 points in the money against 175 collected, giving a 45 point loss, which is 45 times 75, or Rs 3,375 loss per lot before costs. That is exactly why you only sell premium when VHF confirms a range.
- High and rising VHF: buy directional options or use debit spreads, because a trend can pay for the premium and the time decay.
- Low and flat VHF: sell premium via short straddles, short strangles, or iron condors, because a range lets theta work for you.
- VHF turning up from a low base: be careful selling premium, a range may be about to break and hurt short option positions.
- Always remember the Nifty weekly expiry is now on Tuesday, Bank Nifty trades monthly expiry, and SEBI has limited weekly expiries to one benchmark index per exchange, so plan the regime trade around the right expiry.
On expiry day itself, VHF computed on daily data lags badly because it cannot see the intraday pin. Use VHF to choose the strategy earlier in the week, then manage the expiry day position with intraday levels, not with a daily VHF reading.
Costs and Taxes That Eat Into VHF Driven Trades
A VHF signal is only as good as the net rupees after costs, and Indian F&O costs are not trivial. On the short straddle above, you pay Securities Transaction Tax on options at 0.1 percent of the sell side premium, brokerage of up to about Rs 20 per order at a discount broker, plus exchange transaction charges, GST at 18 percent on brokerage and exchange charges, SEBI turnover fees, and stamp duty on the buy side. Across two legs in and two legs out, total charges on a single Nifty straddle lot commonly run into a few hundred rupees, which directly reduces the Rs 13,125 credit. Always compute the breakeven after costs, not before.
On the tax side, profits from F&O are treated as business income in India, not as capital gains, and are taxed at your applicable slab rate. This is very different from equity delivery trades, where short term capital gains are taxed at 20 percent and long term gains above Rs 1.25 lakh are taxed at 12.5 percent. If you use VHF to swing trade actual shares like Reliance or HDFC Bank rather than index options, those equity tax rules apply instead. Keep your F&O turnover records clean, because business income reporting and possible tax audit thresholds depend on accurate logs, which is exactly what a trading journal is for.
Combining VHF With Direction Tools
VHF has one blind spot you must respect. It tells you the strength and type of a move but never the direction. A VHF of 0.50 looks identical in a roaring uptrend and a brutal crash. That is by design, because the numerator uses absolute distance. So VHF is always a filter on top of a directional engine, never a standalone buy or sell trigger.
- Pair VHF with a 20 or 50 period moving average. When VHF is high and price is above the rising average, follow the uptrend. When VHF is high and price is below a falling average, follow the downtrend.
- Use ADX as a cross check. ADX and VHF often agree on trend strength, and agreement between two independent measures raises your confidence.
- In low VHF ranges, switch to RSI or Bollinger Band fades, since those range tools only work when VHF confirms there is a range to fade.
- Confirm regime shifts with volume. A VHF breakout from a low base backed by rising NSE cash and futures volume is more trustworthy than a quiet one.
Settings, Timeframes, and Common Mistakes
The default 28 period setting works well on the Nifty daily chart for swing and positional traders. Intraday traders on 5 or 15 minute Bank Nifty charts often shorten the lookback to 14 or 18 to react faster, accepting more noise. Positional traders sometimes lengthen it to 35 or 50 on the weekly chart to filter out minor wobbles. There is no universally correct number, so backtest on your own instrument and timeframe before committing real money.
- Mistake one: treating VHF as a direction signal. It is regime only. Always add a trend tool for up or down.
- Mistake two: using a daily VHF to manage an intraday or expiry position. The timeframe of the indicator must match the timeframe of the trade.
- Mistake three: chasing the absolute threshold. The slope and turning points of VHF often matter more than whether it is exactly above 0.40.
- Mistake four: ignoring costs and the F&O business income tax, which can turn a marginally profitable VHF strategy into a loss after charges.
Sources and Further Reading
For authoritative data and further reading, refer to Zerodha Varsity, Investopedia, the Securities and Exchange Board of India and NSE India. Always confirm current contract specifications, lot sizes, expiry rules, and tax rates on the official source before you trade, since these change over time. The numeric examples here are illustrative and never a promise of returns. Use a trading journal to record your own VHF regime calls and verify whether they hold up on your instruments.
Sources and Further Reading
For authoritative data and further reading on this topic, refer to Zerodha Varsity, Investopedia, Reserve Bank of India and NSE India. Always confirm current rules, rates and contract specifications on the official source before you trade.
Related Topics
Related Articles
RSI 2 Period Strategy for Indian Markets
The RSI(2) mean reversion strategy for Indian markets: 200 DMA filter, exact entry and exit rules, and worked Reliance and Bank Nifty rupee examples.
Understanding Trading Psychology in Indian Markets
Learn trading psychology for Indian markets with a worked Nifty options example showing how fear and greed turned a Rs 3,600 loss into Rs 16,500.
Understanding Short Selling in Indian Markets
How short selling works in India: the intraday-only retail rule, SEBI SLB overnight borrowing with a real Reliance borrow-cost example, F&O shorts and tax.
How to Rebalance Your Portfolio in Indian Markets
How to rebalance your Indian portfolio with the correct post-2024 tax: 20% STCG, 12.5% LTCG above Rs 1.25 lakh, plus a worked Nifty example.
Pair Trading Strategy for Indian Markets
Pair trade TCS and Infosys with real z-score math, lot sizes, rupee P&L, STT and slab-rate tax. A worked, market-neutral guide for Indian traders.
Understanding Limit Orders in Indian Markets
How limit orders work on the NSE, with a real bid-ask order book, tick sizes, and worked Reliance, HDFC Bank and Nifty examples with charges.
The trading journal built for Indian F&O traders. Track your trades, spot patterns, build discipline.
- Log one trade a day by hand, on purpose
- AI mentor finds your repeat mistakes
- Behavioural analytics catch tilt early
- Trading calendar with P&L heatmap
- Pre-trade checklist flags risks
Yearly ₹2,499 · No broker credentials