Order Flow Asymmetry [JOAT]Order Flow Asymmetry
Introduction
Order Flow Asymmetry is an open-source synthetic institutional order flow indicator that tracks four independent measures of directional institutional activity — Volume-Weighted Momentum, Liquidity Vacuum detection, Microstructure Imbalance scoring, and a dynamic Information Ratio Band system — and classifies the current market into one of four regime states based on trend direction and volatility level. Smart money signals are generated only when regime, VWM direction, imbalance score, and the absence of a liquidity vacuum all align simultaneously.
The core thesis is that institutional participants leave statistical footprints in price and volume data that can be approximated without access to full order book data. When a large participant is absorbing supply, the result is: above-average volume, below-average price movement, high close-to-range ratio biased toward the institutional direction, and a cumulative imbalance in the bid-side proxy. Order Flow Asymmetry tracks these proxies simultaneously rather than relying on any single measure.
Core Concepts
1. Volume-Weighted Momentum (VWM)
VWM weights each bar's price change by its volume — large-volume bars contribute more to the running total than small-volume bars. The cumulative result is then normalized relative to the 20-bar average volume, producing a -50 to +50 reading:
float vwm = ta.cum(ta.change(close) * volume) / ta.ema(volume, 20)
float vwmNorm = (vwm - ta.lowest(vwm,100)) / math.max(ta.highest(vwm,100) - ta.lowest(vwm,100), 1e-9) * 100 - 50
A crossover of zero in either direction is the primary momentum signal.
2. Liquidity Vacuum Detection
A liquidity vacuum occurs when volume collapses below two standard deviations of its 50-bar mean while price moves more than one ATR in the same bar. This pattern indicates a move through a region with no counterparty liquidity — a potential institutional trap. Vacuum bars are marked with three-layer glow boxes and treated as signal inhibitors.
3. Microstructure Imbalance Score
A bar-level bid/ask proxy is computed from close position within the high-low range. Bars closing in the upper half of their range contribute positive imbalance; bars closing in the lower half contribute negative. A 93% decay factor is applied each bar, producing a running imbalance score that emphasizes recent activity while retaining historical context.
4. Four-State Regime Classification
The regime is determined by two binary conditions: ADX above threshold (trending vs. ranging) and ATR ratio above threshold (high vs. low volatility). This produces four states: Trend Bull, Trend Bear, Range High-Vol, Range Low-Vol. Each state receives a distinct background tint. Smart money signals require a Trend state — signals in Range states are suppressed.
5. Information Ratio Bands
Standard deviation bands are computed from the MIDAS VWAP. The band width multiplier is dynamically set by the rolling Sharpe ratio estimate of recent returns — periods with higher risk-adjusted returns produce narrower bands, while periods with lower Sharpe ratios produce wider bands.
float sharpe = ta.ema(ret20, 20) / math.max(ta.stdev(ret20, 20), 1e-8)
float kFactor = math.max(0.5, math.min(3.0, math.abs(sharpe) * 2))
Features
Volume-Weighted Momentum: Cumulative volume-weighted price change normalized to -50/+50 range
Institutional VWAP center line: Thick reference line showing the cumulative volume-weighted average price anchor — the central institutional value reference
VWM gradient fill zones: Bull zone fills between VWAP and upper VWM level in bull theme color; bear zone fills between VWAP and lower VWM level in bear theme color — intensity reflects VWM magnitude
IR Band gradient fill: Subtle gradient fill between upper and lower Information Ratio bands shows the full Sharpe-adjusted deviation range
Regime transition markers: Every regime change draws a vertical dotted line plus a direction label (▲ TrendBull / ▼ TrendBear / ◆ RngHVol / ◇ RngLVol) — institutional regime context at a glance
Absorption / Distribution labels: "Absorption" label when cumulative microstructure imbalance score exceeds extreme threshold; "Distribution" label when it falls below. Identifies potential institutional accumulation/distribution zones
Smart money signal markers: "▲ SMART LONG" / "▼ SMART SHORT" labels with embedded VWM and Imbalance values, plus a vertical dotted line through each signal bar for visual alignment
Liquidity vacuum detection: Volume collapse + ATR-relative move identifies institutional trap zones with 3-layer glow visualization and "Vacuum" text label
Microstructure imbalance score: Decaying cumulative bid/ask proxy normalized by ATR, displayed in dashboard
Four-state regime classification: Trend Bull / Trend Bear / Range High-Vol / Range Low-Vol from ADX and ATR ratio — distinct background tints for each state
Information Ratio Bands: VWAP deviation bands with width dynamically set by rolling Sharpe estimate
Gradient candle coloring by VWM: Bar colors reflect normalized VWM intensity using color.from_gradient() when VWM exceeds threshold in trend direction
Three-layer glow candles (optional): Institutional-style neon glow candle effect
12-row institutional dashboard: Regime, VWM, vacuum state, imbalance score, Sharpe k-factor, IR band levels, signal, win rate, and performance stats
Four color themes: Phantom, Neon, Classic, Solar
Non-repainting: All signals gated by barstate.isconfirmed; all inputs are historical only
Input Parameters
Volume-Weighted Momentum:
Volume Average Length (default: 20)
VWM Cross Threshold (default: 5.0)
Liquidity Vacuum:
Volume Mean Length, Sigma Below Mean, Vacuum Zone Width, Glow Strength
Microstructure Imbalance:
Imbalance Decay Factor (default: 0.93)
Imbalance Signal Gate (default: 15.0)
Regime Classification:
ADX Trend Threshold (default: 25)
ATR Ratio High-Vol Threshold (default: 1.2)
Information Ratio Bands:
Show IR Bands toggle
Sharpe Window (default: 20)
Signal:
Cooldown Bars, TP ATR Multiple, SL ATR Multiple, Show Trade Block, Block Width
How to Use This Indicator
Step 1: Identify the Regime
Check the dashboard Regime row. Smart money signals only fire in Trend Bull or Trend Bear states. During Range states, no signals are generated regardless of VWM direction.
Step 2: Watch for VWM Zero Cross
The VWM crossing zero in the direction of the trend regime is the primary trigger. Ensure no vacuum is active on the signal bar — vacuum bars inhibit signals because they represent suspect moves without genuine counterparty support.
Step 3: Check Imbalance Score
The imbalance score reflects cumulative directional bias in bid/ask proxy. A score above the gate threshold in the trend direction adds confidence. A score contradicting the trend direction is a warning.
Step 4: Use IR Bands as Dynamic Reference
The Information Ratio bands widen in low-Sharpe environments (price distributing far from VWAP) and narrow in high-Sharpe environments (price efficiently priced near VWAP). These bands serve as dynamic reference levels rather than fixed targets.
Indicator Limitations
VWM uses tick volume as a proxy for institutional participation. On forex spot and some crypto venues, tick volume may not accurately represent actual participation
The microstructure imbalance score uses bar close position as a bid/ask proxy. This is an approximation — actual bid-ask data is not available in standard TradingView data
Regime classification uses ADX and ATR ratio, both of which lag price. A trend beginning explosively will be classified as ranging for several bars until indicators respond
The Information Ratio Band width is driven by a 20-bar Sharpe estimate, which is an extremely short window for a reliable Sharpe computation. It should be interpreted as a dynamic band-width scaler rather than a statistically significant Sharpe ratio
Smart money signals are rare by design — the four-condition gate produces low-frequency output
Originality Statement
The combination of Volume-Weighted Momentum, Liquidity Vacuum detection as a signal inhibitor, a decaying Microstructure Imbalance score, and Information Ratio Bands with Sharpe-driven width — all gated by a four-state regime classification — is an original analytical architecture not replicated in existing open-source Pine Script v6 publications
Treating liquidity vacuums as signal inhibitors rather than signals themselves — suppressing momentum signals that occur immediately after a volume-collapse move — is a novel application of vacuum detection logic
Dynamic VWAP deviation band width driven by a rolling Sharpe ratio estimate rather than a fixed multiplier provides adaptive band boundaries that reflect the current efficiency of price relative to VWAP
Disclaimer
This indicator is provided for educational and informational purposes only. It is not financial advice. Trading involves substantial risk of loss. Synthetic order flow measures are approximations that use publicly available price and volume data as proxies for actual institutional activity. Past signal performance does not predict future results. The author accepts no responsibility for trading losses resulting from use of this indicator.
Made with passion by jackofalltrades
Pine Script® indicator






















