← Blog

Your trading bot needs a black box recorder

The first time one of my bots did something genuinely stupid in a live session, I opened the logs and found this: a timestamp, a symbol, and a fill. That’s it. No idea why it entered. I spent the evening reverse-engineering my own code to reconstruct a decision the bot had made and then forgotten.

That night I started treating bots the way aviation treats planes: assume it will do something you don’t expect, and make sure the recorder is already running when it does.

A black box for a trading bot is just disciplined telemetry. Every meaningful moment gets logged with its reason, not just its result:

  • Signal — the setup name, the indicator values that fired it, the filters it passed. NR7_breakout · vol z=2.1 · OFI+, not signal.
  • Order and fill — intended price vs filled price, so slippage is visible, not inferred.
  • Risk — daily P&L, drawdown used, halt state, at the moment of the decision — not reconstructed afterward.

The payoff isn’t when things go well. It’s the post-mortem. With a real recorder, “why did it take that trade?” has an answer in five seconds. Without one, you’re debugging by memory and vibes, and you’ll “fix” the wrong thing.

There’s a subtler benefit too: the act of logging a reason forces your strategy to have one. If your code can’t say why it’s entering in one line, that’s not a logging gap — it’s a thinking gap, and better to find it in the log format than in a drawdown.

Build the recorder before you need it. You will need it.

Activate your code →