Next Article in Journal
A Review of Intelligent Connected Vehicle Cooperative Driving Development
Previous Article in Journal
An Approximation Method to Compute Highly Oscillatory Singular Fredholm Integro-Differential Equations
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

A Deep Network-Based Trade and Trend Analysis System to Observe Entry and Exit Points in the Forex Market

1
Department of Computer Science and Engineering, Siksha ‘O’ Anusandhan (Deemed to be) University, Bhubaneswar 751030, Odisha, India
2
Department of Computer Applications, Siksha ‘O’ Anusandhan (Deemed to be) University, Bhubaneswar 751030, Odisha, India
3
Department of Computer Science and Information Technology, Siksha ‘O’ Anusandhan (Deemed to be) University, Bhubaneswar 751030, Odisha, India
4
College of Computer Science and Information Technology, University of Anbar, Anbar 31001, Iraq
5
Computer Technologies Engineering Department, Information Technology Collage, Imam Ja’afar Al-Sadiq University, Baghdad 10064, Iraq
6
Department of Applied Data Science, Noroff University College, 4612 Kristiansand, Norway
7
Department of Software, Kongju National University, Cheonan 31080, Korea
*
Author to whom correspondence should be addressed.
Mathematics 2022, 10(19), 3632; https://doi.org/10.3390/math10193632
Submission received: 21 August 2022 / Revised: 3 September 2022 / Accepted: 28 September 2022 / Published: 4 October 2022
(This article belongs to the Section Financial Mathematics)

Abstract

:
In the Forex market, trend trading, where trend traders identify trends and attempt to capture gains through the analysis of an asset’s momentum in a particular direction, is a great way to profit from market movement. When the price of currency is moving in one either of the direction such as; up or down, it is known as trends. This trend analysis helps traders and investors find low risk entry points or exit points until the trend reverses. In this paper, empirical trade and trend analysis results are suggested by two-phase experimentations. First, considering the blended learning paradigm and wide use of deep-learning methodologies, the variants of long-short-term-memory (LSTM) networks such as Vanilla-LSTM, Stacked-LSTM, Bidirectional-LSTM, CNN-LSTM, and Conv-LSTM are used to build effective investing trading systems for both short-term and long-term timeframes. Then, a deep network-based system used to obtain the trends (up trends and down trends) of the predicted closing price of the currency pairs is proposed based on the best fit predictive networks measured using a few performance measures and Friedman’s non-parametric tests. The observed trends are compared and validated with a few readily available technical indicators such as average directional index (ADX), rate of change (ROC), momentum, commodity channel index (CCI), and moving average convergence divergence (MACD). The predictive ability of the proposed strategy for trend analysis can be summarized as follows: (a) with respect to the previous day for short-term predictions, AUD:INR achieves 99.7265% and GBP:INR achieves 99.6582% for long-term predictions; (b) considering the trend analysis strategy with respect to the determinant day, AUD:INR achieves 98.2906% for short-term predictive days and USD:INR achieves an accuracy of trend forecasting with 96.0342%. The significant outcome of this article is the proposed trend forecasting methodology. An attempt has been made to provide an environment to understand the average, maximum, and minimum unit up and/or downs observed during trend forecasting. In turn, this deep learning-based strategy will help investors and traders to comprehend the entry and exit points of this financial market.

1. Introduction

In the Forex financial market, forecasting and providing a platform to make correct and accurate decisions towards investment is the most challenging affair for investors, brokers, and business houses. Understanding the sentiment of markets and economic growth of countries are the potential inputs to analyze this market and ensure that the assets invested must give measurable value and maximum return on investment. The key objective of focusing on forecasting or predicting the currency exchange rate between countries is to help investors, brokers, and traders through an automated system which can produce informed or guided decisions for minimizing the risk of investment along with maximizing returns on the invested amount leading to a well-produced trading strategy [1,2]. The most commonly used methods focus on: (a) purchasing power parity, the idea that there should be no purchasing and selling of the same asset in different markets to extract the best profit, which exploits the short-lived variations in the price of a similar asset in different country’s markets; (b) relative economic strength, which measures the economic strength of the country with respect to their growth and is basically used to attract foreign investors; (c) econometric models, which gather the factors influencing the forecasting of exchange rates based on economic theory such as statistical and mathematical methods, and the variables which can influence the exchange rate are also taken into consideration [3,4].
The recent trend of embracing the digital medium of analyzing financial assets in business industries has set ample opportunities for the research community and information technology industries to design and develop automated financial applications or models which can understand financial market sentiments and are able to deliver accurate and smart decisions with emerging technologies. Though traditional models of financial market analysis are doing well based on historical data, the short shelf life of these models is limiting their use and effectiveness. Understanding the patterns of the financial market for making decisions is also a motivating factor for researchers, and they are now studying the various patterns of this financial market through trend analysis [5,6]. The forecasting process of the Forex financial market is a risky and tedious task; therefore, researchers require detailed insight into such practices when developing any trading and/or trend analysis model.
This study is also popularly known as spend forecasting, aiming to provide optimal decisions and observation patterns based on historical data, the current situation or environment, and predictive analytics. This trend or spend forecasting provides the solution for ‘What next?’ for a specific time frame of investment, such as daily, monthly, quarterly, or yearly. In short, trend analysis examines the financial market and economic conditions and identifies two categories of trends, up trends or bull markets and down trends or bear markets [2,5,6,7]. Up trends represent the increase in asset prices and predicted growth over a given amount of time, and, in this trend, the investors are eager to catch the wave of investing to earn profits. In contrast, down trends direct the bad economic conditions of the markets, leading investors to become more conservative and not interested in investing. To summarize, this trend analysis provides a direction of the profits/losses for the assets, and it makes the decision-making approach straightforward for investors and business industries. The various tools and techniques of machine learning and deep learning algorithms now play a vital role in predicting the currency exchange price of each money pair during the classification process, and with the help of supervised learning techniques, market trends (up trends and down trends) are being predicted to help investors and traders make the correct decisions regarding Forex transactions [5,6,8,9].
Deep network has established a new blended learning paradigm by exploiting the architecture and functionalities of artificial intelligence and machine learning strategies in the domain of financial market analysis. The strong underlying methodologies of deep network based on mathematical and computational mechanisms have become a great challenge to researchers, and people are still trying to develop computational models based on this deep network; hence, the development of an application-specific network is a challenge that needs to be addressed [10,11,12]. Deep network has shown its performance in categorization and prediction domains by drawing curvy or straight lines through data points to categorize datasets or predict the value at which a trend will increase or decrease [13,14,15].
Overall, current currency exchange rate prediction and identification of trends present a good opportunity to study this financial market and the ability of deep learning with respect to processing many features with inbuilt filtering architecture; furthermore, the methods used are skilled in dealing with unstructured data and complex problems, showing their effectiveness to focus on this area of research. Motivated by the efficiency of deep learning techniques, this study poses an empirical attempt to obtain currency pair trading prices as well as a trend analysis strategy to identify the up trends and down trends of this market for both short-term (15 days) and long-term (60 days) prediction of horizons. The literature suggests the use of long short-term memory (LSTM) [16,17,18], one of the most widely used deep learning strategies, for the prediction of this financial market. This further motivated us to utilize the variants of LSTM forecasting networks, as this could lead to improved results.
Based on the above context, this work makes the following contributions:
  • Five variants of LSTM, such as Vanilla-LSTM, Stacked-LSTM, Bidirectional-LSTM, Convolutional Neural Network-LSTM (CNN-LSTM), and Conv-LSTM, are used as trading strategies [16,17,18,19,20,21]. The performance of these five models is recorded with respect to explained variance score (EVS), maximum error (ME), mean squared error (MSE), and R-square (R2) [22];
  • Prediction curves are plotted to visualize the predictive performance. The best fit models are obtained with respect to the prediction period for all three currency pairs used for experimentation;
  • To attain a holistic view of the results obtained using predictive models, statistical validation is performed using Friedman’s non-parametric statistical test [23,24];
  • A deep learning-based system for obtaining the trends of the currency pair is proposed based on the selling or buying of currencies, focusing on the previous day and the determinant day (a few days ahead as per user input) to observe the trends for a certain day (date) for both short-term and long-term forecasting horizons;
  • Readily available technical indicators such as average directional index (ADX), rate of change (ROC), momentum, commodity channel index (CCI), and moving average convergence divergence (MACD) [25,26,27] are used to observe the trends on those three-currency pair datasets;
  • A straightforward comparison is made between the proposed trend analysis strategy, actual trends observed on original datasets, and the trends observed based upon those tools;
  • In order to handle risks in this financial market, an attempt is made to help investors and traders to identify not only the trends but also the strength of the trends with respect to the average, maximum, and minimum number of units, either up or down, observed during the up trends or down trends and put them in a position to understand the profitable entry and exit points and provide buying or selling opportunities. Finally, the average computational time for all the algorithms used for trading and trend analysis are presented.
This paper is organized as follows: a literature survey on forecasting models based on variants or hybrids of LSTM, along with a few studies conducted on trend analysis, are discussed in Section 2. The methodologies adopted for experimentation and the proposed trend analysis strategies are discussed in Section 3. Section 4 focuses on the experimental setup, and the experimentation, evaluation, and results in the analysis of this research are discussed in Section 5. Finally, Section 6 concludes the work with future scope.

