Skip to content

CFDs are complex financial instruments and come with a high risk of losing money rapidly due to leverage. You should consider whether you understand how CFDs work, and whether you can afford to take the high risk of losing your money. CFDs are complex financial instruments and come with a high risk of losing money rapidly due to leverage. You should consider whether you understand how CFDs work, and whether you can afford to take the high risk of losing your money.

How to create an automated forex trading system

An automated forex trading system executes trades on your behalf using the exact parameters that you have set. Learn how to create, backtest and run an automated forex trading system for platforms, including MT4 and ProRealTime.

Forex Source: Bloomberg

What is a forex trading system?

A forex trading system is essentially a set of rules used to execute trades on one or more currency pairs. While these systems can be implemented manually, many traders use automated systems – based on computer code – to take emotion out of the equation and execute trades more efficiently. These automated systems are effectively ‘trading robots’ that can monitor the markets at any time of day, looking for opportunities and executing trades according to a set script.

Creating vs buying an automated forex trading system

You can create an automated forex trading system for many of the platforms that IG offers, including MetaTrader 4 (MT4), ProRealTime, and our regular online trading platform via an API. With MT4 and ProRealTime, it’s also possible to buy and install pre-built systems made by a third party.

Building a custom system

The main benefit of building a custom system is that the options are practically limitless – the only constraints being your imagination and what can be coded. However, building a bespoke system will require an in-depth understanding of financial markets, trading and technical analysis . You’ll also need to convert your system into code, though it is possible to hire a developer once you have designed the system on paper.

Buying an off-the-shelf solution

If you use MT4 or ProRealTime, you also have the option of buying an off-the-shelf solution, known as an ‘Expert Advisor’ (EA) on MT4 and an ‘automated trading strategy ’ on ProRealTime. While using one of these systems is much easier than coding a strategy from scratch, it’s important to research and test any third-party solution thoroughly to make sure it fits in with your trading goals and actually does what it says. This is because many third-party solutions make bold claims – like being the ‘best forex trading system ’ – but fail to live up to the hype.

How to build an automated forex trading system

If you’ve decided you want to build your own automated forex trading system, here’s how to get started:

Create a trading plan

To get the most out of your time on the markets, it’s a good idea to create a detailed trading plan – a blueprint for your trading activity that can help you define your aims and how your automated system will help you achieve them. Among other factors, it is useful to consider:

  • Which market (or markets) you want your system to trade
  • When you want it to operate
  • What its risk-reward ratio should be
  • What strategy it will use

Design your system

Once you’ve decided what you want your system to do, the next step is to work out how this will be achieved. In particular, it’s important to consider how your system will actually identify trading opportunities, and what you want it to do when it finds one. It could place trades on your behalf or simply send you an alert.

When designing your system, it can be helpful to think about the tools and indicators you normally use to identify trends (such as RSI and moving averages) and how you decide when to place trades. Remember, most automated trading systems rely on technical analysis, rather than fundamental analysis, so a good knowledge of this area and how it can inform your trading is critical.

Choose risk management tools

The most important part of designing your system is deciding what risk management tools it will use – so important, in fact, that we’ve included it as a separate step here. With IG, you’ll have access to up to three types of stop, depending on which platform you are using:

  • A basic stop closes your position as near as possible to the price level you specify. This can sometimes be at a worse price than requested if the market moves quickly or ‘gaps’
  • A guaranteed stop always closes your position at the level you specify. You’ll pay a small premium if the stop is triggered
  • A trailing stop follows positive price movements to lock in profits. Again, the stop level is not guaranteed so it could slip if the market moves quickly

You can also use a limit to automatically close a trade if the price moves to a more favourable level. Unlike a stop, if a limit is triggered and filled it will be at your chosen price or better.

Build your automated forex trading system

Once you’ve designed your system on paper, the next step is to convert it into code. Each platform uses a different coding language, so you’ll need to design your system for the specific platform you plan to use.

While it’s helpful to have an understanding of what can be coded, you don’t need to have an in-depth knowledge of coding yourself. This is because it is always possible to hire a developer to create your system for you. To find out more about how to find and hire a developer, contact our technical support team.

Backtest and refine your automated forex trading system

The final step involves backtesting your trading system using historical data, and refining it to achieve your desired metrics – for example, a high percentage of winning trades or low drawdown.

This is a very important step – whether you have chosen to buy an off-the-shelf system or build your own – as it will give you a fair idea of how the system is likely to perform without putting your capital at risk.

However, while backtesting is a useful way to gauge the efficacy of your system, it does have limitations. Static data is not always representative of what will happen in a live trading situation, as it may not take factors such as liquidity into account.

Running your trading system

Once you’ve set up and optimised your system, it’s time to put it into action. However, ‘automation’ doesn’t mean you can simply walk away from your computer. You must always keep an eye on what’s happening in case of unexpected problems or changing market conditions, as even the best automated trading systems will have some flaws or quirks.

What’s more, they generally ‘make decisions’ based on technical analysis alone, so may not be geared up to assess the effects of economic events or other market conditions – factors a human trader may consider as part of their fundamental analysis.


This information has been prepared by IG, a trading name of IG Limited. In addition to the disclaimer below, the material on this page does not contain a record of our trading prices, or an offer of, or solicitation for, a transaction in any financial instrument. IG accepts no responsibility for any use that may be made of these comments and for any consequences that result. No representation or warranty is given as to the accuracy or completeness of this information. Consequently any person acting on it does so entirely at their own risk. Any research provided does not have regard to the specific investment objectives, financial situation and needs of any specific person who may receive it. It has not been prepared in accordance with legal requirements designed to promote the independence of investment research and as such is considered to be a marketing communication. Although we are not specifically constrained from dealing ahead of our recommendations we do not seek to take advantage of them before they are provided to our clients.
CFDs are a leveraged products. CFD trading may not be suitable for everyone and can result in losses that exceed your initial deposit, so please ensure that you fully understand the risks involved.

Evaluate your trading performance

Monitor and analyse your personal trading data with our trade analytics tool – available in live accounts.

  • Get an overview of your trading history
  • See your total returns from closed positions
  • Identify mistakes and learn how to maximise successes

You might be interested in…

Find out what charges your trades could incur with our transparent fee structure.

Discover why so many clients choose us, and what makes us a world-leading provider of CFDs.

Stay on top of upcoming market-moving events with our customisable economic calendar.