Learning to code with an AI copilot
The single biggest change in learning to build software: you now have a tireless tutor and pair-programmer on tap. Here is how to use it — and its two failure modes.
This course assumes something that would have been science fiction a few years ago: you have an AI coding assistant beside you the entire way. A tool like Claude, ChatGPT, or GitHub Copilot can explain a concept five different ways, write a first draft of a backtester, find the bug you have stared at for an hour, and translate Python into MQL5 — in seconds. Used well, it is the fastest way to learn to build that has ever existed.
Used badly, it is the fastest way to build something that looks right, passes a beautiful backtest, and quietly loses money live. This part is about the difference.
What an AI copilot is brilliant at
- Explaining — "explain this line", "what is a DateTimeIndex, with an example", "why use
.shift(1)here?". A patient tutor that never sighs. - Drafting — turning "vectorised SMA-cross backtest with costs" into a runnable first version you then interrogate.
- Debugging — paste an error and the code; it usually spots the cause faster than you.
- Translating — the same strategy from Python research into an MQL5 Expert Advisor (Part 9), or between libraries.
- Boilerplate — config files, logging, argument parsing, tests — the stuff that is tedious, not clever.
What it is dangerous at (especially for trading)
AI models predict *plausible* text. In most coding, plausible-and-slightly-wrong gets caught the moment you run it. In trading, some of the most damaging bugs run perfectly and produce great numbers — they are wrong in ways only a domain expert notices:
- Look-ahead bias — the model happily writes a backtest that peeks at the future (using today's close to decide today's trade). It runs, it looks amazing, it is a fantasy.
- Hallucinated APIs — confident calls to functions or parameters that do not exist in that library version.
- Unrealistic assumptions — zero costs, perfect fills, survivorship-biased data — unless you explicitly demand otherwise.
- Overfit suggestions — ask it to "improve the backtest" and it will gladly tune parameters until the curve is gorgeous and the edge is imaginary (Part 6).
The rest of this part turns that mindset into a concrete workflow: the loop you run, how to prompt for trading code, and the verification checklist that catches the expensive mistakes.