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

: 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 proﬁt 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 ﬁnd 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 ﬁt 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 signiﬁcant 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 ﬁnancial market.


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 Mathematics 2022, 10, 3632 3 of 23 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.

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 crosscorrelation 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 cryptocurrencies, 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.

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.

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 sigmoid f unction (σ) takes care of this by looking at the previous state PS (t−1) along with the current input state CIS t using Equation (1) and outputs a number between [0, 1] for each number in the cell state CS (t−1) representing to either remember and completely keep or do not remember and completely forget. In this equation, FG t is known as the f orget gate and is the core of this first step to decide which information will be less important than the previous time step.
The second phase has two parts inbuilt into it. One is the sigmoid f unction (σ) which decides which values to consider (i.e., 0 or 1) and the tanh f unction (tanh) 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 IG t is the input gate, which is responsible for estimating the significance of the information during the current time step. (2)

of 23
In the third step, the old cell state CS (t−1) is updated into a new cell state CS t and then the CS (t−1) is multiplied with FG t to forget the information decided earlier using Equation (1). Then, IG t × C t is added, which yields newcandidatevalues scaled by how much to update each state value using Equation (4).
The final step decides the output and which current cell will be the output is decided through a sigmoid layer. The obtained cell state from this layer undergoes a tanh f unction to derive the values between −1 and 1 and multiplies it by the output of the sigmoid gate using Equations (5) and (6).
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.

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.
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.      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:

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. When 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
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. , 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 >+100 Generally, 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.
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.

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, R 2 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.

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.

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.

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.

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.

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.

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. 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.

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 shortterm and long-term predictive horizons for both training and testing data, are discussed in this section.

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 shortterm 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. 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 shortterm 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, R 2 , 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 R 2 , 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 R 2 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. Table 5. Recognition performance in training and testing phases for all three currency pairs and for both short-term and long-term predictive days.

Training Phase
Testing Phase  Second, the performance of those five LSTMs based on MSE, R 2 , 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 R 2 , 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 R 2 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;

Vanilla-LSTM
where N is the no. of datasets and K is the no. of hypotheses. Step 1. Let us define the null (H0) and alternate (H1) 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 3. Calculate the degrees of freedom (DF). DF = K − 1; K = number of blocks to be measured. Here, DF = 5 − 1 = 4. Step 4. Obtain the critical chi-square value (critical chi-square value for α = 0.25 and DF = 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.  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.

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, Tables 9-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.

Average Computational Time
Tables 12 and 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.

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.