Journal of Stock & Forex Trading

Journal of Stock & Forex Trading
Open Access

ISSN: 2168-9458

+44 1223 790975

Research Article - (2023)Volume 10, Issue 1

Forerunne Fault Tolerant Intelligent Indicator Based Forex Forecasting System

Sarala Sewwandi Kumarage*
 
*Correspondence: Sarala Sewwandi Kumarage, Department of Information Technology, Sri Lanka Institute of Information Technology Malabe, Sri Lanka, Tel: 94712974984, Email:

Author info »

Abstract

Knowledge of the current situation of the currency market in terms of the relative strength of the buyers and sellers is essential to make a good trading decision. It is advisable to buy the currency pairs if the buyers are high in the market. If the sellers dominate the market it is recommended to sell the currency pairs. There is already existing indicator known as Relative Strength Indicator which was developed by J. Welles Wilder. The mentioned indicator shows a figure called relative strength index calculated using the average gain and average loss during a given time period relative to a particular timeframe. Existing indicators calculate the RSI value with some time lag. Purpose of this study is to come up with a forecasting system to support manual currency trading with RSI indicator with a solution to the time lag of the existing indicator. RSI value also gives an idea about the current trend. If its value passes the halfway in a scale of 0 to 100 it confirms a forming trend in either direction. Neural networks have been identified as an emerging technique to predict the price actions of the currency markets. Advantage of using the neural networks is its ability to handle the nonlinearity of the price actions in a highly dynamic environment. This paper proposes a fault tolerant neural network model to predict the future price actions, minimize the time lag of the existing indicator along with the type of order, current trend, and take profit level and the stop loss levels for the next trade.

Keywords

Neural networks, RSI indicator, technical indicators; machine learning, keras

Introduction

Currency market [1] is an interbank market which operates electronically over 24x7 hours continuously. It is not being governed by any central location. In this market, traders can buy and sell currency pairs at a particular rate to trigger a trade. Comparing to the other financial markets liquidity of the currency market or the buying and selling amount at any given time is extremely high. As a currency trader it is important to take the right trading decision before making the trade. As an assistance for the trading decisions custom technical indicators [2] and expert advisors [3] and scripts [4] are already there in the market [5]. Existing indicators and expert advisors contribute to the trading decisions in different ways. However, there are some gaps in the provided solutions to execute a profitable trading decision. For a successful trading decision, it is important to know the current situation of the currency market in terms of the relative strength of the buyers and sellers. This paper introduces a fault tolerant intelligent indicator-based forex currency rates forecasting system using a neural network. System is based on machine learning concepts and it comes with a fault tolerant mechanism in the training phase. Large historical data set is used to train the model and it takes considerable time. Implemented system has a mechanism to restore the system to the state where it was, in case of a failure of the system.

It is important to know the effect of RSI value in terms of type of order, take profit levels and stop loss levels with a fault tolerance mechanism in case of a system failure during the training phase. Implemented system covers the following research objectives.

A Research Objectives

  • To come up with a fault tolerance mechanism to restore the system during the training phase due to a system
  • To determine the type of order (buy or sell) depending on the RSI
  • To determine the maximum possible profit in terms of number of pips depending on the high or low value based on the type of
  • To determine the maximum risk in terms of number of pips depending on the high and low value based on the type of order

Key concepts of this research cover the basic needs to make a trade with minimizing the risk and optimizing the neural network models and taking backups of the system in case of a system failure.

Literature Review

Regular technical indicators normally have a time lag to the actual market. They produce trading signals with some delay to the current market situation. A neural network model developed in 1995 by Keith C. C. Chan et al [7] came up with a system to generate trading signals before the regular technical indicators. This opens up an opportunity for traders to enter and exit the trades at the right time which causes higher profits. Non-linear variations were also captured by system and using neural networks it adapted itself to the emerging patterns of the currency market.

