October 29, 2026 · backtesting

Your Backtest's Short Was Winning. Auto-Deleveraging Closed It Anyway.

Your Backtest's Short Was Winning. Auto-Deleveraging Closed It Anyway.

The short was the trade the backtest wanted. Mark had dropped about eight percent in eleven minutes. Unrealized profit was up. Maintenance margin was comfortable. Then the exchange bought the position in at a price that had not printed on the bid, and the rest of the crash happened in an account that was already flat.

That fill is auto-deleveraging. It is what the venue does when a liquidated long goes through bankruptcy, the order book cannot absorb it, and the insurance fund cannot cover the hole. The engine ranks the profitable shorts and starts closing them at the bankrupt trader's bankruptcy price. Your liquidation is a different event. This one happens while your margin ratio still looks fine.

The short still open at 14:03

Isolated margin, 25×, sold 2 BTC of a USDT-margined perpetual at 64,200. Mark is 59,100. Unrealized profit is 10,200 USDT. The strategy's only working order is a stop at 65,400, covering a squeeze that has not arrived. Wallet balance is the original 5,136 of initial margin. Equity is 15,336 if you count the open profit, which the exchange does.

Effective leverage has already fallen from 25× toward 8× because those 10,200 now sit in the denominator. The signal does not care. It is a trend short, it is working, and the backtest will hold 2 BTC through whatever prints next.

The longs that went through zero

The book did not walk down. It gapped. A 2 BTC long, 50×, entered at 60,600, had about 1,220 USDT of isolated margin per coin. Equity on that account hits zero near 59,390. The liquidation engine tries the offer first. On a cascade the offer is a rumor. The position goes bankrupt: the loss is larger than the margin, and someone has to pay the difference.

On an ordinary afternoon, that someone is the insurance fund. The fund is the leftover margin from liquidations that closed better than bankruptcy, sitting in a pool you never see as a time series. I do not have the venue's private balance for that hour, and neither does your research stack. You see the public consequence. Either the fund took the bankrupt long, or it started calling shorts.

The pool that was supposed to take the loss

Binance and Bybit do not haircut every profitable account pro-rata when the fund fails. They rank the other side and close from the top of the queue until the hole is filled. Hyperliquid does a version of the same thing. A backtest that treats "not liquidated" as "still in the trade" has silently assumed the fund is infinite.

If your simulator models mark price, maintenance margin, and a liquidation fill, it still has a hole. That stack answers "did I blow up?" ADL answers "did someone else blow up through the fund, and was I profitable enough to be useful?"

Five lights and a 0.665

Binance publishes the ranking. PnL percentage is unrealized profit over absolute notional. Effective leverage is absolute notional over wallet plus unrealized. If the position is profitable, the score is the product of those two. Losing positions get a different formula and sit at the back.

Our short at 14:03: notional 118,200, profit 10,200, wallet 5,136. PnL percentage is 8.63%. Effective leverage is 7.71×. Score is 0.665.

AccountShort qtyWalletScoreLightsWhat ADL does
This short2.0 BTC5,1360.6655Closed first, in full
Same clip, fatter wallet2.0 BTC40,0000.2032Untouched this round
A half-size short0.5 BTC12,0000.1752Untouched this round

The skinny winner is the first name the exchange calls. The same 2 BTC sitting on a 40,000 wallet would have dropped effective leverage under 2.5× and the score under 0.22. Adding collateral would have moved us down the queue. The backtest never considered adding collateral, because nothing was wrong with the trade.

I used to treat the five little lights on the position as decoration, the way you ignore a check-engine lamp until you are already on the highway. They are the only warning, and they tell you nothing about whether the fund still has money. Cross margin would have dunked our score too: the whole wallet goes into the denominator. Isolated is what put us at the front.

The fill at 59,390

ADL closes our 2 BTC at 59,390, the bankrupt long's bankruptcy price. Mark at that moment is 59,100. We are short, so closing means buying, and 59,390 is a worse buy than the mark. Realized profit is 9,620 USDT. Mark-to-market a second earlier was 10,200. The 580 USDT gap is the assignment penalty: you were used as the backstop, so you do not get the last print.

That fill is an assignment against a bankrupt long, not a take of the bid you were showing. There is no queue position, no post-only flag, no chance to cancel. Fee treatment is venue-specific and usually ugly. The stop at 65,400 is still working, now attached to a quantity the account no longer has. I have a support screenshot where the trader pasted the fill and wrote "I did not click this." They had not.

25×starting isolated leverage
0.665ADL ranking score
2,680 USDTcrash the account never rode

The forty minutes the backtest kept the short

Mark keeps going. Low of the hour is 58,050. The backtest, still short 2, books another 2,680 USDT of open profit and a funding payment on a position the paper account does not hold. Paper is flat. If the strategy is a trend-follower it may want the short back at 58,050. The backtest will not re-enter, because it never left. From this timestamp forward the two ledgers disagree on quantity, on funding, on the stop, and on whatever the next bar's signal does with "current position."

Partial ADL is worse to reconcile. If the bankrupt long had been 1.5 BTC, the account would be short 0.5 and the backtest short 2.0, and every later clip would be sized off the wrong inventory. And the stop is still live on the research side, covering a quantity that is a ghost.

The row the ledger has to grow

You will not get a historical insurance-fund tape with the fidelity of OHLCV. You can still refuse to pretend the fund is infinite. Log an unsolicited fill with a reason code, a bankruptcy price, and the remaining quantity. In research, stress the tail: when returns and liquidation volume spike together, force-close a slice of the highest-scoring isolated winners and do not let them keep the rest of the move. Compare that equity curve to the one where every working short rides to the low of the bar.

A short that is working is the first name the exchange calls when the other side blows up. If the backtest cannot lose that way, it is not holding the same contract the paper account will be holding when the lights go from two to five.

crypto futuresauto-deleveraginginsurance fundpaper tradingmargin
← All posts