My Model Learned to Trade for Free

One of my early models found trades that looked reliably, almost boringly profitable — a steady drip of small gains, the kind of consistency that makes you think you have finally found something real.

It had found something. It had found a world where trading is free. In that world, the model was genuinely good. The trouble is that I, and everyone else, have to trade in a different one — and the moment I made trading cost what it actually costs, most of that lovely profit simply evaporated.

The edge that lived in a world without costs

The strategy’s signature was lots of small, frequent wins. Individually, each capture was tiny; together, they added up to a smooth, encouraging curve. I remember being quietly proud of it. It did not look like a fluke. It looked like a discipline.

What I had not accounted for was that every one of those small wins was being measured in a setting where the act of trading was costless — where you could enter and exit as often as you liked and never pay for the privilege.

The assumption I never noticed I was making

Here is the quiet flaw. When I generated the data the model learned from, I treated each trade as if it were free. No fee for transacting. No slippage — no gap between the price I imagined and the price I would really get. So a trade that captured the smallest favorable flicker was recorded as a win, even when that flicker was smaller than what it would have cost, in the real world, to make the trade at all.

I was not lying to the model on purpose. I had simply built its entire understanding of “a good trade” on top of an assumption — that trading is free — which is generally unrealistic anywhere money actually changes hands.

Costs don’t shrink returns; they change the verdict

The instinct is to think of costs as a flat tax: do the analysis, then subtract some fixed toll at the end. That intuition is what makes this mistake so easy to commit, and it is wrong in an important way.

A cost does not just make a winning trade win a little less. It can change whether a trade was a winner at all. A move that is profitable before costs can be a loss after them. And if your labels — your very definition of which trades were good — are computed as though costs do not exist, then you are not merely overstating performance. You are mislabeling some losers as winners, and then teaching a model to go find more of them.

Why this is worse than it sounds

The cruel part is the selection effect. Frictionless testing can disproportionately favor high-turnover strategies — the ones that trade constantly, harvesting a multitude of tiny edges. That is also, precisely, the profile that real-world costs punish hardest, because every one of those many trades pays the toll.

So a costless backtest does not overstate all strategies equally. It tends to fall most in love with exactly the strategies that costs will hurt fastest. You go looking for an edge, and your overly generous simulation hands you something cost-fragile, wrapped in the most attractive-looking curve it can produce.

The fix: put the cost into the definition of “good”

The repair was to stop treating cost as an afterthought and move it into the truth the model was trained on. I folded the round-trip cost of trading — fees and an estimate of slippage, while knowing this still would not capture every real-world cost — into the label itself, so that a trade only counted as good if it was still profitable after paying to exist. A move that could not clear that bar was labeled for what it really was: not worth making.

The model’s apparent performance fell, sometimes sharply. That fall was not a regression. It was the fantasy draining out of that early prototype, leaving behind a training signal that was at least less detached from a market that charges you to participate.

A backtest is a world you build

The lesson underneath this one is bigger than fees. Every backtest is a small simulated universe, and it is only ever as honest as the rules you choose to put in it. Leave out costs and you have not built a neutral test — you have built a world kinder than the real one, and any model that learns to thrive there has learned to thrive on a generosity that does not exist outside your simulation.

The market’s first lesson to a new strategy is almost always some version of the same one: that it is more expensive to act than you assumed. You can either teach your model that lesson up front, in the safety of a simulation, or let the market teach it later, with real money, at full price. I would rather pay for the lesson in the cheaper classroom.

A strategy that is only profitable when trading is free is not really a strategy. It is a discovery that you forgot to charge yourself for making.

— No signals, no returns, not investment advice.