Your capital is at risk, losses can exceed deposits. Please read the full Risk Warning.

Live Support Centre

Client Resources

Algorithmic Trading Strategies

What is an Algorithm?

An Algorithm is a set of specific rules instructing particular actions to be taken, or responses to be made when certain events occur. Algorithms combine to form computer software or programs but their history predates the machine information age. 

Did You Know?

The origins of algorithms date back to 1843 and to the daughter of English poet Lord Byron, Ada, Countess Lovelace. A mathematical prodigy she worked closely with Charles Babbage who conceived and partially constructed the world's first mechanical computer. Ada saw the machines potential beyond calculations and drafted the very first algorithms.

The origins of algorithms date back to 1843 and to the daughter of English poet Lord Byron, Ada, Countess Lovelace. A mathematical prodigy she worked closely with Charles Babbage who conceived and partially constructed the world's first mechanical computer. Ada saw the machines potential beyond calculations and drafted the very first algorithms.

Today, Algorithms are involved in almost every aspect of our lives and we interact with them almost without knowing we are doing so. 

The use of Algorithmic trading allows traders to systemise and automate trades based on a set of instructions or inputs. Deploying algorithms can liberate the trader from having to constantly monitor the markets for opportunities. Algos can do this for you; highlighting certain signals or types of price action. They can even trade immediately for you on their appearance. They can also trail stop losses, manage margins and risk exposure, and perform just about any other action that you program a computer to do. Of course algos will only ever be as good as their programming ie “garbage in = garbage out,” but they are becoming ever more prevalent in today's trading environment 

Algorithmic Trading Strategies are used extensively by institutional investors to enhance and optimise their trading. Whether it's to allow them to remain anonymous, to leverage their resources by trading across multiple markets or instruments simultaneously. Or to engage in high-frequency trading to exploit price changes and order flow that happen at speeds that would be imperceptible to human traders. Once again, however, this technology is becoming more widely available to the individual retail trader.

Growth and move to prominence

Most industries have benefited from networking and computerisation over the last couple of decades, but none more so than Finance and Investment. Trading and investment has moved away from the exchange floor, initially to the dealing desk. But since the advent of the smartphone, tablets, 4G mobile and high-speed broadband networks, trading has moved venues once more. This time to the location of the end client, wherever they may be.

As the markets became more connected, the availability of information became more democratised, and anyone with the right software and connectivity could track and interact with the rise and fall of the markets. The scene was set for the introduction of Algorithmic Trading Strategies which are now one of, if not the dominant force in the modern marketplace.

How Algorithmic Trading Works - A Simple Example

As the markets became more connected, the availability of information became more democratised, and anyone with the right software and connectivity could track and interact with the rise and fall of the markets. The scene was set for the introduction of Algorithmic Trading Strategies which are now one of, if not the dominant force in the modern marketplace.

"If the price of instrument "A" rises above its 20 period SMA (or simple moving average) then buy 3 lots of that instrument. Or if the price of instrument "A" falls below its 20 periods SMA then sell 3 lots of the instrument."

We have now created a simplistic trading algorithm. We can’t say anything about how it will perform or the returns it may generate. Thanks to modern trading software, such strategies can be backtested. That is, applied to the record of historical trading data and price action in order to get a sense of how successful or efficient they may be. 

Types of Algorithmic Trading strategies

TWAP / Time Trigger:
TWAP or Time Weighted Average Pricing is also known as time slicing.
Under which a large buy or sell order is segmented into smaller portions, which are executed individually after a specific period of time has elapsed. Be that every 5 minutes or fractions or a second. A variation on this theme are algos that trade at a specific time of day. Perhaps on the opening of an equity market or on the release of a regular data point or recurring event, for example, the weekly close in New York.

The Iceberg:
Iceberg orders are submerged, that is only a small amount of the order is visible to the market at any one time. The bulk of the order remains below the “water line”. The Algorithm interacts with preset parameters for volume and price participation and refreshes the order each time a segment of the main order has been filled. Iceberg orders are used to accumulate or exit from large positions without disturbing the underlying market or disclosing the size of the total order.

These strategies are more about efficient execution at the entry into or exit from a position.  Though deviations by price from the prevailing VWAP, VPOC or CHVN can also create very informative signals.

Momentum strategies:
Algorithmic momentum strategies try to identify and capture trends within price action. Effectively automating the role of the Swing trader. The simple 20d SMA based algorithm we set out above, could be thought of as momentum strategy. Momentum-based algorithms may scale into or out of a position by increasing or reducing the exposure based on the acceleration of the trend. Building a position in “size” for example if the price moves above or below consecutive moving averages, or breaks specified period highs or lows. Conversely, they may scale back the exposure if those factors start to weaken or reverse direction. To enable this, momentum strategies may also contain or rely on data from specific indicators. 

Indicator-based strategies:
Indicators are used by traders to identify changes in price action, trends or other behaviours. Such as deviation from a volume weighted price point or an over extension of, or declaration in the momentum within the price action. These types of behaviours are often highlighted via the comparison of the current price action with its historical counterparts, usually on a rolling basis.
 