Economic news releases make a sensitive impact on the currency market. Normally they break the normal price action patterns and lead to high volatility in the market. In 1995 T.S. Quah et al [8] introduced a decision model to predict the currency exchange rate movements based on effect of economic statistics over interest rates. In 1995 Woon-Sen Gan et al [9]introduced a neural network system using multi variant model to predict the currency exchange returns to avoid the non-stationary characteristic of the spot prices. Univariate model does not consider the interdependencies of different currencies while the multivariate model considers 3 type of currencies in a single network.

Internet based collaborative computational environment is needed to provide visual insights to the user s using large complicated sets of data. Otherwise it would just be meaningless numbers. Ang Toon Wu et al [10] proposed 3 – tiered system architecture of a visualization system.

Ajith Abraham et al [11] has made an valiant attempt to compare the performance of neuro fuzzy systems and neural network in predicting monthly currency rates. Neuro fuzzy systems performed well than neural networks in terms of RMSE and training time. Neuro fuzzy system also can interpret the results using if else rules.

Ajith Abraham [12]made an analysis on soft, hard and hybrid computing techniques for forex monitoring systems in 2002. Lean Yu et al [13]proposed a hybrid AI system combining neural network implemented by matlab and expert system implemented using prolog..

To deal with noise and non-stationarity in time series over the method of grassberger and proccacia which computes correlation dimension of commonly used close points of the time series, M.A. Torkamani et al [14] recommended Japanese candlesticks. In 2007 Shuo Yao et al [15]introduced a portfolio management system based on fuzzy neural networks to select the right currency pairs to trade. Min Hao Eng et al [16]proposed an artificial neural network based on fundamental data which affects to the currency rates.

A case-based reasoning approach. K nearest neighbor and neural networks were used by Xiaoming Wang et al to propose a system to trade GBP/USD currency pair [17]. Abdulah Kayal presented a solution based on neural networks to filter the high frequency signals of a trading strategy [18].

Using the data gathered from traders’ accounts Shaimaa Masry et al developed an artificial forex market which enables the system to manage the crisis effectively [19]. Kraimon Maneesilp et al proposed a method to forecast parameters using fuzzy time series. It works for time varying fuzzy relationships. Proposed system gives better predictions in all time periods [20].

An analysis conducted by Rodrigo F. B. de Brito and Adriano L. I. Oliveira revealed that trading systems developed based on genetic algorithms optimizes the technical indicators better than the trading systems developed based on support vector regression and growing hierarchical self-organizing maps [21].Andrius Paukste and Aistis Raudys found that neural networks and regression trees are most suitable for spread or liquidity forecasting rather than simple averaging and regression [22].Yake Leng Yang et al introduced a method to find hidden and repeating patterns in time series data [23].

Ary Sespajayadi et al carried out a study and proposed a price forecasting system for EUR/USD currency pair using neural networks based on the genetic algorithm [24]. Piotr Czekalski et al proposed system to forecast EUR/USD price actions based on artificial intelligence and neural networks [25]. A system which is based on multiple indicators including moving average, RSI, Parabolic Stop and William % Range was proposed by a research on trend prediction [26]. introduced A currency rate prediction system based on statistical and machine learning approach was introduced by Sitti Wetenriajeng Sidehabi et al [27]. Seng Hansun came up with a solution for time series data forecasting by a new version of Brown’s Double Exponential Smoothing [28]. In 2016 a particular research came up with a new concept to enhance the trading strategies where the trader’s strategy get enhanced through a strategy enhancing language [29].

As a whole number of researches had been carried out from the predicting price action patterns to enabling automated trading through expert advisors. Other than that, technical indicators are already there in the market to provide some decision support in manual currency trading. Nevertheless, all the existing indicators including the RSI indicator which is focused in this paper do not provide the expert advises in terms of the order type, take profit limits and stop loss limits. As well as existing systems based on neural network models does not come up with a fault tolerant mechanism in case of a system failure during the training phase. Since the training phase takes a lot of time failure may result in doing the training from the scratch if the system does not have a mechanism to restore the system to the state where it was left off before the failure.

