FOREX TRADING PREDICTION USING LINEAR REGRESSION LINE, ARTIFICIAL NEURAL NETWORK AND DYNAMIC TIME WARPING ALGORITHMS



Similar documents
FINANCIAL TIME SERIES PREDICTION USING MACHINE LEARNING ALGORITHMS LESLIE TIONG CHING OW

Stock Price Prediction Model using Candlestick Pattern Feature

An Introduction to Data Mining

A New Approach to Neural Network based Stock Trading Strategy

2. IMPLEMENTATION. International Journal of Computer Applications ( ) Volume 70 No.18, May 2013

Data quality in Accounting Information Systems

Machine learning for algo trading

Prediction of Stock Performance Using Analytical Techniques

A Regression Approach for Forecasting Vendor Revenue in Telecommunication Industries

How To Predict Web Site Visits

Computational Neural Network for Global Stock Indexes Prediction

Pattern Recognition and Prediction in Equity Market

Online Farsi Handwritten Character Recognition Using Hidden Markov Model

APPLICATION OF ARTIFICIAL NEURAL NETWORKS USING HIJRI LUNAR TRANSACTION AS EXTRACTED VARIABLES TO PREDICT STOCK TREND DIRECTION

Designing a Decision Support System Model for Stock Investment Strategy

Neural Network Applications in Stock Market Predictions - A Methodology Analysis

Stock Market Forecasting Using Machine Learning Algorithms

Data Mining Applications in Higher Education

Fuzzy Candlestick Approach to Trade S&P CNX NIFTY 50 Index using Engulfing Patterns

PDF hosted at the Radboud Repository of the Radboud University Nijmegen

Machine Learning: Overview

Rule based Classification of BSE Stock Data with Data Mining

Feature Subset Selection in Spam Detection

NEURAL networks [5] are universal approximators [6]. It

Advanced Ensemble Strategies for Polynomial Models

Neural Networks for Sentiment Detection in Financial Text

Forecasting Stock Prices using a Weightless Neural Network. Nontokozo Mpofu

Comparative Analysis of EM Clustering Algorithm and Density Based Clustering Algorithm Using WEKA tool.

A STUDY ON DATA MINING INVESTIGATING ITS METHODS, APPROACHES AND APPLICATIONS

Azure Machine Learning, SQL Data Mining and R

An Introduction to Data Mining. Big Data World. Related Fields and Disciplines. What is Data Mining? 2/12/2015

Machine Learning Techniques for Stock Prediction. Vatsal H. Shah

Adaptive Demand-Forecasting Approach based on Principal Components Time-series an application of data-mining technique to detection of market movement

Data Mining Solutions for the Business Environment

Title. Introduction to Data Mining. Dr Arulsivanathan Naidoo Statistics South Africa. OECD Conference Cape Town 8-10 December 2010.

EFFICIENCY OF DECISION TREES IN PREDICTING STUDENT S ACADEMIC PERFORMANCE

Time Series Data Mining in Rainfall Forecasting Using Artificial Neural Network

Machine Learning in FX Carry Basket Prediction

Using Data Mining for Mobile Communication Clustering and Characterization

Advanced analytics at your hands

Sales Forecast for Pickup Truck Parts:

Practical Data Science with Azure Machine Learning, SQL Data Mining, and R

Learning is a very general term denoting the way in which agents:

Knowledge Based Descriptive Neural Networks

SPECIAL PERTURBATIONS UNCORRELATED TRACK PROCESSING

Price Prediction of Share Market using Artificial Neural Network (ANN)

Planning Workforce Management for Bank Operation Centers with Neural Networks

Machine Learning with MATLAB David Willingham Application Engineer

Financial Trading System using Combination of Textual and Numerical Data

High Frequency Trading using Fuzzy Momentum Analysis

International Journal of Computer Science Trends and Technology (IJCST) Volume 2 Issue 3, May-Jun 2014

Chapter 12 Discovering New Knowledge Data Mining

Forecasting of Indian Rupee (INR) / US Dollar (USD) Currency Exchange Rate Using Artificial Neural Network

Network Machine Learning Research Group. Intended status: Informational October 19, 2015 Expires: April 21, 2016

Machine Learning. Chapter 18, 21. Some material adopted from notes by Chuck Dyer

Gerard Mc Nulty Systems Optimisation Ltd BA.,B.A.I.,C.Eng.,F.I.E.I

