OPEN-SOURCE SCRIPT

Variance Ratio & Efficiency Ratio (Quant Lab)

47
1️⃣ Variance Ratio (VR)

Formula:

VR ≈ Var(q-step returns) / (q × Var(1-step returns))

Interpretation:
• VR ≈ 1 → The market is like a random walk; neither trend nor mean-reversion is dominant.
• VR > 1 → Trend behavior is dominant.
• Trend-following systems (EMA, Supertrend, breakout) work better.
• VR < 1 → Mean-reversion is dominant.
• Range/reversal strategies (Z-score, Bollinger fade, RSI reversal) work better.

In short:
• VR > 1 → Trending market

• VR < 1 → Mean-reverting market

This tells you:

“Should I build a trend system or a mean-reversion system for this instrument?”



2️⃣ Efficiency Ratio (ER)

Formula logic:

ER = |Close_now – Close_n-bars-ago| / Σ|Close_i – Close_{i+1}|

In other words:
• Numerator → Net movement over N bars
• Denominator → Total noise over N bars

Interpretation:
• ER ≈ 1 → The price has moved in almost a straight line in one direction.
→ The trend is very efficient, noise is low.
• ER ≈ 0 → The price has fluctuated a lot but hasn't gone anywhere definitively.
→ A complete noise/range market.

This tells you:

“How clear is the trend in this last N bars, and how much noise is there?”



🔥 The intelligence provided by both together:
• VR > 1 and ER is high (0.6–1.0) →
➜ Strong, high-quality trend. Golden age for trend-following.
• VR > 1 but ER is low (0.2–0.4) →
➜ Trend exists but there is a lot of noise, many fake movements. • VR < 1 and ER is low →
➜ Net range / sideways market. Ideal for mean-reversion.

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.