From Trading Idea to Trading System
Everything up to this point has been about looking. You can read a chart, compute an indicator, screen a universe, rank it, and pull the same measurement out of two timeframes. None of that yet commits you to anything. This part is where you commit.
A trading system is a claim written so precisely that a machine can check it against history without asking you a single question. That precision is the hard part, and almost nobody does it well the first time. The failure is rarely in the AFL. It is in the sentence the AFL was supposed to encode, which turns out on inspection to contain four decisions nobody made and two words that mean different things to different readers.
What this part is really teaching
Section titled “What this part is really teaching”Four things happen between “I noticed that stocks often bounce off the 50-day average” and a backtest report, and each of them can quietly destroy the value of the result:
- The observation becomes a hypothesis — a claim specific enough that it could turn out to be false, attached to a mechanism you can name.
- The hypothesis becomes rules — entry, exit, holding period and universe, specified so that two competent people implementing them independently would produce identical signals.
- The rules become AFL — the four signal variables, the trade price arrays, and the trade delay that separates a signal from a fill.
- The simulation acquires assumptions — fill prices, slippage, commission, liquidity limits and gap behaviour, written down where a reader can argue with them.
Skip the first and you will test something you cannot interpret. Skip the second and you will get a different answer every time you rewrite the formula, without knowing why. Skip the third and the backtester will trade on information that did not exist yet. Skip the fourth and the number at the end describes a market with no spreads, no commission and infinite depth.
The ambiguity test
Section titled “The ambiguity test”The centrepiece of this part is a test you can run without a computer. Write your rules down. Hand them to somebody who knows AFL and does not know your idea. Ask them to implement the rules exactly as written, on the same data, without asking you anything. Then compare their signals against yours, bar by bar.
Where the two sets of signals differ, you have not found a bug in their code. You have found a place where your rules were not rules — where a word like “above”, “strong”, “recently” or “confirmed” was doing work that only you knew about. Every such gap is a decision you have been making implicitly, differently, each time you looked at the chart, and it is the reason research that feels rigorous can still be unrepeatable.
Most readers do not have a spare AFL programmer on hand. The lesson gives a solo version of the same test, and a checklist of the specific gaps that generate almost all of the disagreements.
Where this sits in the course
Section titled “Where this sits in the course”Part 12 taught you to run a Scan and an Exploration; those answer questions about bars. Part 28 opens the backtester properly — position sizing, costs, stops and portfolios. This part is the bridge, and it deliberately keeps the AmiBroker surface small: four signal variables, four price arrays, one delay function, and the settings needed to make a result honest rather than impressive.
The part closes with a project that builds a complete system end to end and then refuses to improve it. That refusal is the lesson. An unoptimised result from rules chosen in advance is the only baseline against which a later, better-looking number can be judged, and you cannot recognise an overfitted result until you know what an honest one looks like.
What you need
Section titled “What you need”An AmiBroker installation with a daily end-of-day database and a watch list of reasonably liquid symbols. No real-time feed, no Professional edition, no data subscription. The AFL here is short, and every function used is checked against the official reference in the lesson that introduces it.
You should be comfortable with Parts 8 to 11 — arrays, conditions, Cross() versus a state
comparison, and writing a formula you can re-apply without retyping it. If Buy = Close > MA(Close, 50) and Buy = Cross(Close, MA(Close, 50)) do not yet feel like two clearly
different rules to you, go back to Part 9 first. This part depends on that distinction more
than on anything else.
0 / 5 lessons in this part completed
Progress tracking needs browser storage, which is unavailable here. The course works exactly the same without it.
- LessonFrom Observation to Hypothesis28 min
- LessonFrom Hypothesis to Rules30 min
- LessonFrom Rules to AFL30 min
- LessonExecution Assumptions You Must State28 min
- ProjectProject: Your First Complete Trading System60 min