2. Literature Survey

This section provides detailed study on Forex market analysis focusing on existing research conducted on LSTM and the hybrid forms of LSTM-based trading models. In addition, a few proposed trend analysis methods are also discussed. An ensemble approach called LSTM-B, integrating the LSTM neural network and bagging ensemble learning strategy, was proposed by Shaolong Sun et al. [28] to obtain accuracy in the Forex market and improve the profit of exchange rate trading. This ensemble deep learning approach yields better performance when compared with other benchmarks, which may or may not include bagging ensemble learning methods. Salman Ahmed et al. [16] proposed an integrated system which uses Forex Loss Function (FLF) in an LSTM (FLF-LSTM) which reduces the differences between actual and predictive averages of Forex candles. The authors compared the proposed approach with a recurrent neural network (RNN)-based prediction system and the auto-regressive integrated moving average and found a minimal error with respect to open, high, and low prices, respectively. To analyze trade data, Mei-Li Shen et al. [17] developed an effective trade forecasting method which works on a neural network with LSTM. The authors proposed multivariate LSTM-based techniques which extract the progressive changes from trade data and result in an effective trade forecasting system. M.S. Islam and E. Hossain [29] proposed a new model with the combination of Gated Recurrent Unit (GRU) and LSTM methods, which works for time series prediction and predicts the future closing price of Forex currency. The performance of the model was validated and compared with basic LSTM, basic GRU, and simple moving average (SMA), and it was observed that the GRU-LSTM model shows better results. Gang Wang et al. [30] proposed an ensemble method which uses adaptive linear sparse random subspace (ALS-RS) based on the effect of shallow and deep features. Here, the shallow feature is constructed manually using expert knowledge, whereas the deep feature is extracted automatically using bidirectional GRU. Based on the deep learning framework, a model was proposed by Shuigen Yang [14] to predict financial indicator values. His model uses LSTM as a benchmark prediction model and is used to forecast the financial risk in the financial sector. Yong Lin et al. [31] applied the multifractal detrended cross-correlation analysis (MF-DCCA) method to examine the cross-correlation behavior between the USD/CNY exchange rate and the Baidu index (BI). The authors proposed a hybrid deep learning model, WOASTL-BI-LSTM, to predict UCER returns, where BI is used as a potential predictor to predict UCER. Sangjin Park and Jae-Suk Yang [18] presented a deep learning model based on the LSTM network to predict economic growth. Along with this, the authors also used an interpretable machine learning model which derives economic growth patterns and crises using the eXplainable AI (XAI) framework. An LSTM and GRU-based hybrid crypto-currency prediction framework was proposed by Mohil Mahesh Kumar Patel et al. [32]. The proposed framework focused on only two crypto-currencies, namely Litecoin and Monero. Saúl Alonso-Monsalve et al. [27] explored the use of a neural network with a convolutional component in the domain to classify the trends of crypto-currency exchange rates. The authors compared the performance of the proposed work with different network architectures and found convolutional LSTM neural networks significantly outperformed all other methods.
In Forex market prediction, the prediction of market trends and automated trading are important factors for stakeholders, and recent trend forecasting of financial time series data is considered a top choice for finance researchers. Here, a few studies on trend forecasting are discussed to obtain better insight into this domain of research. A comprehensive study was presented by Omer Berat Sezer et al. in ref. [15], which includes the application of variants of deep learning strategies, such as convolutional neural networks (CNNs), deep belief networks (DBNs), and LSTMs, in the field of financial time series forecasting. T. Tokár and D. Horváth [33] analyzed the local trends used for currency trading. With different time delays, the authors introduced several statistical quantities to examine the role of a single temporal discretized trend or a multitude of grouped trends. Hossein Talebi et al. [6] proposed a classifier for identifying up, down, and sideways trends in the Forex market. The authors used an ensemble classifier to obtain better results than the individual classifier used for trend analysis. Yunli Lee et al. [34] extracted the features from trend patterns to predict the next day’s movement of trends. To obtain long-term trends and short-term movements of stock market data, Salim Lahmiri [35] introduced the variational mode decomposition (VMD) method for signal processing which is used to decompose stock market data into a finite set of modes.
The author also used detrended fluctuation analysis (DFA) and range scale (R/S) to evaluate the Hurst exponent in each mode obtained from VMD. Javier Sandoval et al. [36] presented a graphical picture which fully depicts the price–time–volume dynamics in a limit order book and the required trend is predicted by clustering techniques. For trading in the financial market, Erik Bartoš et al. [37] introduced multidimensional string objects. The authors showed how new object properties could change the statistics of predictors, which can help to regenerate candidates for modeling time series systems. In many forecasting algorithms, the physical time scale is used for studying price movement in financial markets. However, the use of a physical time scale may cause risk in the market; hence, Adesola Adegboye et al. [38,39,40] proposed a new approach, namely directional change (DC), which uses an event-based time scale in 2017, 2019, and 2021. This approach represents the data in upward directional change and downward directional change. The trends can also be expressed in DC events and overshoot (OS) events. The authors also attempted to predict the reverse trend to increase profitability using a genetic programming algorithm, which includes linear and non-linear relationships between the length of DC and OS events in a particular dataset. In 2019 [39], they extended their work based on the DC approach for sampling market data and the extraction of trends in financial time series by replacing the time-based format with an event-based format. The authors explored different machine learning algorithms and tested the performance. They used particle swarm optimization and the shuffled frog leaping algorithm on 36 different datasets from four different currency pairs and found statistically improved profitability on DC-based trading. In 2021, the same authors [40] proposed a DC-based framework with machine learning algorithms to predict the reverse trend. The proposed approach was able to return high profits with reduced risk. The work was compared with 10 benchmark datasets with technical analysis and bye-and-hold for both DC and non-DC-based approaches. In the Forex market, existing trading systems include technical analysis with crisp technical indicators for buy or sell signals. This approach can be replaced with the fuzzy approach, which generates buy or sell signals with a fuzzy membership function. To achieve an efficient trend in the Forex market, Alireza Sadeghi et al. [41] presented a combined approach which is based on an ensemble multi-class support vector machine (EmcSVM) and fuzzy NSGA-II. Initially, EmcSVM was used to predict future market trends into up, sideways, and down trends, and NSGA-II was used for optimizing the hyper-parameters. Jose Augusto Fiorucci et al. [42] used statistical volatility to improve the calculus of four action points and then replaced them with actions derived from generalized autoregressive conditional heteroskedasticity (GARCH) quantiles. Using empirical tests on various assets and comparing them with previously existing systems, it was found that the proposed methods yielded better performance. Similarly, Bangdong Zhi et al. [43] focused on inventory financing to help businesses survive during an economic crisis caused by the COVID-19 pandemic, supporting economic recovery by proposing a data-driven GARCH-EVT-Copula model. Zhuang and Wei [44] investigated the multifractal scaling behavior and efficiency of green finance markets, conventional equity indices, and crude oil by index-based asymmetric multifractal detrended fluctuation analysis. In order to reveal the change law of bank data and manage banks effectively, Changjin Xu et al. [45] proposed a novel fractional-order bank data model incorporating two unequal time delays. Ricardo Fuentes et al. [46] proposed a non-linear continuous optimization model to estimate tolls for multi-class and multi-period traffic considering integral social costs such as congestion externalities, pavement damage, environmental emissions, operational travel costs, and user travel time cost, in addition to maintenance and construction of road infrastructure costs.
Future trend direction can be determined by analyzing historical time series data. In international market trading, organizations can make better decisions if it they have prior knowledge about the currency exchange rate. Pradeepta Kumar Sarangi et al. [5] analyzed the applicability of machine learning methods for forecasting the currency exchange rate in a very short-term period. The authors used two methods, namely, an artificial neural network (ANN) and a hybrid model of ANN with a genetic algorithm (ANN-GA). From the studies, it was observed that LSTM and its variants provide reliable forecasting results with high prediction accuracy and the trend analysis showed its importance to investors for making trading decisions, thereby providing a new direction to academics and researchers to focus more in this domain of research.

3. Preliminaries

Deep network-based learning mechanisms have shown good dimensions for the development of the automatic learning of the temporal dependence of datasets and have proven that they can handle the temporal structures of those datasets to forecast future values and trends [10,11,12,13,14,15]. This section discusses the architecture and functionality of variants of LSTM networks used for forecasting the future value of currency datasets and the proposed trend analysis strategy with an example along with the algorithm.

3.1. Long-Short-Term-Memory (LSTM) Based Forecasting

