OPEN-SOURCE SCRIPT
Citadel Microstructure Edge [JOAT]

CITADEL MICROSTRUCTURE EDGE [JOAT]
A tribute to the high-frequency / market-making style of microstructure-edge extraction. Builds three orthogonal microstructure signals — tick imbalance (which side is aggressively crossing the tape), spread tightness (how thin the bid-ask is relative to its baseline), and micro momentum (the EMA-pair spread on the fastest timeframe) — then composes them into a single decaying edge value with an exponential half-life. When the edge crosses a configurable threshold and has sustained for N bars same-sign, a directional signal fires. Cooldown plus asymmetric lockout keep the signal stream institutional.

Three orthogonal components
Each component is computed independently and Z-normalised (optional for tick imbalance) for stationarity:
Default weights (0.45 / 0.25 / 0.45) bias the read toward the two most-actionable components (tick imbalance + momentum), with spread tightness as confirmation. Optional auto-normalisation to sum=1.
Decaying edge with half-life ~ 3 bars
Microstructure edges decay quickly. The script does not just sum the three components per bar — it accumulates with decay:
edge_t = decay × edge_{t−1} + contribution_t
The default decay (0.78) gives the edge a half-life of approximately 3 bars — the standard market-making decay window. Older contributions fade out automatically; new contributions get incorporated immediately. This is the institutional way to track a fast signal without re-introducing flicker.
Sustained-edge signal logic
Visual system
A locked Crimson Pulse palette: electric blue buy edge / lime-yellow sell edge / muted neutral on a deep crimson-black ground — the institutional HFT aesthetic.
Dashboard
9-row monospaced table positionable to any of nine corners. Surfaces:
Alerts
Three alert conditions, each independently controllable:
{image]
How to read it
Three reads, in order of conviction:
Suggested settings
Defaults (1m LTF, spread EMA 14 / Z 60, micro EMA 3/8 / Z 60, weights 0.45/0.25/0.45, edge threshold 0.75, sustain 5 bars, decay 0.78, cooldown 7 bars) are tuned for 5m–15m charts on liquid futures and crypto where microstructure has meaningful presence. For 1m scalping drop LTF to 15s (Premium required) and sustain to 3 bars. For HTF the script is not the right tool — microstructure edges decay too quickly to be meaningful on 1H+ timeframes.
Originality
The implementation — the three-component microstructure pipeline (tick imbalance + spread tightness + micro momentum), the LTF tick-rule reconstruction with optional Z-normalisation, the weighted-sum composition with auto-normalisation, the exponential-decay edge accumulator with configurable half-life, the sustained-edge counter and asymmetric-lockout signal logic, the price-anchored histogram render at the top of the chart, the slope-tinted micro ribbon, and the Crimson Pulse palette — is JOAT-original. No third-party code reused. The script is a tribute to Citadel-style market-making microstructure-edge extraction, not a direct replication of any proprietary Citadel code.
Limitations
Reconstructed tick direction is an inference — the tick rule is the accepted public-market proxy but is not a direct read of bid/ask. Sub-minute LTFs require a TradingView Premium or Ultimate plan. Microstructure edges decay fast by design; on 1H+ timeframes the engine produces few signals — that is correct behaviour, not a bug.
—
-made with passion by jackofalltrades
A tribute to the high-frequency / market-making style of microstructure-edge extraction. Builds three orthogonal microstructure signals — tick imbalance (which side is aggressively crossing the tape), spread tightness (how thin the bid-ask is relative to its baseline), and micro momentum (the EMA-pair spread on the fastest timeframe) — then composes them into a single decaying edge value with an exponential half-life. When the edge crosses a configurable threshold and has sustained for N bars same-sign, a directional signal fires. Cooldown plus asymmetric lockout keep the signal stream institutional.
Three orthogonal components
Each component is computed independently and Z-normalised (optional for tick imbalance) for stationarity:
- Tick Imbalance — LTF-reconstructed buy/sell tick classification. Output is the rolling imbalance bounded in [−1, +1]; optionally Z-normalised over a configurable window (default 60 bars) for cross-asset stationarity. The dominant input for fast / scalping reads.
- Spread Tightness — (H − L) / C against its own EMA-smoothed baseline, Z-scored. Tight spread (low relative range) is constructive for whichever side momentum favours. The sign is borrowed from the micro-momentum factor.
- Micro Momentum — EMA-fast minus EMA-slow on the tick-reconstructed flow, Z-scored. The directional engine.
Default weights (0.45 / 0.25 / 0.45) bias the read toward the two most-actionable components (tick imbalance + momentum), with spread tightness as confirmation. Optional auto-normalisation to sum=1.
Decaying edge with half-life ~ 3 bars
Microstructure edges decay quickly. The script does not just sum the three components per bar — it accumulates with decay:
edge_t = decay × edge_{t−1} + contribution_t
The default decay (0.78) gives the edge a half-life of approximately 3 bars — the standard market-making decay window. Older contributions fade out automatically; new contributions get incorporated immediately. This is the institutional way to track a fast signal without re-introducing flicker.
Sustained-edge signal logic
- Edge Threshold (default 0.75) — minimum |edge| magnitude required to fire.
- Sustained Edge (default 5 bars same sign) — the edge must have held its sign for N consecutive bars before a signal fires. This is the script's most important false-positive filter.
- Cooldown (default 7 bars) — minimum bars between signals.
- Asymmetric lockout (default ON) — an opposite-side signal CAN fire during cooldown. This means a quick flip from buy to sell remains responsive while consecutive same-side signals are suppressed.
Visual system
- Edge histogram — projected at the top of the chart at a configurable percent of price (default 2% of price, 1.2% top padding). Histogram columns are coloured by edge sign with magnitude-proportional intensity. At a glance you see the edge's recent trajectory.
- Buy / Sell labels with optional Unicode lightning glyph (toggleable to plain ">").
- Slope-tinted micro ribbon — the micro fast / slow EMAs plotted with a translucent fill coloured by spread sign. Toggleable.
- Subtle background shade by edge sign (off by default).
A locked Crimson Pulse palette: electric blue buy edge / lime-yellow sell edge / muted neutral on a deep crimson-black ground — the institutional HFT aesthetic.
Dashboard
9-row monospaced table positionable to any of nine corners. Surfaces:
- Edge value with status (BUY / SELL / FLAT).
- Tick imbalance value.
- Spread tightness Z.
- Micro momentum Z.
- Sustained-edge counter (how many consecutive same-sign bars).
- Last signal direction with bars-ago.
- Decay setting and effective half-life.
- Cooldown remaining.
- Configuration: LTF, weights, threshold.
Alerts
Three alert conditions, each independently controllable:
- Edge Buy
- Edge Sell
- Sustained Edge (N bars same sign) — the script's headline alert; fires before the signal does, useful as an early-warning notification.
{image]
How to read it
Three reads, in order of conviction:
- Sustained edge into a structural level — the highest-conviction read. The microstructure has been one-sided for N+ bars AND price is at a known S/R; the next move into the level usually breaks it.
- Edge buy / sell with all three components agreeing — fast directional commitment. The dashboard's per-component rows tell you whether the read is dominated by tick imbalance (aggressive tape) or by micro momentum (sustained direction) or by spread tightness (regime-aware confirmation).
- Edge above threshold but not sustained — early-warning state. Edge has crossed threshold but the sustained counter has not yet reached N. Watch the counter — if it ticks up bar-by-bar, the signal is forming; if it drops, the edge is decaying.
Suggested settings
Defaults (1m LTF, spread EMA 14 / Z 60, micro EMA 3/8 / Z 60, weights 0.45/0.25/0.45, edge threshold 0.75, sustain 5 bars, decay 0.78, cooldown 7 bars) are tuned for 5m–15m charts on liquid futures and crypto where microstructure has meaningful presence. For 1m scalping drop LTF to 15s (Premium required) and sustain to 3 bars. For HTF the script is not the right tool — microstructure edges decay too quickly to be meaningful on 1H+ timeframes.
Originality
The implementation — the three-component microstructure pipeline (tick imbalance + spread tightness + micro momentum), the LTF tick-rule reconstruction with optional Z-normalisation, the weighted-sum composition with auto-normalisation, the exponential-decay edge accumulator with configurable half-life, the sustained-edge counter and asymmetric-lockout signal logic, the price-anchored histogram render at the top of the chart, the slope-tinted micro ribbon, and the Crimson Pulse palette — is JOAT-original. No third-party code reused. The script is a tribute to Citadel-style market-making microstructure-edge extraction, not a direct replication of any proprietary Citadel code.
Limitations
Reconstructed tick direction is an inference — the tick rule is the accepted public-market proxy but is not a direct read of bid/ask. Sub-minute LTFs require a TradingView Premium or Ultimate plan. Microstructure edges decay fast by design; on 1H+ timeframes the engine produces few signals — that is correct behaviour, not a bug.
—
-made with passion by jackofalltrades
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
The AI Trading Ecosystem, Built to win trades 📈
Get Full Access 👇
jackofalltrades.vip 🌐
t.me/jackofalltradesvip 🃏
Get Full Access 👇
jackofalltrades.vip 🌐
t.me/jackofalltradesvip 🃏
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.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
The AI Trading Ecosystem, Built to win trades 📈
Get Full Access 👇
jackofalltrades.vip 🌐
t.me/jackofalltradesvip 🃏
Get Full Access 👇
jackofalltrades.vip 🌐
t.me/jackofalltradesvip 🃏
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.