About
Why I built this.
I made a trading bot that looked like it worked. Finding out why it didn't turned into a better project than the bot ever was.
I built a trading bot. It used the four indicators everyone uses — EMA, VWAP, MACD and RSI — and when I backtested it, the results looked good.
That was the problem. I hadn't done anything clever. I'd used four indicators that every retail trader already knows, on data anyone can download, and apparently beaten the market. If it were that easy, everyone would be doing it. So either I'd found something thousands of people missed, or I'd made a mistake somewhere.
I'd made a mistake. Three, actually.
I was testing on the same data I'd used to pick the settings, so I was really just reporting the best result out of everything I'd tried. I wasn't subtracting what it costs to trade — the spread, the commission, the slippage — which for a strategy trading every few days adds up fast. And my backtest was letting signals earn the same day's return, which you can't do in real life, because a signal from Monday's closing price isn't knowable until Monday has closed.
Fixing all three took most of the performance away. One of the four indicators turned out not to be what I thought it was either: real VWAP is an intraday measure that resets every session, so on daily charts it can't actually be calculated. What retail traders call daily VWAP is something else.
I found that more interesting than the bot. So this is the project now: take the indicators millions of people trade on, test them in a way that's hard to fool, and publish what's left every week. Including the weeks the answer is nothing.
How I try to keep myself honest
- Publish the bad weeks. A week where nothing worked is a result. It's also the week I'm most likely to be right about.
- Decide the thresholds first. Survived, weakened and failed are defined in code with fixed cut-offs, before I see the numbers. If I could move them afterwards they wouldn't mean anything.
- Say what's wrong with it every time. Survivorship bias, one cost assumption applied to every stock, no borrow costs on shorts. These are in every report because they don't stop being true.
- Never edit a published number. If a later week contradicts an earlier one, both stay up and I write about the gap.
- Publish the code and the data. Every figure comes from one command anyone can run. A result nobody can check is just an opinion.
The live portfolio
Testing on history only proves so much, because I could always run it again until I liked the answer. So there's also a paper portfolio trading the one strategy that survived. Orders are published before they fill, and the whole order book is public. It can't be re-run, which is the point.
Me
I'm a sixth-form student at TASIS England, applying to read economics and finance at university. I have the CFA Institute Investment Foundations certificate and a Wharton online finance certificate, and I've been writing Python trading systems for a while — which is how this started, and why the first thing it proved was that mine didn't work.
I'm not a professional and this isn't investment advice. It's a student project, run in public, with the workings shown.
Corrections welcome. If you can show me a number here is wrong, that's the most useful thing you could send me, and I'll publish the correction.
Two ways: email hello@marginco.co.uk, or open an issue on the repository — the second is better for anything technical, because the correction and my response end up public, next to the code that produced the number.