Machine learning classification and regression models for predicting directional changes trend reversal in FX markets

https://doi.org/10.1016/j.eswa.2021.114645Get rights and content

Highlights

  • A novel trading strategy based on the event-based concept of directional changes.

  • The trading strategy includes classification and regression algorithms.

  • Algorithm tested on 1000 datasets from 20 FX currency pairs.

  • Proposed approach is able to generate new and profitable trading strategies.

  • Proposed approach significantly outperforms all other benchmarks.

Abstract

Most forecasting algorithms in financial markets use physical time for studying price movements, making the flow of time discontinuous. The use of physical time scale can make traders oblivious to significant activities in the market, which poses a risk. Directional changes (DC) is an alternative approach that uses event-based time to sample data. In this work, we propose a novel DC-based framework, which uses machine learning algorithms to predict when a trend will reverse. This allows traders to be in a position to take an action before this happens and thus increase their profitability. We combine our approach with a novel DC-based trading strategy and perform an in-depth investigation, by applying it to 10-min data from 20 foreign exchange markets over a 10-month period. The total number of tested datasets is 1,000, which allows us to argue that our results can be generalised and are widely applicable. We compare our results to ten benchmarks (both DC and non-DC based, such as technical analysis and buy-and-hold). Our findings show that our proposed approach is able to return a significantly higher profit, as well as reduced risk, and statistically outperform the other trading strategies in a number of different performance metrics.

Introduction

Financial forecasting is a major activity in financial markets. A big challenge faced by financial traders is the ability to identify security and market trends and so that they can maximise trading returns with minimal associated risk. An enormous amount of research has been dedicated to this topic (Brabazon, Kampouridis, & O’Neill, 2020), but it has been acknowledged from early on that financial time series are among the ‘noisiest’ and most difficult signals to forecast (Abu-Mostafa & Atiya, 1996). As a result, both the financial (and more recently the machine learning) literature has been continuously looking for new techniques that can lead to better trading results.

The traditional approach used by financial traders is technical analysis. In this approach, traders use mathematical calculations in identifying and predicting repeating trends in historic data sampled in predetermined physical-time interval (Lin et al., 2017, Samanta et al., 2020). An alternative approach to physical time data sampling is intrinsic time data sampling. In intrinsic series, data is sampled when events considered to be significant occur in the market (Cavalcante et al., 2016, Wan et al., 2016). The idea is that by focusing on important market activities, noise is obfuscated enabling traders build trading strategies around important trends. Over the years, different intrinsic time sampling techniques have emerged, such as perceptual important points (Chen and Chen, 2016, Chung et al., 2001), turning point (Yin, Si, & Gong, 2011), zigzag (Azzini et al., 2010, Özorhan et al., 2018), and directional changes (DC) (Glattfelder et al., 2011, Tsang, 2010, Tsang et al., 2017).

Directional Changes is a relatively new technique, and it has already demonstrated that it can yield profitable returns that can outperform state-of-the-art techniques, such as technical analysis indicators (Kampouridis and Otero, 2017, Aloud, 2016). DC is based on the idea that an event-based system can capture significant points in price movements that the traditional physical time methods ignore. Hence, instead of looking at the market from an interval-based perspective, DC record the key events in the market (e.g., changes in the stock price by a pre-specified percentage) and summarise the data based on these events, moving away from a physical-time view to an event-based-time view. Under this new paradigm, a threshold θ is defined, usually expressed by a percentage of the price. The market is then fragmented and summarised into upward and downward trends. Each of these trends are further dismembered into a directional change (DC) event and an overshoot (OS) event. Different thresholds produce different price summaries. Thus, the directional changes paradigm focuses on the size of price change, while time is the varying factor; whereas in the physical-time paradigm, time was fixed (e.g. daily closing prices).

In a previous work (Adegboye, Kampouridis, & Johnson, 2017), we used a genetic programming (GP) algorithm to undertake symbolic regression and evolve equations that express linear and non-linear relationships between the length of DC and OS events in a given dataset. The advantage of that approach was that it allowed us to predict when a trend will reverse, and thus increase trading profitability. We used this approach as part of a DC-based trading strategy and tested it over 5 different Forex currency pairs for a total of 250 monthly datasets (5 DC thresholds, over 5 Forex pairs, over 10 months). Our findings showed that our proposed approach was able to outperform other state-of-the-art trading approaches, such as a machine learning algorithm combining a number of technical indicators. This was a major finding, as it was one of the first works to demonstrate the competitiveness of our DC-based trading algorithms against state-of-the-art technical analysis indicators. This has also further motivated us to look for new and better ways to take advantage of the DC framework, as this could lead to improved profitability results.

This work poses an important step forward for more accurate trend reversal prediction, which as we mentioned earlier allows a trader to increase their profitability by being able to anticipate when the current trend will end. The main contribution of this paper is that we do not assume that a DC event is always followed by an OS event, as is often done in the literature. Instead, we create a new step, where we use a classification algorithm to predict whereas a DC event is going to be followed by an OS event. In the end, only when a DC event is classified having a corresponding OS event, we go ahead with performing symbolic regression. This is an important contribution to our DC framework, as for certain datasets there can be a high number of DC events that are not followed by an OS event. Without this classification step, the symbolic regression GP tends to make conservative estimates of the OS length, as the GP builds equations even for DC events that do not have a corresponding OS event. The addition of the classification step in this work will allow the GP to focus only on DC events that are followed by an OS event, and thus lead to even better end of trend predictions than our previous work (Adegboye et al., 2017).

