Skip to main content

NotesEssays

Derive exits from costs, don't fit them

With two trades of training data, a fitted exit is a search. I built the exit out of measured costs instead.

What I was looking for

An exit rule for a market-making test that couldn't overfit two trades of data.

What happened

The Liquidity Engine records BTC perpetual order books on Binance, Bybit and OKX and replays them exactly. Before testing a market-making idea on it I needed an exit: where to take profit, and when to give up.

The obvious move is to fit one. Try a grid of take-profit levels on the training sessions and keep the best. But those sessions produced at most two engine cycles per variant. Fitting anything to two trades does not find an exit. It finds whichever number happened to suit those two trades, and the test that follows then measures my search, not the idea.

So I built the exit from things I had measured. A round trip of maker fees costs 346 ticks. Orders resting at the touch saw about 55 ticks of adverse drift within one second. Add a margin, and the take-profit sits at 450 ticks. If it isn't reached, the position exits at the touch after 60 seconds.

That left no free parameter to overfit. When the strategy then failed its registered test, I knew the failure belonged to the idea and not to a badly chosen number. That is the point: a result you can't attribute is not a result.