RSI 14, Stochastics and Bollinger Bands are all examples of these types of behaviour tracking indicators. Being mathematically derived they can be quickly incorporated into Algorithmic trading strategies, which are themselves mathematical constructs. Of course, Algorithmic traders are also likely to customise these and other indicators to fit their own particular trading parameters. 

Arbitrage / Statistical Arbitrage: 
These strategies aim to identify price differentials between instruments quoted in different markets or between assets which share known and “predictable” relationships with each other. Arbitrage strategies seek to exploit mispricing in these instruments, be that over or under valuation. 

An example of a relationship that could be subject to arbitrage trading is between the GBPUSD FX pair and the UK 100 equity index, similarly the EURUSD rate and the Germany 30 index. Movements in the respective FX rates should have a predictable effect on the value of the equity indices. Both of which count a large number of exporters among their constituents.

Currency movements affect the exporter's flow of future earnings, as the goods and services they sell fluctuate in price from the standpoint foreign currency buyers of their products. 

The indices and the FX pairs are said to be correlated. Those correlations can form the basis of a mathematical model that calculates how a much-given move in the FX rate should be reflected in a move in the associated equity index. If the actual change in the index value does not match the model's prediction, then the algorithm will buy or sell accordingly, in order to exploit the perceived mispricing.

Note that all FX pairs and crosses are correlated to a greater or lesser degree. This is simply because of their relationship to the US Dollar in its role as the global reserve currency and the base, from which all other FX rates are calculated.

Complexity

Today's algorithmic trading strategies are becoming more complex and at an institutional level, they are now starting to learn and think for themselves. Through the deployment of deep learning techniques and cutting-edge technology, such as neural networks. Similar applications power the voice search and personal assistants on mobile phones and other devices.

But as with most things in life, there is a tradeoff or compromise at work here. Basic algorithms such as our 20d SMA example above can be very efficient at following and executing their instructions. But they have no ability to react to situations that are outside of their parameters.

For example, our simple algorithm would take no action if the price of an instrument a traded continuously between the 5 and 10 day SMA, but did not ever breach the 20-period line. Of course, we can add complexity or more rules if you prefer, to the algorithm to correct this. 

Remember:

 The more complexity you build into the algorithmic model the more unstable it becomes. 

 Instability (in this context) refers to the operation of and output from the algorithm. Complicated algos have to overcome contradictions, logic lockouts and be able to recognise abstract concepts, such as context or multiple variables and inputs. That's not an issue at the level of complexity that most retail algorithms operate at. But it is a headache for the data scientists and quants who are trying to successfully deploy intelligent Algorithmic Trading Strategies.

This explains why most Algorithmic Trading strategies focus on just a few elements, factors or trading styles rather than trying to address the trading universe as a whole. 

Sources of algorithmic strategies

Both the MT4 and cTrader platforms are equipped to deploy  Algorithmic Trading strategies through the use of Expert Advisors or Cbots. Both platforms have their own programming languages in which Algorithmic Trading Strategies can be constructed and tested. But if you don't want to code your own strategies you don't have to. As there are pre-built algos available for traders to utilise. Bear in mind, however, that these are third-party applications and Pepperstone makes no warranty about their performance or use. 

Further details about the creation, use and installation of EAs and Cbots can be found below:

VPS (Virtual Private Server)

One of the idiosyncrasies of expert advisers or trading robots within the MT4 environment is that the machine the program is running on must be left on and connected to the network, for the robot to operate. This is particularly important if you’re running stop losses as part of the algorithm, as the robot is meant to be active when you are not in front of the screen yourself, for example, overnight or if you are travelling. Clearly, it's not always going to be convenient, practical or desirable to have your machine open and running in these circumstances. Nor can we rely on mobile or even wired communication networks to have 100% uptime.

Help is at hand in the form of the Virtual Private Server or VPS. Hosted in modern data centres the VPS service allows Forex traders to run their algorithmic trading strategies, including expert advisors, 24 hours a day 7 days a week on a dedicated Virtual Machine. Thus minimising the chance of system downtime due to technology and connectivity failures. Details of Pepperstone’s VPS hosting services can be found here VPS details.

I hope that this guide has given you an insight into Algorithmic Trading Strategies and the use and importance in the modern financial marketplace. This area of trading is developing rapidly and will continue to do so. We will of course keep you up to speed with any developments or new products we deploy in this area.  

In the meantime if you would like to find out more about algorithmic trading strategies and what's available to retail traders, you might want to visit MQL5.com the Meta quotes website and marketplace, which contains a plethora of information and resources on the subject.

Other websites and resource to be aware of are EABuilder and Tradeworks both of which have tools and resources  to assist traders in the creation of their own Algos. Or you may consider asking your account manager about RoboX which has access to thousands of Algos and is free for Pepperstone clients. 

For more of Pepperstone market analyst Darren Sinden's content, you can check out his Daily Market Update (key market news in minutes) or follow him on Twitter.