In addition to the above major contribution, this work also makes the following contributions: (i) We propose a new DC-based trading strategy that uses the combined classification and regression steps, (ii) We do not use the same set of fixed thresholds θ across all datasets. Instead, we use a pool of thresholds and then the best thresholds (in terms of RMSE) are selected for each dataset. Thus, the thresholds we use are tailored to the datasets. (iii) We use a wide range of datasets from 20 Forex currency pairs. In total, our experiments are run over 1,000 different directional changes datasets, making our results much more significant and generalisable. (iv) We add seven new benchmarks and one more performance metric to enhance our results analysis. (v) We present samples of the best equations returned by the symbolic regression and discuss if we can have a generalised equation for predicting trend reversals across different datasets.

The above contributions will allow us to demonstrate not only the effectiveness of DC in terms of generating profitable trading strategies, but also its competitiveness against other state-of-the-art trading techniques. As explained at the beginning of this section, it is important to continuously look for new and improved techniques that lead to more profitable trading results. Our aim is thus to make a novel addition towards the goal of creating more profitable trading algorithms.

To achieve this aim, we have created the following objectives: (i) Demonstrate that the combination of classification and regression leads to error reduction when compared to other trend reversal algorithms, and (ii) Demonstrate that our proposed DC-based trading strategy, which utilises our proposed trend reversal approach, is able to be profitable and outperform other trading strategies, both DC and non-DC-based, including from physical time, such as technical analysis and buy-and-hold. More information about these aims will follow in Sections 3 Methodology, 5 Result and analysis.

The rest of this paper is organized as follows: Section 2 provides an overview of the DC approach, as well as a discussion on the relevant literature. Section 3 presents all steps of our methodology, namely classification, regression, and trading strategy. Section 4 presents the experimental setup, and Section 5 presents and discusses our findings. Finally, Section 6 concludes the paper and discusses directions for future work.

Section snippets

Overview

The directional change (DC) approach is an alternative approach for summarising market price movements. A DC event is identified by a change in the price of a given financial instrument. This change is defined by a threshold value, which was in advance decided by the trader. Such an event can be either an upturn or a downturn event. After the confirmation of a DC event, an overshoot (OS) event usually follows. This OS event finishes once an opposite DC event takes place. The combination of a

Methodology

As explained in the previous section, there can be a high percentage of DC events that are not followed by an OS event. Therefore, creating a symbolic GP algorithm to predict the length of an OS event as a function f of a DC event (and thus predicting the end of the current trend) over the whole series of DC and OS events is an approach with a major drawback: the resulted function f that describes this relationship does not take into account that many DC events are not followed by an OS event.

Experimental setup

This section is divided into the following parts: Section 4.1 presents the data we are using for the experiments, Section 4.2 presents the tuning configurations for the classification and regression tasks of our framework, and lastly, Section 4.3 presents the setup of the trading experiments.

Result and analysis

This section presents results for our experiments. It is divided into three main sections: Section 5.1, which presents the classification results, Section 5.2, which presents the regression results, and Section 5.3, which presents the trading results.

We would like to one more time remind the reader that the theoretical contribution of the work are as follows: (i) provide empirical evidence that classification models are effective in detecting the existence of trends before they reverse, thus,

Conclusion

To conclude, this paper presented a new framework, where we used different machine learning algorithms for classification and regression in DC-based summaries, to predict end of trend. This then enabled us to develop profitable and low-risk trading strategies, which were able to outperform six benchmarks, including other DC-based trading strategies, technical analysis, and buy and hold. It is important to note here that we run extensive experiments over a total of 1,000 datasets from 20

CRediT authorship contribution statement

Adesola Adegboye: Conceptualization, Methodology, Software, Validation, Formal analysis, Investigation, Data curation, Writing - original draft. Michael Kampouridis: Writing - review & editing, Supervision, Project administration.

Declaration of Competing Interest

The authors declare that they have no known competing financial interests or personal relationships that could have appeared to influence the work reported in this paper.

Acknowledgement

aaa

References (24)

  • R.C. Cavalcante et al.

    Computational intelligence and financial markets: A survey and future directions

    Expert Systems with Applications

    (2016)
  • M. Kampouridis et al.

    Evolving trading strategies using directional changes

    Expert Systems with Applications

    (2017)
  • Y. Wan et al.

    Effect of segmentation on financial time series pattern matching

    Applied Soft Computing

    (2016)
  • Y.S. Abu-Mostafa et al.

    Introduction to financial forecasting

    Applied intelligence

    (1996)
  • A. Adegboye et al.

    Regression genetic programming for estimating trend end in foreign exchange market, in

  • M.E. Aloud

    Profitability of directional change based trading strategies: The case of Saudi stock market

    International Journal of Economics and Financial

    (2016)
  • A. Azzini et al.

    Modeling turning points in financial markets with soft computing techniques

  • M. Birattari et al.

    F-race and iterated f-race: An overview

  • A. Brabazon et al.

    Applications of genetic programming to finance and economics: past, present, future

    Genetic Programming and Evolvable Machines

    (2020)
  • J. Brookhouse et al.

    Working with opencl to speed up a genetic programming financial forecasting algorithm: initial results

  • Chen, T. & Chen, F.Y. (2016). An intelligent pattern recognition model for supporting investment decisions in stock...
  • F.L. Chung et al.

    Flexible time series pattern matching based on perceptually important points

  • Cited by (23)

    View all citing articles on Scopus
    View full text