FX Trader Magazine Article: A simple machine learning example

As you may have read before on my blog, this year I started contributing to FX Trader Magazine with the hope of becoming a regular contributor to this publication. This month the second issue for the year has been released and with it my second contribution which talks about the creation of a very simple machine learning algorithm using the F4 framework. You can get a free copy of the magazine here. On this blog post I want to go a bit deeper into this contribution, why I wrote this article, how it can be expanded and why I consider it an excellent introduction for those of you who might be interested in the creation of machine learning trading strategies to trade the financial markets.

Selection_916

My idea with this article was to write a simple guide that could serve as an introduction to the practical creation of machine learning strategies and in particular neural network strategies for Forex trading. Most people generally have access to either obscure academic literature or implementations that cannot be easily back-tested or live traded. Traditional academic implementations generally perform trading on a large amount of data, leaving some data out for cross-validation and out of sample testing, a methodology that is filled with bias related problems and that does not work in practice if you want to live trade. Problems going from bias in the selection of the in-sample and validation periods to data-mining bias introduced by constantly repeating in sample simulations until a “good out of sample” is obtained are some of the problems that doom this type of methodology to fail.

In my article you get access to a simple constantly retraining neural network that can be very easily both back-tested and live traded. The article uses EUR/USD daily data and performs a very simple prediction of the next day’s return using a series of past return values. Retraining is performed on each bar – avoiding all the problems with the traditional academic approaches – and the system exits trades either via a stop loss or a signal in the opposite direction. The strategy is very easy to understand, it uses three inputs to predict one output and therefore gives a very clear example of how a neural network strategy is constructed.

Selection_917

After getting used to this system’s code it is then very easy to either expand it or change it to perform other types of experiments. For example things like the number of epochs used for training, the number of examples used per bar or the stop loss can be changed in order to evaluate their effect on the neural network strategy. Moreover the topological aspects of the neural network, such as the number of neurons in the hidden layer or the functions used by the neurons can also be changed to lead to potentially different results. If you become an Asirikuy member to access the F4 framework you will be able to reproduce the back-testing results showed therein and even trade that strategy live if you desire to do so.

One thing I wanted to show with this article is how the F4 framework integrates everything such that the exact same code is used for back-testing and live trading. Unlike other platforms that do machine learning there is no need to jump through hoops or recode entire sections of code to live trade a machine learning strategy that constantly retrains but this procedure can be carried out without any coding changes by simply loading the strategy on one of our live trading platforms (either our AsirikuyTrader that trades directly via API with Oanda/Dukascopy or Metatrader 4). This means less potential for errors and a much faster ability to take ideas from a back-test to live trading.

Selection_918

Of course the algorithm showed in this article is just the simplest possible neural network implementation I could think about but right now at Asirikuy we are testing many different kinds of algorithms to find the machine learning approach that works best. From neural networks that work using maximum long/short excursions to algorithms that attempt to predict trade outcomes with specific trailing stop management mechanisms – or even that attempt to predict the best trade management mechanism for a trade – we strive to create an understanding that can help us achieve better results and profitability. If you would like to learn more about machine learning and how you too can create your own machine learning systems using F4 and start creating your own machine learning system repository  please consider joining Asirikuy.com, a website filled with educational videos, trading systems, development and a sound, honest and transparent approach towards automated trading.strategies

 

Print Friendly
You can leave a response, or trackback from your own site.

Leave a Reply

Subscribe to RSS Feed Follow me on Twitter!
Show Buttons
Hide Buttons