Machine Learning in FX trading: Beyond the hype and some useful algos

Thomas A. Papapolyzos and Stelios Choumas outline a simple algo and ML based tool that can be used by FX traders to improve performance

Artificial Intelligence and Machine Learning practices & tools have invaded the Financial Markets in recent  years, providing alternative approaches in the creation of trading/investing strategies, beyond the use of various Econometric models for prediction, or the use of tools based on Fundamental or Technical Analysis. The usual econometric models have not delivered as promised in financial assets prediction, since they cannot capture most of the nonlinear, complex & hierarchical relationships between various financial variables.

Furthermore, the current models cannot take advantage of the huge data sets with high dimensional data, few observations & often nonnumeric data. Machine Learning can solve many of the problem’s econometrics have faced & help us identify patterns in vast amounts of multidimensional data sets. But are these patterns exploitable & can they produce real alpha?

The truth is that most models & methods in ML for finance have not delivered yet as promised, despite the significant achieved progress in understanding & formulating the main problems we must solve. 

In the FX domain, we have vast amounts of good quality data which are widely available & give us the opportunity to apply many different ML methods & algos, like Deep Learning or Reinforcement Learning. In a-Quant having worked with many ML models in predicting various assets like stocks, commodities, ETFs etc we would say that predicting FX prices is probably the hardest task compared to predicting other assets. The very low signal to noise ratio & the high efficiency of the FX market do not allow to derive predictive models & exploit inefficiencies, working in various time frames & regimes & deliver alpha in out of sample real market conditions. But we can do many things beyond predicting prices & develop very useful tools for FX traders to enhance their chances.

For example, using unsupervised learning methods with cross asset data, we can discover new features in FX models & choose the right set of features for further use in systematic or discretionary trading. We can develop a set of rules of what to avoid or identify best practices & incorporate them in execution algorithms specific for each FX pair & under certain conditions. In other words, we can develop meaningful alpha producing models in specific corners of the markets for specific time frames & under certain market conditions. Every successful trader has a few winning setups. With ML based tools we can identify many more successful setups in many more assets simultaneously with much less effort. The number of cases we can apply ML in FX trading are limitless & the war for alpha producing FX-ML tools has just begun.

A simple ML based tool for traders

Even though there are many complex methods, algos & tools to try & use in FX trading, simplicity & explainability have their unique merit when reality kicks in.

In the following sections, we will present a simple algo/tool that can be used by FX traders to improve performance.


The objective of this little project is to produce some Foreign Exchange forecasts that can also produce profitable investment strategies via Artificial Intelligence/Machine Learning algorithms. The two goals of our research are:

  • to define the market direction (up/down) daily
  • to define the trend or mean reversion market regime (market condition) daily

The above goals  taking advantage of power Machine Learning methodologies will allow us to create profitable strategies, systematic or discretionary that can use the results of the daily classification (market direction and condition) as an input.

This is a classical classification problem in FX prediction & even though seems to be simple & naïve, it’s one of the solvable problems in the sense that can produce exploitable & tradable information in real settings. The next paragraphs describe a simple version of classification algorithms in order to predict next day market direction & regime for 3 FX pairs.

Traders Workshop
There are vast amounts of good quality data in the FX domain to apply many different ML methods & algos

Datasets and features

We used daily data for the most popular, according to the daily volume, FX currency pairs: EURUSD, USDJPY, and GBPUSD. The features that we selected to use in our Machine Learning models, are shown in Table 1.

The selection of the features reflects all the basic aspects of the market: 

Open/Close/High/Low prices contain information of the price action, RSI Indicator spots any overbought/oversold market conditions, MACD Oscillator for the trend and momentum, ADX Indicator for the strength of the trend and ATR for the daily Volatility. Also, the parameter values that we used (e.g., the periods of each Indicator) are the most commonly selected by traders. We avoided optimizing the parameters of each Technical Indicator to avoid overfitting. We also avoided to include other cross asset features specific to each FX pair in order to have a uniform approach across pairs & keep it simple.

Data processing

In both problems (market direction and market condition), we use the same process on how to define the daily direction (up/down) and how to define the market condition (trending or mean reversion mode). We split the data into 60% train set, 20% validation set, and 20% test set. These subsets are taken sequentially to keep the time-series character of the data and to ensure that the training of each data set is based exclusively on past data. 
To translate the daily direction problem into a binary classification problem, we use a Signal variable, and accordingly, to translate the market condition problem into a binary classification problem, we use a Condition variable. The exact mathematical elaboration is beyond the scope of this article.

Models and algorithms

For both Signal and Condition variables, we tested a variety of Machine Learning binary classification models. The models that we used are the most common and powerful models for dealing with binary classification problems:

  • Logistic regression – a Machine Learning model which uses a logistic function to model a binary independent variable.
  • Support Vector Machine (SVMs) – a Machine Learning model which maps training examples to points in space to maximize the width of the gap between the two categories.
  • k-Nearest Neighbours (k-NNs)– a Machine Learning algorithm that stores all available cases and classifies new cases based on a similarity measure.
  • Decision Trees – a Machine Learning algorithm that uses a tree-like model of decisions.
  • Artificial Neural Networks (ANNs) – structures that simulate the human brain through a collection of units called artificial neurons, connected through edges that have weights that adjust as training proceeds. We used an Artificial Neural Network with two hidden layers as a result of the application of Genetic Algorithms (an optimization technique based on the principles of genetics and natural selection).

Our choice for loss calculation is the mean-squared error which measures the average of the square of the errors - an exceedingly popular & reliable technique. The activation function that we used is the sigmoid function. Finally, we used dropout or activation regularization to avoid overfitting.

Traders Workshop


We tested all the Machine Learning binary classification algorithms on the three most popular FX currency pairs: EURUSD, USDJPY, and GBPUSD in 5 years, between 1/1/2016 and 1/1/2021. The selected period contains many and different market situations for EURUSD, USDJPY, and GBPUSD with many changes in their trend and volatility levels.

Table 2 presents the statistical performance of every model for the daily Direction (Up/Down) problem.

Test performance is marked with red color. Best performance on the test set by Artificial Neural Networks (ANNs).
Table 3 presents the statistical performance of every model for the daily Condition (trend/mean reversion) problem.

Test performance is marked with red color. Best performance on the test set by Support Vector Machines (SVMs).

The accuracy of both Daily Direction and Daily Condition are presented in the following charts as well:
As we see, Artificial Neural Networks delivered the best predictability for defining the daily market direction with a test accuracy very close to 67%. Support Vector Machines followed with fairly good results. Support Vector Machines was the winning model for defining the daily market condition, as the test accuracy was close to 69% and Artificial Neural Networks was in second place with competitive results.

Traders Workshop

Relative strategies and future work

The results of the above Machine Learning models showed that it is possible through binary classification algorithms with technical indicators as features to have an estimation, beyond randomness, for the next working day for the market direction (up or down) as well as for market condition in a specific period (trend or mean reversion regime of the market). 

From our experience with other FX pairs & much bigger datasets spanning larger timeframes, the classification accuracy still holds above 55-60% in most other cases & with the use of cross asset features like prices of SP500 futures, VIX, WTI & gold can improve much more.

This useful daily information can be used as an input to a daily trading strategy, either systematic or discretionary. Knowing the market direction and the market condition, we can use the help of Technical Analysis and Fundamental Analysis to build robust strategies that can be consistently profitable. These are some additions like below that need to be addressed for a complete trading system:

  • Technical Analysis should be used to define the optimum entry point of each position. Momentum Indicators in fast timeframes are applicable.
  • Technical Analysis should be used to apply Risk Management to the trading strategy, defining the size and the price levels for Stop Loss and Take Profit of each position. Indicators (ATR or ?) that measure the daily market Volatility are applicable.
  • Portfolio Optimization Algorithms can be used to manage any possible cases of positions that remain opened on a new trading day. 
  • Fundamental & sentiment analysis can be used to apply filters on the trading strategy, since some days may contain important news and announcements that may change the character of the market and cause high volatility.

The whole trading strategy that consists of the Machine Learning models results, combined with Technical & Fundamental Analysis rules, should also be backtested and optimized. The whole process is feasible to be automated in many trading platforms by taking the daily input for the market direction and the market condition and by implementing all the other rules on each platform’s programming environment. 

Traders Workshop


In this short & simple introduction, we described very briefly some issues in applying Machine Learning in FX and we provided a very simple but meaningful list of various ML algos for market direction & regime detection. Needless to say, there are so many other ideas & data out there to be exploited in this never ending algo competition, so stay curious & tuned!