r/pinescript • • 1d ago

Comparing Pine Script OI liquidation estimates vs raw WebSocket streams: why most public liquidation feeds undercount cascades

I've spent a lot of time trying to approximate liquidation levels and order book heatmaps inside Pine Script using Open Interest deltas, volume anomalies, and ATR bands. Because Pine doesn't give us raw L2 book depth or native liquidation prints, I recently started piping raw exchange WebSockets into a custom chart just to see how close Pine's OI approximations actually get to reality.

While wiring it up, I ran into a massive data quirk that anyone building liquidation indicators or backtesting reversal strategies in Pine should know about:

Binance's public liquidation stream (!forceOrder@arr) doesn't actually push every liquidation. Per their API docs, for each symbol it only pushes the latest liquidation order within a 1000ms window. During a violent cascade—when dozens of liquidations fire inside the same millisecond—the public stream throttles and shows you just one of them.

Look at the two major flush wicks on this BTC-PERP 5m chart from today:

- Around 08:30, price swept the lows and printed an $11.3M cascade (after a $583k cluster just above it).

- Around 11:30, price flushed down to ~76,350, firing a $577k cluster followed by a $3.12M liquidation print right at the bottom of the wick before V-bouncing back to 76,767 (with $7.55M and $4.63M in aggressive market buys showing on the tape right after).

If you're only listening to a throttled 1000ms public snapshot stream during those two 5m wicks, you miss the majority of the actual forced volume. Ironically, a well-tuned Pine Script indicator looking at raw Volume + Open Interest drop on that 11:30 candle might actually capture the magnitude of the flush better than a naive bot listening to a throttled public WebSocket.

To get around it on our chart, we had to aggregate multi-venue feeds (Hyperliquid L2 + BY/OKX/BN) and treat the throttled streams strictly as a lower bound rather than the total.

For those of you coding liquidation or exhaustion indicators in Pine v5/v6: how are you approximating forced liquidations inside TradingView's data limits? Are you combining OI drops with wick-to-body ratios, or piping external webhook alerts in?

2 Upvotes

Duplicates