Algorithmic Trading Models — Machine Learning (Part 1)
By: Dhruva Krishna
Tags: Forex, AI, Algorithmic Trading, Artificial Intelligence, Machine Learning

In the fifth article of this series, we will continue to summarise a collection of commonly used technical analysis trading models that will steadily increase in mathematical and computational complexity. Typically, these models are likely to be most effective around fluctuating or periodic instruments, such as forex pairs or commodities, which is what I have backtested them on. The aim behind each of these models is that they should be objective and systematic i.e. we should be able to translate them into a trading bot that will check some conditions at the start of each time period and make a decision if a buy or sell order should be posted or whether an already open trade should be closed.

Please note that not all of these trading models are successful. In fact, a large number of them were unsuccessful. This summaries series has the sole objective of describing the theory behind different types of trading models and is not financial advice as to how you should trade. If you do take some inspiration from these articles, however, and do decide to build a trading bot of your own, make sure that you properly backtest your strategies, on both in and out of sample data and also in dummy accounts with live data. I will cover these definitions and my testing strategies in a later article.

Introduction

I’ve written 4 articles on theoretical concepts behind algorithmic trading models. The previous articles have covered breakouts, moving averages, oscillators and cyclical methods. The 5th model type, machine learning methods, is considerably more involved due to the scope of the topic and so this article is definitely not designed to be a white paper on the only way ML can be used in algorithmic trading. My goal in this article is to provide one framework that incorporates some form of computer learning to predict future prices of the GBP/USD rate. You can consider this part 1 of Algorithmic Trading Models — Machine Learning, because there’s a huge scope that can be covered in this topic that I wouldn’t be able to in one article and I will be writing more with alternate ideas in the future.

Since this is the first article in this series, I want to outline a fairly straightforward application, using a Linear Regression. My aim is to produce an algorithm that identifies minimum and maximum points in the closing prices of the GBP/USD exchange rate. I have roughly 17 years of data from Yahoo Finance, 70% of which will be used for training and the remaining 30% for testing. It’s worth noting here that the algorithm produced is as a result of no parameter tuning or evaluation, it’s more an opportunity to expose potential starting points for designing a project like this.

Methodology

This method begins with the Zig Zag indicator, which can be found on most well-known charting platforms. The Zig Zag Indicator is a lagging indicator that identifies minimum and maximum points in a graph. It marks a maximum point as soon as the chart has fallen by a pre-defined percentage and marks a minimum point when the chart has risen by a pre-defined percentage. Connecting these points by straight lines gives us the historical shape fluctuations of an asset, with the noise stripped away. An example of this is shown in the image below.