Trading Strategies based on Pattern Recognition in Stock Futures Market using Dynamic Time Warping Algorithm

Review on Financial Forecasting using Neural Network and Data Mining Technique

An Evaluation of Neural Networks Approaches used for Software Effort Estimation

Chapter 6. The stacking ensemble approach

Due to the development of financial. Performance of Stock Market Prediction. Lai, Ping-fu (Brian) Wong Chung Hang

JetBlue Airways Stock Price Analysis and Prediction

Event driven trading new studies on innovative way. of trading in Forex market. Michał Osmoła INIME live 23 February 2016

A Comparative Study of the Pickup Method and its Variations Using a Simulated Hotel Reservation Data

Predictive time series analysis of stock prices using neural network classifier

DATA MINING TECHNIQUES AND APPLICATIONS

COPYRIGHTED MATERIAL. Contents. List of Figures. Acknowledgments

Efficient Artificial Neural Network based Practical Approach of Stock Market Forecasting

Data Mining. Dr. Saed Sayad. University of Toronto

Machine Learning Introduction

Trading Strategies and the Cat Tournament Protocol

Efficient on-line Signature Verification System

PERFORMANCE ANALYSIS OF HYBRID FORECASTING MODEL IN STOCK MARKET FORECASTING

Predictive Dynamix Inc

Chapter 4: Artificial Neural Networks

DESIGN OF DIGITAL SIGNATURE VERIFICATION ALGORITHM USING RELATIVE SLOPE METHOD

Machine Learning and Statistics: What s the Connection?

not possible or was possible at a high cost for collecting the data.

USING MACHINE LEARNING ALGORITHMS TO ANALYZE CRIME DATA

Software project cost estimation using AI techniques

Learning Example. Machine learning and our focus. Another Example. An example: data (loan application) The data and the goal

Neural Networks and Wavelet De-Noising for Stock Trading and Prediction

Introduction to Machine Learning Using Python. Vikram Kamath

Web Document Clustering

SINGULAR SPECTRUM ANALYSIS HYBRID FORECASTING METHODS WITH APPLICATION TO AIR TRANSPORT DEMAND

DEA implementation and clustering analysis using the K-Means algorithm

Keywords image processing, signature verification, false acceptance rate, false rejection rate, forgeries, feature vectors, support vector machines.

Data Mining Techniques

Real Stock Trading Using Soft Computing Models

MERGING BUSINESS KPIs WITH PREDICTIVE MODEL KPIs FOR BINARY CLASSIFICATION MODEL SELECTION

DECISION TREE INDUCTION FOR FINANCIAL FRAUD DETECTION USING ENSEMBLE LEARNING TECHNIQUES

Prediction Models for a Smart Home based Health Care System

A Proposed Prediction Model for Forecasting the Financial Market Value According to Diversity in Factor

DATA MINING TECHNOLOGY. Keywords: data mining, data warehouse, knowledge discovery, OLAP, OLAM.

Corporate Financial Evaluation and Bankruptcy Prediction Implementing Artificial Intelligence Methods

Neuro-Rough Trading Rules for Mining Kuala Lumpur Composite Index

An Efficient Approach to Forecast Indian Stock Market Price and their Performance Analysis

Data Warehousing and Data Mining for improvement of Customs Administration in India. Lessons learnt overseas for implementation in India

A Wavelet Based Prediction Method for Time Series

ARTIFICIAL INTELLIGENCE METHODS IN STOCK INDEX PREDICTION WITH THE USE OF NEWSPAPER ARTICLES

Transcription:

FOREX TRADING PREDICTION USING LINEAR REGRESSION LINE, ARTIFICIAL NEURAL NETWORK AND DYNAMIC TIME WARPING ALGORITHMS Leslie C.O. Tiong 1, David C.L. Ngo 2, and Yunli Lee 3 1 Sunway University, Malaysia, 10008027@imail.sunway.edu.my 2 Sunway University, Malaysia, dngo@sunway.edu.my 3 Sunway University, Malaysia, yunlil@sunway.edu.my ABSTRACT. Forex prediction has become a challenging task in the Forex market since the late 1970s due to uncertainty movement of exchange rates. In this paper, we utilised linear regression equation to analyse the historical data and discover the trends patterns in Forex. These trends patterns are modeled and learned by Artificial Neural Network algorithm, and Dynamic Time Warping algorithm is used to predict the near future trends. Our experiment result shows a satisfactory result using the proposed approach. INTRODUCTION Keywords: Forex Trading Prediction; Forex Trend Patterns; Artificial Neural Network; Linear Regression Line; Dynamic Time Warping In the past decade, many investors were worried that their investments may not profit due to factors such as erroneous prediction, information and estimation of time. Therefore, the request has been made for prediction techniques to get better odds of profit from investments. The price in any exchange never represents the fair value in financial market due to variations in supply and demand from investors. Thus, Forex and stock prediction has become a challenging task to the Artificial Intelligence (AI) community. Generally, the most common issue in Forex and stock prediction is that most investors are usually unaware of the behaviour and patterns of price within historical data. Since the late 1970s, researchers from the financial sector have used technical analysis methods to analyse trends for prediction (Dzikevičius & Šaranda, 2010; Maknickienė & Maknickas, 2012; Tanaka-Yamawaki & Tokuoka, 2007). However, the implementation of trends patterns as a prediction factor is suggested for improving the existing prediction result. This leads to observe the potential of historical data that discovered a unique cluster of trends patterns. Due to the rapid growth of computing technology, AI techniques such as Artificial Neural Network (ANN), Expert Systems (ES), Hidden Markov Model (HMM) and Genetic Algorithms (GA) have been applied as classifiers in financial market to learn and predict the prices by researchers from computer science sector. These AI techniques have yielded good results over technical analysis methods, and proved that these techniques have a better approach in learning patterns and behaviours of prices for prediction (Gupta & Dhingra, 2012; Hassan, Nath, & Kirley, 2007; Lee & Jo, 1999; Yao & Tan, 2000). Based on the history of previous experiments done in the literature, Forex and stock prediction models are still an active topic for development and improvement. This paper proposes a prediction model using machine learning algorithm ANN, supported by 71

Dynamic Time Warping (DTW) algorithm and Linear Regression Line (LRL). The proposed method is to improve the existing prediction models. In this approach, LRL is utilised to analyse the trends patterns and formed general patterns of Forex trends. Then, trends patterns models are implemented by using ANN algorithm. For predicting the future trends, DTW is used to measure the similarity based on the train models. BACKGROUND AND RELATED WORK Linear Regression Line (LRL) LRL is a statistical tool that uses the slopes value of regression to identify the distance between the prices of timeline and the trend line. Slopes can be used to identify trends; a positive slope is defined as an uptrend whilst a negative slope is defined as a downtrend (Barbara Rockefeller, 2011). The following equation defines a straight line to describe the trend: y mx b (3) where y closing price, m slope, x the number of time frame and b y intercept. Figure 1 shows Eq. (1) to identify the trend. 1.06 1.05 1.04 1.03 Figure 1. The Concept of LRL According to Rinehart s experiment, he utilized regression trend channel (RTC) technique that includes linear regression line, the upper trend line channel and the lower trend line channel to analyse the stock trend for recognising the trend patterns (Rinehart, 2003). Another experiment which was conducted by Olaniyi, Adewole & Jimoh used linear regression line to generate new knowledge from historical data, and identified the patterns that describe the stock trend (Olaniyi, Adewole, & Jimoh, 2011). Both results concluded that LRL was able to identify the pattern of trend for prediction. Artificial Neural Network (ANN) Algorithm ANN is a field of computational science that have different methods which try to solve problems in real world by offering strong solutions. ANN has the ability to learn and generate its own knowledge from the surroundings (Alvarez, 2006). But sometimes the model can be intimately associated with a particular learning algorithm or learning rule. Generally, ANN is acts as a black box that able to classify an output pattern when it recognizes a given input pattern. Basically, ANN will learn and train based on the input values features and classify the outcome values appropriately. According to Kamijo and Tanigawa, they had found that the ANN algorithm is able to identify and recognise candlestick patterns in the learning and training stage (Kamijo & Tanigawa, 1990). Other experiments were done by Charkha, Yao & Tan, Tiong, Ngo & Lee 72

