Getting started
How to automate your trading strategy
By Koen van Goch · Updated
To automate a trading strategy, first turn what you do by hand into exact rules for entry, exit, sizing and when not to trade, then backtest those rules to see whether they capture your edge. Only after that, code them on a platform that can execute them with your broker. Most automation projects fail at the first step: the strategy relies on judgement that was never written down.
Step 1. Write down what you actually do
Go through your last 30 to 50 trades and write down why you took each one, how you sized it and why you exited. Look for the conditions that keep coming back. That list is your first draft of rules.
Step 2. Make every rule exact
"Strong trend" has to become something measurable, such as "price above the 50-day average and a new 20-day high within the last 5 days". "Good session" becomes a time window. If a rule can't be measured, it can't be automated. Either find a measurable version or drop it.
Step 3. Test whether the rules capture your edge
Backtest the rules. Often the result is surprising: some of your judgement added value, and some cost you money. That's useful either way. Keep the parts that make sense and hold up. Watch for overfitting while you do this; see how to avoid overfitting a backtest.
Step 4. Add the risk layer
Define how you size each position and the maximum number of open positions. Once the system runs on its own, there's no one deciding trade by trade, so sizing has to be right before you start. See position sizing in trading.
Step 5. Build it on a platform that fits your market, then run small
For stock portfolios, start with QuantumX (no code) or RealTest. For futures, NinjaTrader 8 or TradeStation (EasyLanguage) are common choices, and for CFDs and forex, MetaTrader 5. Run it on a simulator or at small size, and compare every live trade with what the backtest would have done before you scale up. More on platforms in how to choose backtesting software.