Urgent.News

What's breaking now, across thousands of outlets.

Editions

Finance & Markets

The Most Expensive Bug in My Trading System Was Me

Any system with a human override is a hybrid, and the human half never gets profiled. Three pandas audits that recover the cost from a broker CSV export.

The Most Expensive Bug in My Trading System Was Me

The most expensive bug in a trading system was the human element interfering with the automated process. This reporter spent years shipping trading rules that described entry conditions, stop distances, and position sizes in code, but then deviated from those rules due to watching and forming opinions. A trade log records what happened, but not what would have happened, creating an invisible gap between the two.

To quantify this gap, the reporter devised an audit using pandas against a broker CSV export. The audit consisted of three monthly checks, each with its own code and results on a synthetic 214-trade dataset. The first audit, the Intervention Tax, compared the system's performance to the executed version where the reporter was in the loop. The system produced $12,337, while the executed version yielded $10,939, resulting in an $1,398 tax, or 11% of gross.

Breaking down the tax revealed that cutting winners early accounted for more than half of the loss, with 26 trades costing $2,161. The breakeven stop, assumed to be either a saving or a killer, turned out to be neutral with a $22 cost across 38 trades. Sizing up after a loss added $662 value, but this habit multiplies the size of subsequent trades, making it a variance-increasing factor.

The second audit focused on stop distance against actual Maximum Adverse Excursion (MAE). Winners had a median MAE of -0.29R and 18% of them went past -0.70R before working, while the stop was set at -1.0R. This suggested that the stop was defensible, although not necessarily optimal. A replay function was used to re-run trades with different stop levels, allowing for a comparison of the impact on returns and risk.

Written by urgent.news from HackerNoon's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at hackernoon.com →

More in Finance & Markets

More from Thursday 20 August →