The LSTM network is similar to the RNN network [16,17,18,19,20,21] with some variation, such as (a) using the explicit handling of order between observations during the learning process, which is not used in the case of multi-layer perceptrons and CNN, (b) adding support for the sequence of input data which yields learning complex interrelationships, (c) learning the temporal dependencies giving rise to learning the context from the input sequences and supports dynamic changes if required, (d) providing a wide range of parameters such as learning rates and input and output biases without the need for fine-tuning, (e) removing vanishing or exploding gradient issues of RNNs during the training process without making any changes to the training model, (f) bridging long time-lags and noise handles and distributing representations and continuous values properly, and (g) the complexity of updating the weight is reduced to O(1), making this network advantageous. The advantages are exploited and experimented within this study to develop an empirical Forex forecasting model based on five variants of the LSTM network and are discussed below.
A basic LSTM or Vanilla LSTM network is a special version of an RNN with a chain-like repeating module structure with four interacting layers communicating extraordinarily. The four-step working process of this Vanilla-LSTM is discussed below.
In the first step, a decision has been made regarding which information should not be considered from the cell in a particular time stamp and which context needs to be remembered. The s i g m o i d   f u n c t i o n ( σ ) takes care of this by looking at the p r e v i o u s   s t a t e   P S t 1 along with the c u r r e n t   i n p u t   s t a t e   C I S t using Equation (1) and outputs a number between [0, 1] for each number in the cell state   C S t 1 representing to either remember and completely keep or do not remember and completely forget. In this equation, F G t is known as the f o r g e t   g a t e and is the core of this first step to decide which information will be less important than the previous time step.
F G t = σ ( W F G · P S t 1 , C I S t + b F G ) .
The second phase has two parts inbuilt into it. One is the s i g m o i d   f u n c t i o n   ( σ ) which decides which values to consider (i.e., 0 or 1) and the t a n h   f u n c t i o n   t a n h decides the level of importance (i.e., −1 or 1) by assigning weightage to the values passed. This second phase undergoes Equations (2) and (3), where I G t is the i n p u t   g a t e , which is responsible for estimating the significance of the information during the current time step.
I G t = σ ( W I G · P S t 1 , C I S t + b I G ) .
C t ˜ = t a n h ( W C · P S t 1 , C I S t + b C ) .
In the third step, the o l d   c e l l   s t a t e   C S t 1 is updated into a new cell state C S t and then the C S t 1 is multiplied with F G t to forget the information decided earlier using Equation (1). Then, I G t × C t ˜ is added, which yields n e w c a n d i d a t e v a l u e s scaled by how much to update each state value using Equation (4).
C S t = F G t × C S t 1 + I G t × C t ˜ .
The final step decides the output and which current cell will be the output is decided through a s i g m o i d   l a y e r . The obtained cell state from this layer undergoes a t a n h   f u n c t i o n to derive the values between −1 and 1 and multiplies it by the output of the s i g m o i d   g a t e using Equations (5) and (6).
O P t = σ ( W O P · P S t 1 , C I S t + b O P ) .
P S t = O P t × t a n h C S t .
Stacked-LSTM is an extension of Vanilla-LSTM with multiple hidden LSTM layers with multiple memory cells in each layer. In this network, an LSTM layer provides a sequence output then a single output to the LSTM layer below, i.e., one output per input time-step is one output time-step for all input steps. This stacking makes the LSTM model deeper, and the learning process gives rise to a more accurate outcome, and more complex input patterns can be described at every layer, unlike the feed-forward layer between the feature input and the LSTM layer. Bidirectional LSTM is a special kind of neural network that displays the sequence of information in both directions, such as backward and forward, i.e., from future to past and past to future, respectively. As the information flows in two directions, this network can utilize the information from both sides and has been proved to be a powerful tool for modeling the sequential dependencies among inputs in both directions of the sequence, preserving future and past information. When all time steps of the input sequences are available, this network trains two instead of one LSTM on the input sequence, which makes this network computationally more effective. The CNN-LSTM network is a combination of CNN and LSTM layers, and this provides a solution to use both structural and spatial information together. In this network, the CNN layers extract the features and capture the patterns from the input data, and the LSTM layers are responsible for sequence predictions. The Conv-LSTM is a type of RNN with convolutional structures in both input-to-state and state-to-state transitions. This network uses a convolution operator in both transitions and determines the future state of a certain cell in the grid by the inputs and past states of its local neighbors. This convolution is a type of operator with a kernel, a small weight matrix to perform element-wise multiplication and sum up the results into an output. The key advantage is this convolution allows weight sharing, reducing the number of effective parameters and allowing the same feature to be detected in different parts of the input space. It can be noted that the Conv-LSTM performs matrix multiplication of the input with the LSTM cell using a convolution operator, whereas the CNN-LSTM uses two different modules combined where the CNN is used for spatial feature extraction.

3.2. Proposed Trend Analysis Strategy Overview

In technical analysis, investors attempt to understand the future scope of their assets based on trend analysis with respect to price movements on historical and recently observed data. This trend analysis provides an idea to investors and businessmen to take their things in the right direction. In this trend analysis field, two directions of price movements are observed, up trends (assets moving in an upward direction and resulting in an increase in price) and down trends (assets moving in a downward direction and resulting in a decrease in price). From the literature, it was observed that there are many computational methods, such as oscillators and momentums, available to understand the direction of price movements, and informed decisions can be made for selling or buying base currency. Similarly, in this trade and trend analysis work, an attempt was made to propose an approach to provide a decision-based system for obtaining the trends of the currency pairs used for experimentation based on the predicted closing price from the variants of LSTM forecasting models. This proposed trend analysis strategy for selling or buying currencies focuses on the previous day and the determinant day (a few days ahead as per user input) to observe the trends for a certain day (date) for both short-term and long-term forecasting timeframes and is discussed below in Figure 1 and Table 1, respectively. The proposed algorithm for trend analysis strategy is provided in Algorithm 1.
Algorithm 1: Proposed Trend Analysis.
Input: Number of days = D ; Current Day Price = P c ; Previous Day Price = P v ; and W S = Window Size
Output: Up trend: UP; Down trend: DOWN; Previous day Magnitude:   M p r e v   d a y ; Determinant day Magnitude: M d e t   d a y
Process:
 
   Let D   =   D 1 , D 2 , , D N , Where D 1 is Day1, D 2 is Day2 and D N is Day N ;
    P c   =   P c D 2 ,   P c D 3 , , P c D N , Where P c D 2 = current price of Day2, P c D 3 = current price of Day3 and P c D N = the current price of day N ;
    P v   =   P v D 1 ,   P v D 2 , , P v D N 1 , Where P v D 1 = previous day price of Day2, P v D 2 = previous day price of Day3 and P v D N 1 = previous day price of D a y D N ;
    W   =   w 0 , w 1 , , w N W S Where, w 0   =   W i n d o w 0 from D   1 to D W S ,   w 1   =   W i n d o w 1 from D 2 to D W S + 1   , w N W S   =   W i n d o w N W S from D N W S + 1 to D N   ;
    P m   =   P m D 1 ,   P m D 2 , ,   P m D N Where, P m D 2   =   P c D 2 P v D 1 , P m D 3   =   P c D 3 P v D 2 , P m D N   =   P c D N P v D N 1 ;
    D m   =   D m D w 1 ,   D m D w 2 , ,   D m D w N W S , Where, D m D w 1   =   P c w W S P c D 1 ,   D m D w 2   =   P c w W S + 1 P c D 2 ,   ,   D m D w n W S   =   P c w W S P c D d W S ;
 
    M p r e v   d a y w k   =   W i n d o w k m a g n i t u d e   a n d   d i r e c t i o n   =   U P   o r   D O W N ;
    M d e t   d a y w k   =   W i n d o w k m a g n i t u d e   a n d   d i r e c t i o n   =   U P o r   D O W N ;
    M p r e v   d a y w k   =   M e a n P m D k + 1 , P m D k + 2 , , P m w k M d e t   d a y w k   =   M e a n D m D w 1 , D m D w 2 , , D m D w k ; ;
    I f   M p r e v   d a y w k 0   =   U P   w i t h   a v e r a g e   m a g n i t u d e   v a l u e   o f   M p r e v   d a y w k   e l s e   D O W N   w i t h   m a g n i t u d e   o f   M p r e v   d a y w k I f   M d e t   d a y w k 0   = U P   w i t h   a v e r a g e   m a g n i t u d e   v a l u e   o f   M d e t   d a y w k   e l s e   D O W N   w i t h   m a g n i t u d e   o f   M d e t   d a y w k
Let us examine the above-formed rules with respect to lows and highs observed in the above example for both conditions, the determinant day and the previous day for which the trend is being observed. Here, we take w as 4 days considered as the determinant days. In the above example, 06 numbers of windows with 4 determinant days are considered, such as:
w 0 = D 01 ,   D 02 ,   D 03 ,   D 04 ,   w 1 = D 05 ,   D 06 ,   D 07 ,   D 08 ,   w 2 = D 06 ,   D 07 ,   D 08 ,   D 09
w 3 = D 07 ,   D 08 ,   D 09 ,   D 10 ,   w 4 = D 08 ,   D 09 ,   D 10 ,   D 11 ,   w 5 = D 09 ,   D 10 ,   D 11 ,   D 12 .
The buying and selling decisions are summed up in Algorithm 2 based upon the previous day and the determinant day strategies considered in this proposed trend analysis approach.
Algorithm 2: Proposed strategy for buying and selling decisions.
If Open price of a p a r t i c u l a r d a y > O p e n p r i c e of previous day
  then, U p t r e n d is observed and d e c i s i o n s e l l i n g t h e a s s e t
  else D o w n t r e n d is observed and d e c i s i o n b u y i n g the asset
end if
 
If Open price of a p a r t i c u l a r d a y > O p e n p r i c e of the determinant day
  then, U p t r e n d is observed and d e c i s i o n s e l l i n g t h e a s s e t
  else D o w n t r e n d is observed and d e c i s i o n b u y i n g the asset
end if

