← All posts

The Day a Loss Became a Law

Most trading rules are written calmly, in a strategy document, by someone who is not currently losing money.

Ours were not. The most important rule in our 2020 crypto engine was written as a commit message, on a Sunday in June, by someone who had just watched the system do the wrong thing with real capital.

The rule

never continue to buy on the way down when things are dropping and crashing, only activate … after a consolidation period

Read it again as an engineering artifact. It is not a code change description. It is a policy, written in the imperative, addressed to nobody — or rather, addressed to the person who would otherwise do it again.

He wrote it twice that day. The second one:

never activate … in down trends, never in small_losses that continue, only on the up j

Three "never"s in one day. And note the last three characters: up j. A word abandoned mid-typing. Nobody proofreads while they are still bleeding.

What it was a reaction to

The build-up is in the archive too, and it is the oldest mistake in trading.

The strategy was a momentum strategy. Its own decision logic, written out in a commit a week earlier, was cheerful about it:

Decision Logic :: [ BUY :: SPIKE ] [ Buy and ride wave up ]

Buy strength, ride it up. Fine. The failure mode of that strategy is what happens when the wave turns over and the system keeps buying — because a falling price looks, to a naive entry rule, increasingly attractive. You are not catching a dip. You are funding a decline.

Three weeks before the rule, there was already a warning shot:

flash crash detection activated on LOW

And three weeks before that, an emergency exit written by hand:

Override Sell QTY to MAX … to exit and get rid of everything before the drop

That commit is a person taking manual control of an automated system to get out. It is the least automated thing in the entire archive, and it is dated three weeks before the rule that was supposed to prevent needing it.

The good

The rule was right, and it is still right. "Do not add to a losing position in a falling market" is one of the few pieces of trading advice that survives contact with every market, every timeframe, and every strategy. We arrived at it the expensive way, but we arrived.

And it was written down at the moment of maximum clarity. Not a week later when the sting had faded and the reasoning had softened into "we should probably be more careful." It went into the permanent record while it still hurt, in the imperative, with three "never"s. That is why it was still legible six years later — because it was written angry.

The bad

The rule alone did not work, because the trigger itself was lying.

Three days after the rule was written:

bug s1 spike FAKE SPIKE >=

A fake spike is a signal that says "strength" when there is none. The rule said do not buy into a fall — but the system could not always tell it was falling. You cannot enforce a policy with an instrument that misreports the state of the world, and it took another failure to learn that the rule and the detection are two separate problems.

The ugly

It took two more weeks and a bad day before anything actually enforced it.

On 14 July 2020 the archive shows six commits in a single day:

starting new … stop loss logic put stop loss at the top stop loss formula stop loss formula 2 bbug fix stop loss sell fix stop loss formula

Read stop loss formula, then stop loss formula 2, then fix stop loss formula. That is not a feature being built. That is a mechanism being invented under pressure, wrong twice, in production, on a live account.

And here is the uncomfortable part: the stop-loss came second. The system had been trading real money for three months, through a flash crash and a hand-typed emergency exit, before anything automatically limited a loss. We built the part that takes risk long before we built the part that contains it — and that ordering is not unusual, which is exactly what makes it worth publishing.

What this became

Every one of those lessons is now structural rather than remembered.

The platform we run today will not add to a position moving against it; that is enforced by the system, not by a rule someone has to recall. Protective orders are placed as part of entry, not added afterwards when it becomes obvious they were needed. And signal quality is measured against what actually happened, because we learned in 2020 that a trigger can be confidently wrong.

None of that came from a strategy document. It came from a Sunday in June when someone wrote the word "never" three times, and then spent a month building the machinery to mean it.


RoboTrader trades CME micro futures. Trading involves substantial risk of loss and is not suitable for every investor. Past performance is not indicative of future results.