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.

FAQ

Common questions

Can every trading strategy be automated?

No. If part of the edge comes from reading context that can't be measured, it may not survive automation. Often a simpler, testable version captures most of it.

What's the best platform for automating a strategy?

The one that supports your market and broker and that you can work with. For stock portfolios, dedicated platforms such as QuantumX or RealTest; for futures, NinjaTrader 8 or TradeStation; for CFDs and forex, MetaTrader 5.

Do I need to code?

Someone has to, unless your platform is no-code. You can learn, use AI tools to help turn clear rules into code, or work with a developer. Exact rules make all three easier.

Will automating improve my results?

Not necessarily. It makes execution consistent. If the rules have an edge, consistency helps. If they don't, automation just loses money more consistently.

How long does it take?

Writing and testing the rules usually takes longer than the coding. Expect weeks to months, depending on complexity and how much you test.

Want help turning your trading into rules you can automate?

I help with the rule design and testing; you or your developer do the coding. Request a free 30-minute introductory call.