3.3. Trend Analysis Tools and Techniques for Evaluation

It was observed that, in this financial market, investors try to observe the trends, momentum, and patterns of their assets using readily available tools and techniques commonly known as technical analysis. In this phase of experimentation, five trend analysis indicators such as ADX, ROC, momentum, CCI, and MACD are utilized to provide a straightforward comparison with the proposed trend analysis strategy along with the actual trends observed in the original datasets for the period of experimentation days. In summary, the set of indicators used is formally defined in Table 2.

3.4. Performance Measures

Machine learning-based predictive models are measured by their loss function, which incorporates the input value and the expected outcome. The output of the loss function is generally known as the loss value, measuring the predicting power of models, and the low value represents the good predictive ability. The various measures used for acquiring the recognition performance of the proposed Forex market forecasting are MSE, R2, EVS, and ME. MSE is a widely used loss function and is calculated by taking the difference between the model’s predicted value and the expected value, and it will never be negative as it is squared. Similarly, R2 is the fraction of variance of the actual value of the response variable and the higher the value (closer to 0.9 and above), the better the model fits the data [47,48]. EVS measures the disagreement between a model, i.e., the model’s total variance and the actual data, and a higher percentage of the value indicates a strong association, which has better forecasting ability. The ME represents the error observed by the model, and the values must be as small as possible and close to 0.

4. Experimental Setup

This work is based on technical analysis for forecasting the closing price of currency pairs along with the direction of their movement for short-term and long-term timeframes. This section discusses the system configuration, the datasets used, and the selection of values for the parameters of variants of LSTM networks used for experimentation.

4.1. System Configuration

Experimental evaluation was carried out in a Google Colab environment under Windows 7 with 64-bit and 4 GB RAM of Intel i3. Google Colab laboratory or Colab requires zero configurations with free access to GPUs to write and execute Python in the researcher’s browser, which also provides an easy sharing facility. Additionally, this Colab harnesses the full power of popular libraries to analyze and visualize the data.

4.2. Datasets Experimented

In this work, three datasets, GBP:INR, AUD:INR, and USD:INR, were considered for experimentation for the time frame of 24 July 2006 to 20 August 2021, collected from refs. [49,50,51]. These datasets have only four attributes or features associated with them such as open price, low price, high price, and close price. The related information pertaining to those datasets is shown in Table 3.

4.3. Parameters Selection

The common parameters for all five LSTM networks are assigned as number of input nodes = 4, number of hidden layers = 1, number of nodes in hidden layer = 4, number of output node = 1, loss function = MSE, optimizer = adam, number of epochs = 1, batch size = 1, and verbose = 2. Particularly, the Stacked-LSTM consists of two layers of Vanilla LSTM networks with the same parameters mentioned above and the CNN-LSTM and Conv-LSTM differ with respect to a few parameters and their associated values, as provided in Table 4 with the rest of the common parameters mentioned above.

5. Experimentation, Model Evaluation and Result Analysis

This section presents the layout of the proposed trade and trend analysis model and the proposed trend analysis strategy. This section is divided into four main sub-sections, which present the (a) empirical evidence of the predictive performance of variants of LTSMs with respect to both the short-term and long-term predictive ability for all three currency pair datasets (GBP:INR, AUD:INR, and USD:INR) for both training and testing phases and the prediction graphs, provided to demonstrate the performance accuracy; (b) the statistical validation formed to test and validate the prediction algorithms; (c) demonstration of the observed trends based on the proposed strategy, actual trends observed, and the trends observed using technical analysis tools widely used for various financial websites (as discussed in Section 3.3); (d) attempt to observe the entry and exit points by studying the strength of the market; finally, (d) the execution speed (in seconds) of the forecasting models and the trend analysis strategy is plotted.

5.1. Model Representation

The current work proposes a two-stage empirical model for Forex market trade and trend analysis to provide better decision-making capability to investors for deciding the entry and exit points in this highly fluctuating market. To achieve this, there is a number of steps that need to take place, and they are summarized in a graphical manner in Figure 2. As can be observed, the inputs of the models are the Open, Low, High, and Close prices of the currencies under consideration and are divided into training and testing sets with the proportion mentioned in Table 3. Then, the selected model is applied to obtain trained and tested data to predict the future closing price of the currency pairs. This process is repeated for all of the variants of the LSTM networks used for experimentation, and the predictive performance is recorded for both short-term and long-term predictions. Lastly, as a final step, the novelty of the proposed trend analysis strategy is compared and validated, the trends are observed and obtained using the proposed strategy (as discussed in Section 3.2) and the actual trends observed from the original currency pair datasets along with the few technical indicators (as discussed in Section 3.3) used for validating the proposed trend analysis strategy, and finally, the magnitude of ups and downs observed in terms of units are studied to obtain the entry and exit points in this Forex market.

5.2. LSTM Based Forex Market Prediction