Methodology

Data Preparation

Currency rates of seven major currency pairs of 5 years of data were used as the data set. Different data cleansing mechanisms has been applied to the data in order to maintain the accuracy. System was tested for 8-time frames of the tested currency pairs.

System Design

Basic neural network depicted in Fig.1. predicts the open, close, high and low currency rates. Then the type of order or forming trend is determined according to the RSI value. Take profit levels and stop loss levels are calculated based on the type of order using open, low and high values. System is implemented using python, tensorflow [30]and keras. [31].

stock-forex-trading

Neural Network Design Overview

As the Fig. 2. Depicts implemented neural network consists of three sequential layers. Input layer takes high, low, open and close prices as its 4 inputs, hidden layer captures the interactions between the inputs and gives the predicted prices with captured interactions to the output layer, output layer takes the outputs of the hidden layer as the input and gives the final predicted values for the input parameters using the forward propagation algorithm.

stock-forex-trading

Figure2: Neural Network Design

Model Compilation

Neural network model is compiled with the stochastic gradient decent optimizer [32] along with the loss function of mean squared error. Loss function aggregates the errors in all data points in to a single number. In each epoch it updates the weights of the model in a way that the loss is minimum to optimize the model

Optimization Algorithm

Even though the model predicts the values using the forward propagation algorithm, nature of the neural network does not guarantee that the model will make good predictions. So, the model is optimized using the stochastic gradient algorithm in a way which will minimize the loss of the model. Model can make closer predictions by updating the weights of the node connections. Gradient decent algorithm starts optimizing at a random point. It finds the slope and move downwards until it reaches the minimum loss for a particular weight. In this case it has to find the minimum loss for set of weights at each data point.

Fig.3. illustrates the loss function against a two weights model and how the minimum loss value is found based on a single weight model. Implemented model’s relationship between its weights and loss function is far more complex to depict since lots of weights are associated with its data points. Making reliable predictions becomes harder as the number of data points increase. At each and every data point there is an error. Model aggregates the errors in to single value which represents the model’s performance.

stock-forex-trading

Figure 3: Optimizing weights over loss

Model Training & Fault Tolerance

Model is trained using training data set which accounts for 80 percent of the original data set with the features and labels. Model is trained according to the supervised learning methodology. 20 percent of the original data set is dedicated for the testing purposes. Model is trained for number of epochs using different batch sizes.

Training phase of neural networks takes very long- time periods. If the system goes down during the training it may loss lots of work that have been already done along the way. Implemented system used a mechanism to put checkpoints on the model’s weights during the training based on the minimization or the maximization of the monitored quantity. If the loss is monitored model weights are overwritten in a file only if the loss is decreased compared to the last epoch. If the accuracy is monitored model weights are overwritten only if the accuracy is increased compared to the last epoch.

Saving The Best Weighted Model

Weights of the neural network get changed during the training process with the stochastic gradient optimization. Implemented system put check points [33] on weights of the model’s during each epoch. During the training it tracks the best weights compared to the previous epochs. In case of system failure best model so far during the training is saved in a hdf5 file. Architecture of the model, weights of the model, training configurations and the state of the optimizer get saved in this process.

Resuming The Model For Predictions

System can be actually deployed for making predictions by using the best weighted model saved after the most recent training phase. Prices are predicted using the forward propagation algorithm with the optimized weights.

Since the state of the optimizer is saved using checkpointed [33] method training process can be resumed or restored at the place where it was left off.

Fig4. Represents the process between the input layer and hidden layer. Input layer takes inputs of shape four with any number of records. First layer has an activation function acts as an identity function which returns input as it is since the hidden layer needs the same inputs to capture their interactions. At each node four inputs gets multiplied with its associated weight.

stock-forex-trading

Figure 4: Process in between the input layer and hidden layer using forward propagation algorithm.

Fig .5. Outputs of the hidden layer, which has learned about the interactions is taken as inputs to the output layer. Same identity function applies to them and it returns the final predictions. Here neural network is fed forward with the data.

stock-forex-trading

Figure 5: Process in between the hidden layer and output layer using forward propagation algorithm.

Findings & Results

Implemented system basically predicts the open, close, high and low prices for the next trade. By using those parameters, it finds which type of order should be made. Depending on the type of order it calculates the take profit limits and stop loss limits accordingly. System provides a model with the state after the most recent training phase for the deployment in the prediction phase. System predictions over the test data had significant losses over the trained data predictions. Basically, system did not perform well for unseen data. This is called the overfitting of the model. To minimize overfitting regularization functions has been applied to the model. This system uses checkpoints while it is being trained. It provides the capability of restoring the model with the its best states gained through the last training phase. Best model saved during the training, before the failure can be deployed for further training or prediction deployment.

Fig. 6. depicts the actual and predicted close price actions over day time frame. Model’s accuracy and loss for close price actions are respectively 80% and 3.84. Mean average error and mean squared error for the 20% of test data were recorded as 0.0047 and 2.73 respectively.

stock-forex-trading

Figure 6: Close price actions predictions/actual

Fig. 7. represents the actual and predicted high price actions over day time frame. Model’s accuracy and loss for close price actions are respectively 75% and 5.38. Mean average error and mean squared error for the 20% of test data were recorded as 0.0041 and 3.17 respectively.

stock-forex-trading

Figure 7: High price action predictions/actual

Fig. 8. depicts the actual and predicted low price actions over day time frame. Model’s accuracy and loss for close price actions are respectively 75% and 3.77. Mean average error and mean squared error for the 20% of test data were recorded as 0.0058 and 4.26 respectively.

stock-forex-trading

Figure 8: Low price action predictions/actual

Fig 9. depicts the actual and predicted open price actions over day time frame. Model’s accuracy and loss for close price actions are respectively 70% and 4.19. Mean average error and mean squared error for the 20% of test data were recorded as 0.0062 and 6.58 respectively.

stock-forex-trading

Figure 9: Open price actions predictions/actual

Conclusion & Future Work

Intention of this research paper is to discuss and propose an intelligent currency rates prediction system which simplifies the trading to the non-technical users in terms of the type of the order, take profit limits and stop loss limits. It basically uses the Relative strength index to confirm the trend or forming trend. Further the implemented system introduces a fault tolerance mechanism to restore the model’s state in case of system failure during the training or prediction deployment.

This system performs well than the existing solutions since it is integrated with the machine learning capabilities with statistical methods for the prediction. Time lag of the RSI indicator is reduced by applying the future currency rates to calculate the new RSI value. It gives the most accurate state of the current market without a delay.

Used algorithms should be optimized in order to improve its accuracy up to 5 decimal points precision which will be best fitted in the actual trading environments. This system should be enhanced by considering the effect of economic news releases and in terms of providing a consistent model accuracy after the most recent training phase with the intentions of making reliable forecasting systems.

References

Author Info

Sarala Sewwandi Kumarage*
 
Department of Information Technology, Sri Lanka Institute of Information Technology Malabe, Sri Lanka
 

Citation: Kumarage SS (2020) Forerunne Fault Tolerant Intelligent Indicator Based Forex Forecasting System. J Stock Forex 9: p326

Received: 15-Jun-2020, Manuscript No. JSFT-20-4925; Editor assigned: 18-Jun-2020, Pre QC No. JSFT-20-4925; Reviewed: 02-Jul-2020, QC No. JSFT-20-4925; Revised: 24-Mar-2023, Manuscript No. JSFT-20-4925; Published: 30-Mar-2023 , DOI: 10.4172/2168-9458.23.10.230

Copyright: © 2021 Kumarage SS. This is an open-access article distributed under the terms of the Creative Commons Attribution License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original author and source are credited.

Top