and Maknickienė & Maknickas, which have shown significant results through implementing the ANN, and proved that, ANN is more consistent in recognising the patterns of stock price and Forex exchange rates (Charkha, 2008; Maknickienė & Maknickas, 2012; Tiong, Ngo, & Lee, 2012). Along with the experiment done by Lawerence, he utilised the technical analysis method EMH (Efficient Market Hypothesis) as a source feature for ANN to test for stock price, and found that the features of stock trend must be fully understood so that ANN will learn the correct pattern for prediction (Lawrence, 1997). Dynamic Time Warping (DTW) Algorithm In 1983, Joseph Kruskal and Mark Liberman introduced a new technique time warping to compare and calculate the distance of curves. DTW is a time-series alignment algorithm for measuring two sequences of vector values by warping the distance until an optimal match between the sequences. Formerly, DTW has been successfully implemented in speech recognition, handwriting recognition and data mining fields in order to compare different patterns (Niels, 2004). Figure 2. The Concept of Dynamic Time Warping Figure 2 illustrates the idea and concept of DTW algorithm. Figure 2 (a) and (b) shows the examples Pattern 1 and Pattern 2 and utilised DTW to find the matching path. To calculate the warping path, DTW firstly initialises the matrix table and calculates the accumulated cost matrix by using a distance function (Albrecht & Muller, 2009). From the matrix table Figure 2 (c), it showed the result of warping path between both patterns and proves that the patterns are matched. EXPERIMENT AND RESULT Data Analysis Stage In our experiment, we have selected the historical data of Currency Exchange AUD USD and EUR - USD from the beginning of 2012 until the end of 2012 in Free Forex Historical Data website. Figure 3 showed the structure of data analysis stage. Historical Data Features Selection Patterns Analysis Clustering Segmentation Figure 3. Structure of Data Analysis Stage In this stage, linear regression line was implemented to analyse the dataset, representing the trend in the form of a pattern. Eq. (1) has been applied to derive a straight line through the 73

exchange rates of different time frames to identify the overall trend. To identify the trend, the model will utilise certain rules to segment the trend, fitting the two archetypes shown in Figure 4 and store the values of the resultant trend vector. After the segmentation, K-Mean clustering algorithm had been applied to cluster the trend patterns into two main clusters - Uptrend and Downtrend. We utilised the selected features which are shown in Table 1 to represent the patterns of trends for clustering. To identify the different types of Uptrend and Downtrend patterns showed in Figure 5 and 6, we used certain rules and conditions to cluster them. Uptrend Pattern Downtrend Pattern Figure 4. Example of Trend Patterns Normal Pattern Skew Left Pattern Skew Right Pattern Normal Pattern Skew Left Pattern Skew Right Pattern Figure 5. Different Types of Downtrend Patterns Figure 4. Different Types of Uptrend Patterns Table 6. Details of Selection Features Attributes Feature_1 Description Distance between starting point to highest/lowest point. Feature_2 Distance between highest/lowest points to changing point 1. Feature_3 The area between starting point to changing point 1 Feature_4 Feature_5 Feature_6 Feature_7 Distance between changing point 2 to highest/lowest point. Distance between highest/lowest points to ending point. The area between changing point 2 and end point. The Length of the Pattern. 74

Learning and Training Stage Since the previous stage had successfully analysed the exchange rates trend patterns, we utilised ANN algorithm as classifier to learn and train with the trend patterns. Figure 7 showed the structure of learning and training stage. To determine two main clusters - Uptrend and Downtrend, we implemented ANN algorithm Multi-layer Perceptron from WEKA open source library to learn and train for the trend patterns. In our experiment, we had split the dataset into a training set and testing set, in a 7:3 ratio. In each of these clusters, we also applied ANN algorithm to learn different types of Normal, Skew Left and Skew Right patterns. From the results of ANN classification which shown in Table 1 and 2, we used Mean Absolute Error (MAE) and Root Mean Square Error (RMSE) to prove that our ANN model can classify the patterns with the selected features. In the experiments, we have selected the historical partial data of Currency Exchange AUD USD and EUR - USD from the beginning of January 2013 until the end of March 2013 as unknown patterns. To predict the future exchange rate trends, we had utilized the ANN model to classify the unknown patterns belong to the specific group, and used DTW algorithm to find the matching path between the patterns. The accuracy of prediction shown Implemented patterns of trend ANN to learn and test the trends patterns ANN to learn and test different types of patterns in each uptrends and downtrends group Implemented DTW algorithm to predict the trends Evaluate the unknown patterns with our ANN model for classification. Figure 5. Structure of Learning and Training Stage in Table 4 had successfully warped the similarity across the patterns to predict the trends. Table 7. Result of ANN Model for classifying Uptrend and Downtrend patterns Data Number of Dataset Result Training Testing MAE RMSE AUD USD 2012 139 60 0.005 0.0054 EUR USD 2012 134 58 0.0048 0.005 Table 8. Result of ANN Model for classifying different types of patterns in each group Data AUD USD 2012 EUR USD 2012 Result Trend Group MAE RMSE Uptrend 0.0454 0.1939 Downtrend 0.081 0.2501 Uptrend 0.013 0.0614 Downtrend 0.0642 0.2283 75

Table 9. DTW algorithm Prediction Experiment Dataset Accuracy Rate 1 AUD USD 2013 (Jan March) 70% 2 EUR USD 2013 (Jan March) 72% CONCLUSION The analysis method LRL that we proposed in this paper successfully analysed the trend from historical Forex data. Our experiment had shown that ANN model can classify the patterns of uptrend and downtrend, and stored the values of the resultant trend vector for DTW algorithm to predict the future exchange rates trends. In addition to this study, the selected features we used in analysis stage are very important due to the non-stationary raw data for ANN model to learn and train the trends patterns. REFERENCES Albrecht, T., & Muller, M. (2009). Dynamic Time Warping (DTW). Information Retreival for Music and Motion (pp. 70 83). doi:10.1007/978-0-387-73003-5_768 Alvarez, E. G. (2006). Artificial neural networks, 1 48. Barbara Rockefeller. (2011). Drawing Trendlines. Technical Analysis For Dummies (2nd ed., pp. 169 182). Indianapolis: Wiley Publishin, Inc. Charkha, P. R. (2008). Stock Price Prediction and Trend Prediction Using Neural Networks. First International Conference on Emerging Trends in Engineering and Technology (pp. 592 594). Ieee. doi:10.1109/icetet.2008.223 Dzikevičius, A., & Šaranda, S. (2010). EMA versus SMA Usage to Forecast Stock Markets: The Case of S#38;P 500 and OMX Baltic Benchmark. Business: Theory and Practice, 11(3), 248 255. doi:10.3846/btp.2010.27 Gupta, A., & Dhingra, B. (2012). Stock Market Prediction Using Hidden Markov Models. IEEE. Hassan, M. R., Nath, B., & Kirley, M. (2007). A fusion model of HMM, ANN and GA for stock market forecasting. Expert Systems with Applications, 33(1), 171 180. doi:10.1016/j.eswa.2006.04.007 Kamijo, K., & Tanigawa, T. (1990). Stock price pattern recognition-a recurrent neural network approach. 1990 IJCNN International Joint Conference on Neural Networks, 1(1), 215 221. doi:10.1109/ijcnn.1990.137572 Lawrence, R. (1997). Using Neural Networks to Forecast Stock Market Prices (pp. 1 21). Lee, K. H., & Jo, G. S. (1999). Expert system for predicting stock market timing using a candlestick chart. Expert Systems with Applications, 16(4), 357 364. doi:10.1016/s0957-4174(99)00011-1 Maknickienė, N., & Maknickas, A. (2012). Application of Neural Network for Forecasting of Exchange Rates and Forex Trading. The 7th International Scientific Conference Business and Management 2012. Selected papers (pp. 122 127). Vilnius, Lithuania: Vilnius Gediminas Technical University Publishing House Technika. doi:10.3846/bm.2012.017 Niels, R. (2004). Dynamic Time Warping: An intuitive way of handwriting recognition? Radboud University Nijmegen. 76

Olaniyi, S. A. S., Adewole, K. S., & Jimoh, R. G. (2011). Stock Trend Prediction Using Regression Analysis A Data Mining Approach. ARPN Journal of Systems and Software, 1(4), 154 157. Rinehart, M. (2003). Overview of Regression Trend Channel (RTC) (pp. 1 10). Tanaka-Yamawaki, M., & Tokuoka, S. (2007). Adaptive use of technical indicators for the prediction of intra-day stock prices. Physica A: Statistical Mechanics and its Applications, 383(1), 125 133. doi:10.1016/j.physa.2007.04.126 Tiong, L. C.., Ngo, D. C.., & Lee, Y. (2012). Stock Price Prediction Model using Candlestick Pattern Feature. ICIDM 2012 Langkawi (pp. 394 401). Langkawi. Yao, J., & Tan, C. L. (2000). A case study on using neural networks to perform technical forecasting of forex. Neurocomputing, 34(1-4), 79 98. doi:10.1016/s5-2312(00)00300-3 77