The results of this experimental study are presented in this section. The theoretical contribution of this work, such as the first the empirical evidence that the five variants of LSTM are effective in forecasting the closing price of three currency pairs for both short-term and long-term predictive horizons for both training and testing data, are discussed in this section. The prediction graphs showing the predictive performance of Vanilla-LSTM, Stacked-LSTM, Bidirectional-LSTM, CNN-LSTM, and Conv-LSTM are shown in Figure 3, Figure 4, Figure 5, Figure 6, and Figure 7, respectively.
Second, the performance of those five LSTMs based on MSE, R2, EVS, and ME are measured and recorded and are shown in Table 5, in which the observed values used for evaluation are marked in bold and the considered values to obtain the best fit model are marked in both bold and underlined. To sum up the findings, it can be stated as: (a) for GBP:INR on short-term prediction considering the MSE as one of the important measures, the Stacked-LSTM and Bidirectional-LSTM (during training phase) and Vanilla-LSTM and Bidirectional-LSTM and Conv-LSTM (during the testing phase) show good results with MSE 0.0001, for long-term prediction, the Conv-LSTM with MSE 0.001 (training phase) and Vanilla-LSTM, Bidirectional-LSTM, and Conv-LSTM (testing phase) perform well. To summarize, further considering the R2, EVS, and ME values, it was seen that Bidirectional-LSTM is a good model for both short-term (both training and testing phase) and long-term (testing phase) and Conv-LSTM (training phase) predictions for this currency pair. (b) For AUD:INR, Conv-LSTM shows better accuracy for short-term (training phase) and long-term (both training and testing phase) considering MSE and R2 values, and Vanilla-LSTM shows better performance for short-term predictions during the testing phase. (c) For USD:INR, Bidirectional-LSTM shows better predictive ability during both training and testing phases of long-term predictive days, while Vanilla-LSTM performs well for short-term timeframes during the training phase, and Bidirectional-LSTM is good during the testing phase.
To support our findings, the statistical validation of the five variants of LSTM networks used as predictive models was performed using Friedman’s non-parametric test [23,24], and the average rank values are recorded and shown in Table 6, and can be computed using Equation (7) as follows;
F r = 12 N K K + 1 T 1 2 + T 2 2 + + T K 2 3 N K + 1 ,
where N is the no. of datasets and K is the no. of hypotheses.
F r = 12 6 × 5 × 6 240.25 + 462.25 + 156.25 + 650.25 + 225 3 × 6 × 6 = 115.6 108 = 7.6
Step 1. 
Let us define the null ( H 0 ) and alternate ( H 1 ) hypothesis.
Hypothesis 0 (H0).
All five predictive models have the same probability distribution.
Hypothesis 1 (H1).
At least two of them differ from each other.
Step 2. 
Level of significance α = 0.25 .
Step 3. 
Calculate the degrees of freedom (DF).
D F = K 1 ; K = number of blocks to be measured.
Here, D F = 5 1 = 4 .
Step 4. 
Obtain the critical chi-square value (critical chi-square value for α = 0.25 and D F = 4 is 5.39 observed from the chi-Square table.
Step 5. 
State the decision rule, such as F r > 5.39 ; therefore, the null hypothesis is rejected.
Table 6. Statistical validation: average rank of LSTM variants used in the predictive model.
Table 6. Statistical validation: average rank of LSTM variants used in the predictive model.
Currency Pairs/Total RankVanilla-LSTMStacked-LSTMBidirectional-LSTMCNN-LSTMConv-LSTM
GBP:INR
[Short Term]
0.0001(2)0.0009(5)0.0001(2)0.0008(4)0.0001(2)
GBP:INR
[Long Term]
0.0001(2)0.0001(2)0.0001(2)0.0007(4)0.0009(5)
AUD:INR
[Short Term]
0.0001(1)0.0009(4.5)0.0002(2)0.0009(4.5)0.0003(3)
AUD:INR
[Long Term]
0.0001(1.5)0.0004(3)0.0007(4)0.0009(5)0.0001(1.5)
USD:INR
[Short Term]
0.0008(4)0.0007(3)0.0001(1)0.0009(5)0.0006(2)
USD:INR
[Long Term]
0.0008(5)0.0007(4)0.0001(1.5)0.0002(3)0.0001(1.5)
Total Rank(Tr)15.521.512.525.515
Tr2240.25462.25156.25650.25225
To sum up the findings so far, we can make observations that bidirectional-LSTM is ranked 1 and Conv-LSTM is ranked 2. Considering the measured performance (Table 5) and ranking (Table 6), the best fit models obtained are considered further for the next phase of experimentation of trend analysis.

5.3. Trend Analysis Strategy and Evaluation

In addition to trading returns, understanding the strength of the market with respect to trends is also of the same importance. Looking at the trend of the market, the investors can change their strategy according to market demand. To identify the market trend, in this second phase of experimentation, we present the comparison results of trends observed based on the predictive output of the best-obtained models for all three currency pairs for both short-term and long-term timeframes using the proposed trend analysis strategy (explained in Section 3.2 with algorithm and example).
Table 7 presents the number of up trends and down trends observed in the proposed trend analysis strategies with respect to the previous day and determinant day for both short-term and long-term predictive timeframes, the trend observed in the original datasets, ADX, ROC, momentum, CCI, and MACD technical analysis tools for both the short-term and long-term ahead of the day of predictions. Furthermore, the percentage (%) of accuracy observed during trend analysis with respect to actual trends obtained from the original datasets for three currency pairs along with the technical analysis tools is reported in Table 8, inferred from Table 7.
However, from Table 8, it appears that the predictive ability of the proposed strategy for trend analysis can be summarized as: (a) with respect to the previous day for short-term predictions, AUD:INR achieves 99.7265% and GBP:INR achieves 99.6582% for long-term predictions; (b) considering the trend analysis strategy with respect to the determinant day, AUD:INR achieves 98.2906% for short-term predictive days and USD:INR achieves accuracy of trend forecasting with 96.0342%. The other technical tools taken as comparisons show lower accuracy in comparison to the proposed strategies for both predictive timeframes.
After observing the predictive ability of the proposed trend analysis strategy, in this part of the result analysis, we tried to measure the magnitude of ups and downs observed (in units) during up trends and down trends noted for the whole span of datasets by the proposed trend analysis strategy as well as ADX and ROC. Momentum, CCI, and MACD provide a better insight into the trends observed in up trends and down trends, but they do not contribute to measuring the magnitude of the ups and downs (in units). The risks associated with this financial market can be defined as maximum units down during down trends, minimum units up during up trends, and average units up and/or down. To handle this risk factor, an attempt was made to help Forex investors and traders to identify not only trends but also the strength of trends with respect to the average, maximum, and minimum number of units either up or down observed during the up trends or down trends and put them in a position to understand the profitable entry and exit points and provide buying or selling opportunities. In view of this, Table 9, Table 10 and Table 11 report the average units, maximum units, and minimum units of return results obtained with respect to up trends and down trends experimented for the proposed trend analysis strategies (both with respect to previous-day and determinant day), respectively, for the three currency pair datasets for the period of collecting data (24 July 2006 to 20 August 2021, with 2925 samples). The results discussed in those three tables are perhaps the most important results so far, as they demonstrate both the trading returns and observed trends of this Forex market, which in turn helps investors to make a proper decision on their investments and the risks associated. From those data, it can be summarized that our proposed algorithm is also able to provide a decision-making platform for investors and traders.

5.4. Average Computational Time

Table 12 and Table 13 present the average computational times measured in seconds for all five variants of LSTM predictive networks and the proposed trend analysis strategy as well as the technical indicators used for trend analysis. From Table 12, Vanilla-LSTM has the minimum average computational time, as this is the basic LSTM model, whereas Stacked-LSTM uses two layers of basic LSTM, and in Bidirectional-LSTM, the input flows in both directions; as such, the forward layer and backward layer increase the computational time. Similarly, CNN-LSTM and Conv-LSTM use 64 filters leading to more computational time.
Similarly, from Table 13, the average computational time of the proposed trend analysis strategy is more in comparison to the rest of the other technical analysis tools, but only 0.27612 s, so it is not on that higher side. Finally, it is also important to note that the performance of the learning and trend analysis strategies must show significant improvements in terms of understanding returns, which in turn helps to obtain the reduction in risks to decide the entry and exit points in this Forex market which has been well addressed in this work.

6. Conclusions and Future Scope

In the current scenario, it is the best idea to trade with the trend in any financial market to comprehend when a trend is going to be exhausted, and a correction or reversal will be to decide on entry and exit points to be profitable. Looking at this, this paper presented a new trend analysis framework that was formulated to identify the up trends and down trends. This analysis enabled us to identify the profitable currency to trade with low risks by obtaining the average, maximum, and minimum number of units up and/or down during the observed-up trends and down trends. To design this empirical study, three currency pairs concerning INR: GBP:INR, AUD:INR, and USD:INR were considered, and the closing prices of those currency pair datasets were predicted using five variants of the LSTM network for both short-term and long-term timeframes. Then, a trend analysis strategy was proposed where the closing price of the previous day and a day of the determinant (a user-defined input) were experimented and a straightforward comparison was made with a few readily available technical analysis tools such as ADX, ROC, momentum, CCI, and MACD. The number of up trends and down trends, along with the percentage of accuracy and the magnitude of units up and down during observed up trends and down trends, were recorded. Those obtained results can facilitate a demonstration of both trading returns and observed trends of this Forex market, which can assist investors in making proper decisions on their investments and the associated risks. The practical applications of this work can be stated as follows: Forex forecasting makes it easier to apply technical analysis and make short-term and long-term predictions about the market’s direction. This information is helpful to individual traders looking to minimize losses and maximize profits. This Forex market prediction technique using deep learning allows us to implement a range of different methodologies and approaches to help investors and traders to gain an edge in this financial market. Trend analysis can be helpful to investors and traders to forecast future movements in exchange rates using past data by looking at the patterns and signals to understand the entry and exit points in this volatile market.
Future work will try to investigate more non-correlated and high-volatile currency pair datasets and shall try to forecast the trade and trend using a tailored classification and/or ensemble approach, which will not only forecast the closing price and trends but also try to reduce the risks associated in this volatile market to provide a more profitable trading strategy.

Author Contributions

Conceptualization, D.M. and A.K.M.; methodology, A.K.D. and D.M.; software, D.M.; validation, D.M., M.A.M. and A.S.A.-W.; formal analysis, K.D., D.M. and A.K.M.; investigation, S.K. and D.M.; resources, J.K., A.S.A.-W., S.K.; data curation, M.A.M. and A.K.D.; writing—original draft preparation, D.M. and A.K.M.; writing—review and editing, A.K.D., K.D. and J.K.; visualization, A.S.A.-W. and M.A.M.; supervision, D.M. and K.D.; project administration, M.A.M. and S.K.; funding acquisition, J.K. All authors have read and agreed to the published version of the manuscript.

Funding

This research was supported by the Basic Science Research Program through the National Research Foundation of Korea (NRF), funded by the Ministry of Education (No. 2020R1I1A3069700).

Institutional Review Board Statement

Not applicable.

Informed Consent Statement

Not applicable.

Data Availability Statement

Not applicable.

Conflicts of Interest

The authors declare no conflict of interest.

References

  1. Delgado-Bonal, A.; López, Á.G. Quantifying the randomness of the forex market. Phys. A Stat. Mech. Its Appl. 2021, 569, 125770. [Google Scholar] [CrossRef]
  2. Kočenda, E.; Moravcová, M. Exchange rate comovements, hedging and volatility spillovers on new EU forex markets. J. Int. Financ. Mark. Inst. Money 2019, 58, 42–64. [Google Scholar] [CrossRef] [Green Version]
  3. Abounoori, E.; Shahrazi, M.; Rasekhi, S. An investigation of Forex market efficiency based on detrended fluctuation analysis: A case study for Iran. Phys. A Stat. Mech. Its Appl. 2012, 391, 3170–3179. [Google Scholar] [CrossRef]
  4. Beckmann, J.; Boonman, T.M. Expectations, disagreement and exchange rate pressure. Econ. Lett. 2022, 212, 110205. [Google Scholar] [CrossRef]
  5. Sarangi, P.K.; Chawla, M.; Ghosh, P.; Singh, S.; Singh, P. FOREX trend analysis using machine learning techniques: INR vs USD currency exchange rate using ANN-GA hybrid approach. Mater. Today Proc. 2022, 49, 3170–3176. [Google Scholar] [CrossRef]
  6. Talebi, H.; Hoang, W.; Gavrilova, M.L. Multi-scale Foreign Exchange Rates Ensemble for Classification of Trends in Forex Market. Procedia Comput. Sci. 2014, 29, 2065–2075. [Google Scholar] [CrossRef] [Green Version]
  7. Kaltwasser, P.R. Uncertainty about fundamentals and herding behavior in the FOREX market. Phys. A Stat. Mech. Its Appl. 2010, 389, 1215–1222. [Google Scholar] [CrossRef]
  8. Wen, T.; Wang, G.-J. Volatility connectedness in global foreign exchange markets. J. Multinatl. Financ. Manag. 2020, 54, 100617. [Google Scholar] [CrossRef]
  9. Neely, C.; Weller, P.A. Lessons from the evolution of foreign exchange trading strategies. J. Bank. Financ. 2013, 37, 3783–3798. [Google Scholar] [CrossRef] [Green Version]
  10. Ni, L.; Li, Y.; Wang, X.; Zhang, J.; Yu, J.; Qi, C. Forecasting of Forex Time Series Data Based on Deep Learning. Procedia Comput. Sci. 2019, 147, 647–652. [Google Scholar] [CrossRef]
  11. Gonçalves, R.; Ribeiro, V.M.; Pereira, F.L.; Rocha, A.P. Deep learning in exchange markets. Inf. Econ. Policy 2019, 47, 38–51. [Google Scholar] [CrossRef]
  12. Sengupta, S.; Basak, S.; Saikia, P.; Paul, S.; Tsalavoutis, V.; Atiah, F.; Ravi, V.; Peters, A. A review of deep learning with special emphasis on architectures, applications and recent trends. Knowl.-Based Syst. 2020, 194, 105596. [Google Scholar] [CrossRef] [Green Version]
  13. Ozbayoglu, A.M.; Gudelek, M.U.; Sezer, O.B. Deep learning for financial applications: A survey. Appl. Soft Comput. 2020, 93, 106384. [Google Scholar] [CrossRef]
  14. Yang, S. A novel study on deep learning framework to predict and analyze the financial time series information. Future Gener. Comput. Syst. 2021, 125, 812–819. [Google Scholar] [CrossRef]
  15. Sezer, O.B.; Gudelek, M.U.; Ozbayoglu, A.M. Financial time series forecasting with deep learning: A systematic literature review: 2005–2019. Appl. Soft Comput. 2020, 90, 106181. [Google Scholar] [CrossRef] [Green Version]
  16. Ahmed, S.; Hassan, S.-U.; Aljohani, N.R.; Nawaz, R. FLF-LSTM: A novel prediction system using Forex Loss Function. Appl. Soft Comput. 2020, 97, 106780. [Google Scholar] [CrossRef]
  17. Shen, M.-L.; Lee, C.-F.; Liu, H.-H.; Chang, P.-Y.; Yang, C.-H. Effective multinational trade forecasting using LSTM recurrent neural network. Expert Syst. Appl. 2021, 182, 115199. [Google Scholar] [CrossRef]
  18. Park, S.; Yang, J.-S. Interpretable deep learning LSTM model for intelligent economic decision-making. Knowl.-Based Syst. 2022, 248, 108907. [Google Scholar] [CrossRef]
  19. U, J.; Lu, P.; Kim, C.; Ryu, U.; Pak, K. A new LSTM based reversal point prediction method using upward/downward reversal point feature sets. Chaos Solitons Fractals 2020, 132, 109559. [Google Scholar] [CrossRef]
  20. Ji, L.; Zou, Y.; He, K.; Zhu, B. Carbon futures price forecasting based with ARIMA-CNN-LSTM model. Procedia Comput. Sci. 2019, 162, 33–38. [Google Scholar] [CrossRef]
  21. Lee, S.W.; Kim, H.Y. Stock market forecasting with super-high dimensional time-series data using ConvLSTM, trend sampling, and specialized data augmentation. Expert Syst. Appl. 2020, 161, 113704. [Google Scholar] [CrossRef]
  22. Raghav, A. Know The Best Evaluation Metrics for Your Regression Model! Published on 19 May 2021 and Last Modified on 21 July 2022. 2021. Available online: https://www.analyticsvidhya.com/blog/2021/05/know-the-best-evaluation-metrics-for-your-regression-model/ (accessed on 16 August 2022).
  23. Friedman Test/Two-way Analysis of Variance by Ranks. Available online: https://www.statisticshowto.com/friedmans-test/ (accessed on 17 August 2022).
  24. Upper Critical Values for the Friedman Test. Available online: https://www.york.ac.uk/depts/maths/tables/friedman.pdf (accessed on 16 August 2022).
  25. Vajda, V. Could a Trader Using Only “Old” Technical Indicator be Successful at the Forex Market? Procedia Econ. Financ. 2014, 15, 318–325. [Google Scholar] [CrossRef] [Green Version]
  26. Ozturk, M.; Toroslu, I.H.; Fidan, G. Heuristic based trading system on Forex data using technical indicator rules. Appl. Soft Comput. 2016, 43, 170–186. [Google Scholar] [CrossRef]
  27. Alonso-Monsalve, S.; Suárez-Cetrulo, A.L.; Cervantes, A.; Quintana, D. Convolution on neural networks for high-frequency trend prediction of cryptocurrency exchange rates using technical indicators. Expert Syst. Appl. 2020, 149, 113250. [Google Scholar] [CrossRef]
  28. Sun, S.; Wang, S.; Wei, Y. A new ensemble deep learning approach for exchange rates forecasting and trading. Adv. Eng. Inform. 2020, 46, 101160. [Google Scholar] [CrossRef]
  29. Islam, M.S.; Hossain, E. Foreign exchange currency rate prediction using a GRU-LSTM hybrid network. Soft Comput. Lett. 2021, 3, 100009. [Google Scholar] [CrossRef]
  30. Wang, G.; Tao, T.; Ma, J.; Li, H.; Fu, H.; Chu, Y. An improved ensemble learning method for exchange rate forecasting based on complementary effect of shallow and deep features. Expert Syst. Appl. 2021, 184, 115569. [Google Scholar] [CrossRef]
  31. Lin, Y.; Wang, R.; Gong, X.; Jia, G. Cross-correlation and forecast impact of public attention on USD/CNY exchange rate: Evidence from Baidu Index. Phys. A Stat. Mech. Its Appl. 2022, 604, 127686. [Google Scholar] [CrossRef]
  32. Patel, M.M.; Tanwar, S.; Gupta, R.; Kumar, N. A Deep Learning-based Cryptocurrency Price Prediction Scheme for Financial Institutions. J. Inf. Secur. Appl. 2020, 55, 102583. [Google Scholar] [CrossRef]
  33. Tokár, T.; Horváth, D. Market inefficiency identified by both single and multiple currency trends. Phys. A Stat. Mech. Its Appl. 2012, 391, 5620–5627. [Google Scholar] [CrossRef]
  34. Lee, Y.; Ow, L.T.C.; Ling, D.N.C. Hidden Markov Models for Forex Trends Prediction. In Proceedings of the 2014 International Conference on Information Science & Applications (ICISA), Seoul, Korea, 6–9 May 2014; pp. 1–4. [Google Scholar]
  35. Lahmiri, S. Long memory in international financial markets trends and short movements during 2008 financial crisis based on variational mode decomposition and detrended fluctuation analysis. Phys. A Stat. Mech. Its Appl. 2015, 437, 130–138. [Google Scholar] [CrossRef]
  36. Sandoval, J.; Nino, J.; Hernandez, G.; Cruz, A. Detecting Informative Patterns in Financial Market Trends based on Visual Analysis. Procedia Comput. Sci. 2016, 80, 752–761. [Google Scholar] [CrossRef] [Green Version]
  37. Bartoš, E.; Pinčák, R. Identification of market trends with string and D2-brane maps. Phys. A Stat. Mech. Its Appl. 2017, 479, 57–70. [Google Scholar] [CrossRef] [Green Version]
  38. Adegboye, A.; Kampouridis, M.; Johnson, C.G. Regression genetic programming for estimating trend end in foreign exchange market. In Proceedings of the 2017 IEEE Symposium Series on Computational Intelligence (SSCI), Honolulu, HI, USA, 27 November–1 December 2017; pp. 1–8. [Google Scholar]
  39. Palsma, J.; Adegboye, A. Optimising Directional Changes trading strategies with different algorithms. In Proceedings of the 2019 IEEE Congress on Evolutionary Computation (CEC), Wellington, New Zealand, 10–13 June 2019; pp. 3333–3340. [Google Scholar]
  40. Adegboye, A.; Kampouridis, M. Machine learning classification and regression models for predicting directional changes trend reversal in FX markets. Expert Syst. Appl. 2021, 173, 114645. [Google Scholar] [CrossRef]
  41. Sadeghi, A.; Daneshvar, A.; Zaj, M.M. Combined ensemble multi-class SVM and fuzzy NSGA-II for trend forecasting and trading in Forex markets. Expert Syst. Appl. 2021, 185, 115566. [Google Scholar] [CrossRef]
  42. Fiorucci, J.A.; Silva, G.N.; Barboza, F. Reaction trend system with GARCH quantiles as action points. Expert Syst. Appl. 2022, 198, 116750. [Google Scholar] [CrossRef]
  43. Zhi, B.; Wang, X.; Xu, F. Managing inventory financing in a volatile market: A novel data-driven copula model. Transp. Res. Part E Logist. Transp. Rev. 2022, 165, 102854. [Google Scholar] [CrossRef]
  44. Zhuang, X.; Wei, D. Asymmetric multifractality, comparative efficiency analysis of green finance markets: A dynamic study by index-based model. Phys. A Stat. Mech. Its Appl. 2022, 604, 127949. [Google Scholar] [CrossRef]
  45. Xu, C.; Liu, Z.; Liao, M.; Yao, L. Theoretical analysis and computer simulations of a fractional order bank data model incorporating two unequal time delays. Expert Syst. Appl. 2022, 199, 116859. [Google Scholar] [CrossRef]
  46. Fuentes, R.; Cantillo, V.; López-Ospina, H. A road pricing model involving social costs and infrastructure financing policies. Appl. Math. Model. 2022, 105, 729–750. [Google Scholar] [CrossRef]
  47. Samanta, S.R.; Mallick, P.K.; Pattnaik, P.K.; Mohanty, J.R.; Polkowski, Z. (Eds.) Cognitive Computing for Risk Management; Springer: Berlin/Heidelberg, Germany, 2022. [Google Scholar]
  48. Mukherjee, A.; Singh, A.K.; Mallick, P.K.; Samanta, S.R. Portfolio Optimization for US-Based Equity Instruments Using Monte-Carlo Simulation. In Cognitive Informatics and Soft Computing; Lecture Notes in Networks and Systems; Mallick, P.K., Bhoi, A.K., Barsocchi, P., de Albuquerque, V.H.C., Eds.; Springer: Singapore, 2022; Volume 375. [Google Scholar] [CrossRef]
  49. GBP to INR-British Pound Rupee. Available online: https://in.investing.com/currencies/gbp-inr-historical-data (accessed on 10 January 2022).
  50. AUD to INR-British Pound Rupee. Available online: https://in.investing.com/currencies/aud-inr-historical-data (accessed on 10 January 2022).
  51. USD to INR-British Pound Rupee. Available online: https://in.investing.com/currencies/usd-inr-historical-data (accessed on 10 January 2022).
Figure 1. Example of proposed trend analysis strategy showing lows and highs for determining the up trends and down trends.
Figure 1. Example of proposed trend analysis strategy showing lows and highs for determining the up trends and down trends.
Mathematics 10 03632 g001
Figure 2. Schematic layout of the proposed trade and trend analysis model.
Figure 2. Schematic layout of the proposed trade and trend analysis model.
Mathematics 10 03632 g002
Figure 3. Short-term and long-term prediction graphs and MSE graphs using Vanilla-LSTM for (a) GBP:INR, (b) AUD:INR, and (c) USD:INR currency pair datasets.
Figure 3. Short-term and long-term prediction graphs and MSE graphs using Vanilla-LSTM for (a) GBP:INR, (b) AUD:INR, and (c) USD:INR currency pair datasets.
Mathematics 10 03632 g003
Figure 4. Short-term and long-term prediction graphs and MSE graphs using Stacked-LSTM for (a) GBP:INR, (b) AUD:INR, and (c) USD:INR currency pair datasets.
Figure 4. Short-term and long-term prediction graphs and MSE graphs using Stacked-LSTM for (a) GBP:INR, (b) AUD:INR, and (c) USD:INR currency pair datasets.
Mathematics 10 03632 g004
Figure 5. Short-term and long-term prediction graphs and MSE graphs using Bidirectional-LSTM for (a) GBP:INR, (b) AUD:INR, and (c) USD:INR currency pair datasets.
Figure 5. Short-term and long-term prediction graphs and MSE graphs using Bidirectional-LSTM for (a) GBP:INR, (b) AUD:INR, and (c) USD:INR currency pair datasets.
Mathematics 10 03632 g005
Figure 6. Short-term and long-term prediction graphs and MSE graphs using CNN-LSTM for (a) GBP:INR, (b) AUD:INR, and (c) USD:INR currency pair datasets.
Figure 6. Short-term and long-term prediction graphs and MSE graphs using CNN-LSTM for (a) GBP:INR, (b) AUD:INR, and (c) USD:INR currency pair datasets.
Mathematics 10 03632 g006
Figure 7. Short-term and long-term prediction graphs and MSE graphs using Conv-LSTM for (a) GBP:INR, (b) AUD:INR, and (c) USD:INR currency pair datasets.
Figure 7. Short-term and long-term prediction graphs and MSE graphs using Conv-LSTM for (a) GBP:INR, (b) AUD:INR, and (c) USD:INR currency pair datasets.
Mathematics 10 03632 g007
Table 1. Example of proposed trend analysis strategy.
Table 1. Example of proposed trend analysis strategy.
Days (D) Previous   Day   Magnitude   ( P v ) Determinant Day Magnitude ( P m ) Window Number and Trend CalculationAnalysis
D 01 00 w 0
D 4 with respect to Previous Day = −45/4 = −10.25
D 4 with respect to Determinant day = Analysis cannot be carried out as there is no information about previous determinant days
Considering the previous day of the D 4 condition, the trend observed is DOWN with 10.25 units.
D 02 −180
D 03 −120
D 04 −150
D 05 −5−50 w 1
D 8 with respect to Previous Day = +16/4 = +4
D 8 with respect to Determinant day = −74/4 = −18.5
Considering previous day of the D 8 condition, the trend observed is UP with 4 units, and for the determinant day it is DOWN by 18.5 units. This signifies that it has a short-term rise of 3.5 units and a long-term fall of 18.5 units.
D 06 0−32
D 07 +12−8
D 08 +9+16
D 06 0−32 w 2
D 9 with respect to Previous Day = +333/4 = +8
D 9 with respect to Determinant day = +8/4 = +2
Considering the previous day of the D 9 condition, the trend observed is UP with 8 units, and for the determinant day, it is UP by 2 units. This signifies that it has a short-term rise of 7.5 units and a long-term rise of 2 units per step.
D 07 +12−8
D 08 +9+16
D 09 +11+32
D 07 +12−8 w 3
D 10 with respect to Previous Day = +21/4 = +5.25
D 10   with respect to Determinant day =
+ 61/4 = +15.25
Considering the previous day of the D 10 condition, the trend observed is UP with 5.25 units, and for the determinant day, it is UP by 15.25 units. This signifies that it has a short-term rise of 4.75 units and a long-term rise of 15.25 units per step.
D 08 +9+16
D 09 +11+32
D 10 −11+21
D 08 +9+16 w 4
D 11 with respect to Previous Day = −2/4 = −0.05
D 11 with respect to Determinant day =
+ 67/4 = +17.25
Considering the previous day of the D 11 condition, the trend observed is DOWN with 0.05 units, and for the determinant day, it is UP by 17.25 units. This signifies that it has a short-term fall of 0.05 units and a long-term rise of 17.25 units per step.
D 09 +11+32
D 10 −11+21
D 11 −11−2
D 09 +11+32 w 5
D 12 with respect to Previous Day = −21/4 = −5.25
D 11 with respect to Determinant day =
+30/4 = +7.5
Considering the previous day of the D 12 condition, the trend observed is DOWN with −5.25 units, and for the determinant day, it is UP by 7.5 units. This signifies that it has a short-term fall of 5.25 units and a long-term rise of 7.5 units per step.
D 10 −11+21
D 11 −11−2
D 12 −10−21
Table 2. Indicators used for trend analysis [25,26,27].
Table 2. Indicators used for trend analysis [25,26,27].
IndicatorsFormulaRange of ValuesDiscussion
ADX A D X = M A + D I D I + D I   +   D I × 100 ,
where MA is the moving average, and DI is are the positive and negative directional movements representing the difference between today’s and yesterday’s highest price and the difference between today’s and yesterday’s lowest price, respectively.
0 to 100It helps to identify the strongest trends and distinguishes between trending and non-trending situations. ADX > 25 signifies trend strength while ADX < 25 represents a weak trend.
ROC R O C = B     A A × 100 ,
where, B is the price at the current time, and A is the price at the previous time, proving a value as a percentage.
0 to 100When ROC is above the zero line, it signifies the uptrend is accelerating, and when it is below the zero line, it represents the uptrend slowing down and trending towards a down trend.
Momentum M o m e n t u m = V V x ,
where V is the latest price and V x is closing price, and x is the number of days ago.
+ or −This is computed by continually taking the price difference for a fixed timeframe. For example, to construct a 10-day momentum line, the closing price of 10 days ago is subtracted from the last closing price, and these positive and negative values are then plotted around a zero line to observe the trends. Above the zero line represents up trends, below the zero line represents down trends, and the value on the zero line represents a stable condition.
CCI C C I T P 20   p e r i o d   S M A   o f   T P / 0.015 × M e a n   D e v i a t i o n ,
where TP is the typical price and is computed as H i g h   +   L o w   +   C l o s e 3 , 0.015 is a constant, and SMA is a simple moving average. The mean deviation is calculated by subtracting the 20-period average typical prices from each period’s typical price.
<−100 to >+100Generally, this CCI value fluctuates above and below 0. The CCI is relatively high when prices are far above their average and low when the prices are far below their average. CCI > +100 shows the buy signal, and CCI < −100 shows the sell signal. In another way, it represents up trends and down trends, respectively.
MACD M A C D = 12   p e r i o d   E M A 26   p e r i o d   E M A ,
where EMA is an exponential moving average.
+ or −When MACD crosses above the zero line, the decision is taken to buy and when below the zero line, it signals to sell. Similar to CCI, it also represents up trends and down trends, respectively.
Table 3. Currency datasets experimented with for Forex market analysis.
Table 3. Currency datasets experimented with for Forex market analysis.
CurrencyTraining SetTesting SetFeatures
GBP:INR27751189Open, Low, High, and Close Price
AUD:INR27511179
USD:INR27511178
Table 4. Parameters and their assigned values of CNN-LSTM and Conv-LSTM.
Table 4. Parameters and their assigned values of CNN-LSTM and Conv-LSTM.
Networks/ModelsParameters and Values
CNN-LSTMConv1D = filters = 64; kernel_size = 1; activation = ‘relu’
MaxPooling1D = pool_size = 2
Conv-LSTMFilters = 64; kernel_size = (1,2); activation = ‘relu’
Table 5. Recognition performance in training and testing phases for all three currency pairs and for both short-term and long-term predictive days.
Table 5. Recognition performance in training and testing phases for all three currency pairs and for both short-term and long-term predictive days.
Currency Pairs/Prediction HorizonPerformance MeasuresTraining PhaseTesting Phase
Vanilla-LSTMStacked-LSTMBidirectional-LSTMCNN-LSTMConv-LSTMVanilla-LSTMStacked-LSTMBidirectional-LSTMCNN-LSTMConv-LSTM
GBP:INR/Short termMSE0.00020.00010.00010.00050.00070.00010.00090.00010.00080.0001
R20.99280.99500.99550.99860.99790.99940.99950.99940.99960.9993
EVS0.99580.99650.99770.99890.99930.99950.99950.99960.99960.9995
ME0.05850.04410.04340.03710.04160.02350.02130.02270.02100.0227
GBP:INR/Long termMSE0.00040.00090.00020.00060.00010.00010.00010.00010.00070.0009
R20.98920.99750.99240.99850.99590.99900.99920.99920.99960.9994
EVS0.99420.99940.99610.99920.99730.99900.99930.99940.99960.9995
ME0.08970.02560.05830.03330.04530.03770.02230.02450.02230.0217
AUD:INR/Short termMSE0.00070.00050.00070.00170.00010.00010.00090.00020.00090.0003
R20.93400.95060.94110.85710.98970.99870.99930.99840.99350.9978
EVS0.97690.98180.98280.97530.99920.99900.99930.99930.99920.9988
ME0.09180.08100.07780.09990.03470.04900.04220.03900.03470.0485
AUD:INR/Long termMSE0.00100.00320.00090.00070.00030.00010.00040.00070.00090.0001
R20.91420.72510.91790.93810.96990.99890.99740.99490.99930.9992
EVS0.95940.92190.98860.97270.98980.99890.99840.99860.99940.9993
ME0.11410.17090.07370.09160.05450.03940.04400.03700.04080.0429
USD:INR/Short termMSE0.00010.00010.00010.00140.00020.00080.00070.00010.00090.0006
R20.99700.99660.99580.96840.99530.99890.99900.99820.99870.9991
EVS0.99930.99850.99740.98830.99850.99890.99900.99900.99870.9991
ME0.03890.05780.05560.09730.06230.01570.01560.01800.01730.0183
USD:INR/Long termMSE0.00500.00110.00030.00070.00170.00080.00070.00010.00020.0001
R20.89020.97600.99920.99840.96240.99870.99900.99910.99730.9985
EVS0.95780.99300.99950.99880.98580.99910.99900.99910.99870.9987
ME0.16400.08690.04210.05270.10630.01700.01810.01690.01850.0167
Table 7. Number of up trends and down trends observed for three currency pairs.
Table 7. Number of up trends and down trends observed for three currency pairs.
Tools and Methods Compared withNo. of TrendsGBP:INRAUD:INRUSD:INR
Actual Trends Observed on original datasetsUp Trends144014251504
Down Trends148515001421
Proposed Trend Analysis Approach
[Previous day]
Up Trends [Short-term]137614291387
Up Trends [Long-term]144514321510
Down Trends [Short-term]154914961538
Down Trends [Long-term]148014931415
Proposed Trend Analysis Approach
[Determinant day]
Up Trends [Short-term]136414001350
Up Trends [Long-term]156015221562
Down Trends [Short-term]156115251575
Down Trends [Long-term]136514031363
ADXUp Trends245120181789
Down Trends4749071136
ROCUp Trends156315211576
Down Trends136214041349
MomentumUp Trends151214411589
Down Trends141314841336
CCIUp Trends155015081544
Down Trends137514171381
MACDUp Trends8271760761
Down Trends209811652164
Table 8. Percentage of accuracy (in %) observed during trend analysis with respect to actual trends observed from the original datasets for three currency pairs.
Table 8. Percentage of accuracy (in %) observed during trend analysis with respect to actual trends observed from the original datasets for three currency pairs.
Tools and Methods Compared withPrediction TimeframeGBP:INRAUD:INRUSD:INR
Proposed Trend Analysis Approach
[Previous day]
Short-term95.62499.726592.00
Long-term99.658299.521499.5898
Proposed Trend Analysis Approach
[Determinant day]
Short-term94.803598.290689.4701
Long-term91.784993.367696.0342
ADX30.871859.45380.5729
ROC91.589893.435995.0770
Momentum95.07798.769394.1881
CCI92.478794.328297.2650
MACD58.085577.094149.1966
Table 9. Average units up and down (return results) observed for three currency pairs.
Table 9. Average units up and down (return results) observed for three currency pairs.
Tools and Methods Compared withPrediction TimeframeTrendsGBP:INRAUD:INRUSD:INR
Proposed Trend Analysis Approach
[Previous day]
Short-termUps0.10140.05550.0440
Downs0.11050.06450.0587
Long-termUps0.19920.12280.0898
Downs0.41520.24860.2068
Proposed Trend Analysis Approach
[Determinant day]
Short-termUps0.83850.47960.3816
Downs0.88780.50430.4513
Long-termUps1.58590.91550.8222
Downs1.48810.82390.6552
ADXUps4.36205.33280.6627
Downs18.742211.97670.3795
ROCUps1.56641.60971.1352
Downs1.45411.43650.9228
MomentumUps1.37640.79810.6813
Downs1.32370.74320.5702
CCIUps94.289224.486494.1963
Downs92.033425.510587.6374
MACDUps2.15681.38421.2850
Downs1.66361.13620.9951
Table 10. Maximum units up and down (return results) observed for three currency pairs.
Table 10. Maximum units up and down (return results) observed for three currency pairs.
Tools and Methods Compared withPrediction TimeframeTrendsGBP:INRAUD:INRUSD:INR
Proposed Trend Analysis Approach
[Previous day]
Short-termUps0.85780.35690.3613
Downs0.66670.13336.6667
Long-termUps7.23802.07902.2500
Downs0.0010.0010.001
Proposed Trend Analysis Approach
[Determinant day]
Short-termUps10.1083.45423.577
Downs0.40.46663.5487
Long-termUps12.476.2228.074
Downs0.0010.0020.003
ADXUps72.887240.92582.8636
Downs0.00860.00860.0005
ROCUps10.425910.79539.8713
Downs0.00190.00740.0016
MomentumUps8.90804.43206.0110
Downs0.0020.0040.001
CCIUps314.0978127.3759327.078
Downs0.13240.03970.0647
MACDUps4.08453.35074.4197
Downs0.00010.00080.0016
Table 11. Minimum units up and down (return results) observed for three currency pairs.
Table 11. Minimum units up and down (return results) observed for three currency pairs.
Tools and Methods Compared withPrediction TimeframeTrendsGBP:INRAUD:INRUSD:INR
Proposed Trend Analysis Approach
[Previous day]
Short-termUps0.666700
Downs0.80210.42840.5063
Long-termUps000
Downs000
Proposed Trend Analysis Approach
[Determinant day]
Short-termUps0.00040.00020.3333
Downs5.95712.75472.4950
Long-termUps000
Downs13.1765.0065.43
ADXUps0.04070.00070.0002
Downs6.19252.97101.9347
ROCUps00.00180
Downs12.853514.53467.7303
MomentumUps00.0010
Downs12.7416.9825.165
CCIUps0.304800.2554
Downs310.2466178.3489349.7084
MACDUps0.00960.00040.003
Downs3.32724.37391.9886
Table 12. Average computational time taken (in seconds) for variants of LSTM forecasting models.
Table 12. Average computational time taken (in seconds) for variants of LSTM forecasting models.
Forecasting Models/Execution TimeVanilla-LSTMStacked-LSTMBidirectional-LSTMCNN-LSTMCovn-LSTM
125.06812161.3049161.9708171.1201169.0091
Table 13. Average computational time taken (in seconds) for proposed trend analysis strategies and technical indicators.
Table 13. Average computational time taken (in seconds) for proposed trend analysis strategies and technical indicators.
Trend AnalysisProposed Trend Analysis ApproachADXROCMomentumCCIMACD
0.2726120.155050.00370.00180.001740.0017
Publisher’s Note: MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Share and Cite

MDPI and ACS Style

Das, A.K.; Mishra, D.; Das, K.; Mohanty, A.K.; Mohammed, M.A.; Al-Waisy, A.S.; Kadry, S.; Kim, J. A Deep Network-Based Trade and Trend Analysis System to Observe Entry and Exit Points in the Forex Market. Mathematics 2022, 10, 3632. https://doi.org/10.3390/math10193632

AMA Style

Das AK, Mishra D, Das K, Mohanty AK, Mohammed MA, Al-Waisy AS, Kadry S, Kim J. A Deep Network-Based Trade and Trend Analysis System to Observe Entry and Exit Points in the Forex Market. Mathematics. 2022; 10(19):3632. https://doi.org/10.3390/math10193632

Chicago/Turabian Style

Das, Asit Kumar, Debahuti Mishra, Kaberi Das, Arup Kumar Mohanty, Mazin Abed Mohammed, Alaa S. Al-Waisy, Seifedine Kadry, and Jungeun Kim. 2022. "A Deep Network-Based Trade and Trend Analysis System to Observe Entry and Exit Points in the Forex Market" Mathematics 10, no. 19: 3632. https://doi.org/10.3390/math10193632

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop