p2 - Stock Market Prediction System A Wavelet Based
p2 - Stock Market Prediction System A Wavelet Based
p2 - Stock Market Prediction System A Wavelet Based
http://dx.doi.org/10.18576/amis/120312
Abstract: This work concentrates on computational approach for predicting the interval (number of trading days), a significant feature
of stock market analysis using Haar Wavelet. A distinct model is proposed for predicting the high value of returns. The prime objective
is to understand the trends using Haar wavelet and use this information to determine the interval for future direction. This model used
85 securities closing price and validated 4355 trading days. The results reported at 200 recent trading days with an average accuracy of
45.88% on 85 securities over a period of 15 years.
Keywords: Haar wavelet, National Stock Exchange (NSE),Stock Market Prediction, Wavelet Transform (WT).
1 Introduction can become more crucial for the recent stock market
changes and increases the need for financial care of
The objective of this work is to capture trends and stock-market. The stock market usually improve
similarities in order to help investors understand the economical well-being of people. The financial market
current trading scenario, aiming the test of system typically generates large amount of fluctuating
data, which might be analyzed for developing a better
hypothesis,‘whether trading intervals have any significant
impact on stock market data’. Studies suggest that, the decision support system. To make a cutting edge on stock
stock analysis is still evolving, and these exist an market, the hidden information in stock-market data is
considered, which is largely untapped and to be identified.
opportunity for developing new evaluation technique and
use of various data mining methods, which involves Financial data including numbers and charts must be
interval based analysis to make inference about the analyzed for effective trading decisions, further assessing
current market. Wavelet function is increasingly applied the feasibility of stock market data analysis using wavelet
and specifically predicting the stock data based on trading
to these stock data sets because it permit experts to focus
on time scale where the trading patterns would be intervals. This work introduces wavelets as a technique
important. Wavelets can be very much useful for for stock prediction, the development and characterization
distinguish trading patterns from other price movements. of a method to assess repetitive stock patterns for
detecting basic stock characteristics from NSE data set.
This work presents an interval based stock market
analysis using Haar wavelet in NSE data set which can
identify significant informative financial characteristics.
This method can be opted as an alternative to analyze
financial data which involves the effective use of stock This paper first survey on the related work, introduce
market data and assist investors to make better decisions wavelets and describe the main stock market
based on intervals. characteristics. We then detail the stock processing
Since lesser models are present to predict the state of required to detect basic characteristics in stock market
stock market based on trading intervals, the efficient data and describe the extracted features and elaborate on
diagnosis of current stock market and its relationship with the experiment. Finally, discuss the results with future
various financial trades will be available. These models work.
∗ Corresponding author e-mail: [email protected]
c 2018 NSP
Natural Sciences Publishing Cor.
580 S. Saravanan, S. Mala: Stock market prediction system: a wavelet based...
c 2018 NSP
Natural Sciences Publishing Cor.
Appl. Math. Inf. Sci. 12, No. 3, 579-585 (2018) / www.naturalspublishing.com/Journals.asp 581
hold the shares. This work attempts to design simple 3.3 Daily Returns From Closing Price
wavelet-based model for stock prediction in the future in
terms of interval based on trading days. Issues in data The input to processing chain is the closing price of stock
preprocessing technique, architectural design, wavelet market historical data for a particular security. In the first
selection and performance measures have been stage, the rate of returns from closing price are calculated
considered carefully. The methods were all implemented by the following formula depicted in (1). Returns from
off-line using MATLAB. The framework for stock Closing price quotes the ith return of an asset from the
prediction is illustrated in Fig. 1. The daily returns period T(i)to T(i+1) and normalizes it with time interval,
calculated from closing price are the significant input for which is 1 between successive price observations.
this processing chain. Firstly, the noise from returns are
removed by using Haar wavelet. The denoised-returns are
given as input to the next stage, where intervals for times(i + 1)
Return(i) = log (1)
positive stock market prediction is calculated using Haar (times(i + 1) − times(i))
wavelet. The results are further evaluated using confusion
matrix. The sample returns calculated using MATLAB for
NSE RCF security from March 1998 to June 2016 is
shown in Fig. 2.
Close Price
100
50
0
0 500 1000 1500 2000 2500 3000 3500 4000 4500 5000
Trading Days
Return NSE-RCF
0.4
Close Price returns
0.2
-0.2
-0.4
0 500 1000 1500 2000 2500 3000 3500 4000 4500 5000
Trading Days
c 2018 NSP
Natural Sciences Publishing Cor.
582 S. Saravanan, S. Mala: Stock market prediction system: a wavelet based...
0.15
mother wavelet. The wavelet coefficient Csp (R), at scale s
0.1
and position p, is defined as in (2).
Daily Returns
0.05
1 (t − p)
Z
R(t) p φ
-0.05
Csp (R) = dt. (2)
-0.1
(s) s
-0.15
-0.2
0 500 1000 1500 2000
Day
2500 3000 3500 4000
By application of specific threshold th pd on the
coefficients Csp = C10
p (R), CWT-PD creates a vector T
with elements Ti as in (3).
Fig. 3: NSE RCF: Raw Signal and Reconstructed Signal
1, ∀i : Ci (R) > th pd
Ti = (3)
0, otherwise.
The PSNR and MSE for 85 different securities are
analyzed before the detection of basic stock price This step divides returns into profit and non-profit
characteristics (profit/loss) analysis.The results obtained segments. Profit segments greater than the threshold are
for these securities shows the current trading intervals considered. CWT PD checks the return direction of each
playing the significant role in stock market prediction. 39 segment. The direction is derived from the sign of
out of 85 securities show the impact of current 200 corresponding element in T. The Fig. 5 illustrates raw
trading days. Fig. 4 list the highest values of returns (R) and Profit segments with application specific
PSNR(encircled) for 2 different sample securities. threshold 0.05.
c 2018 NSP
Natural Sciences Publishing Cor.
Appl. Math. Inf. Sci. 12, No. 3, 579-585 (2018) / www.naturalspublishing.com/Journals.asp 583
Table 2: Various security features with average intervals. Table 3: Confusion matrix(Actual Vs Calculated Results).
Security PSNR MSE Data Interval AvgPeakDist Actual Results TRUE FALSE TOTAL
1 81.476 0.000463 1-1400 42 Positive 1066(TP) 1134 (FP) 2200
2 77.504 0.001155 1-400 32 Negative 1071(TN) 1085(FN) 2156
3 83.937 0.000263 1-400 55 2137 2219
4 79.928 0.000661 1-200 23 Total (TP+FP+TN+FN) 4356
5 81.978 0.000412 1-200 49 Correct Predictions (TP+FN) 2151
6 80.221 0.000618 1-1600 26 Accuracy ((TP+FN)/Total) 49.38
7 84.013 0.000258 1-200 183
8 81.185 0.000495 1-1200 48
9 80.308 0.000606 1-2400 31 Table 4: Evaluation Results.
1 NumberOfObservations: 4356
2 ControlClasses: 2
3 CorrectRate: Accuracy 0.4938
4 ErrorRate: 0.5062
5 Sensitivity: 0.48455
6 Specificity: 0.50325
7 PositivePredictiveValue: 0.49883
8 NegativePredictiveValue: 0.48896
Peak Marker Vector for NSE RCF Returns (th=0.05) (Average Peak Distance =44)
Returns
0.1 Recons Haar Returns
peak Marker-vector
0.05
0
NSE RCF Returns
-0.1
c 2018 NSP
Natural Sciences Publishing Cor.
584 S. Saravanan, S. Mala: Stock market prediction system: a wavelet based...
investors understand, the current trading scenario. Aiming [5] S. Skander, On the Use of the Wavelet Decomposition for
the test of hypothesis,‘whether trading intervals have any Time Series Prediction, Neurocomputing, Vol. 48(1-4),pp
significant impact on stock market data’. Considering the 267-277 (2002).
hypothesis that these would be an impact of trading [6] Y. Motohiro, Measure Business Cycle: A Wavelet Analysis of
intervals with respect to returns for desirable investments Economic Time Series, Economics Letter, vol. 100, pp. 208-
and profitability. The developed algorithm for detecting 212 (2008).
[7] Tian-Xiao He, Wavelet Analysis and Applications in
profit using trading intervals in stock market data has
Economics and Finance, Research & Reviews, Journal of
been proved achieving the accuracy of 49.38% for
Statistics and Mathematical Sciences, Vol. 1, no. 1, pp 22-37
NSE RCF data set. The experimental evaluation shows (2015).
sensitivity 48.45% and specificity 50.32% for NSE RCF [8] Ramsey,J. B., Usikov, D. and Zaslavsky, G. M, An Analysis
data set. The Interval analysis shows the number of of U. S. Stock Price Behavior Using Wavelets, Fractals, vol.
trading days for various securities have significant impact 3,no. 2, pp 377-389 (1995).
on stock market data. [9] Ramsey, J. B., and Semmler, W, Interest Rate Spreads
and Output: A Time Scale Decomposition Analysis Using
Wavelets, Computational Statistics and Data Analysis, Vol.
4 Conclusion 76, no. 2, pp 282-290 (2014).
[10] Lee, H. S, International Transmission of Stock Market
Application of Haar wavelet on stock market data was Movements: A Wavelet Analysis, Applied Economics
effectively implemented. The result indicates the Letters, Vol. 11, no. 3, pp. 197-201 (2004).
important relationship between stock market prediction [11] James. B. Ramsey, Wavelets in Economics and Finance:
and trading intervals which was one of the main Past and Future, Studies in Nonlinear Dynamics &
Econometrics, Vol. 6, no. 3, pp. 1-29 (2002).
objectives of this work. With increased frequency of stock
[12] Fernandez, V, The International CAPM and a Wavelet-
market data set we expect further testing on effectiveness Based Decomposition of Value at Risk, Studies in Nonlinear
of proposed work. We would like to extend our work Dynamics & Econometrics, Vol.9, no. 4, pp. 1-37 (2005).
further for on-line stock analysis. Trading intervals have [13] Maslova, I., Onder, H. and Sanghi, A, Growth and Volatility
provided new insight into stock market problem. The Analysis Using Wavelets, Policy Research Working Paper
most important idea of this work is the feasibility of stock 6578, The World Bank, (2014).
market prediction by trading intervals using wavelet. We [14] Kim, S. and In, F. H, The Relationship Between Stock
have used only a selected number of stock market data for Returns and Inflation: New Evidence from Wavelet Analysis,
the experimental scenario which can be considered Journal of Empirical Finance, Vol. 12, no. 3, pp. 435-444
further to on-line stock. (2005).
[15] Kim and In, F. H, The Relationship Between Financial
Variables and Real Economic Activity: Evidence From
Acknowledgement Spectral and Wavelet Analyses, Studies in Nonlinear
Dynamics & Econometrics, Vol. 7, no. 4, pp. 1-18 (2003).
[16] Wong, H., Ip, W., Xie, Z. and Lui, X, Modelling and
The authors are grateful to the anonymous referee for a
Forecasting by Wavelets, and the Application to Exchange
careful checking of the details and for helpful comments
Rates, Journal of Applied Statistics, Vol. 30, no. 5, pp. 537-
that improved this paper. 553 (2003).
[17] Arino, M. A., Morettin, P. A. and Vidakovic, B, Wavelet
Scalograms and Their Applications in Economic Time Series,
References Brazilian Journal of Probability and Statistics, Vol. 18, pp.37-
51 (2004).
[1] Seung-Min Park, Tae-Ju Lee and Kwee-Bo Sim, Heuristic [18] Yousefi, S., Weinreich, I. and Reinarz, D, Wavelet-Based
Feature Extraction Method for BCI with Harmony Search and Prediction of Oil Prices, Chaos, Solitons & Fractals, Vol. 25,
DiscreteWavelet Transform, International Journal of Control, no. 2, pp. 265-275 (2005).
Automation, and Systems, vol. 14, no. 6, pp. 1582-1587 [19] Lai, W. , Wavelet Theory and Its Applications in Economics
(2016). and Finance, PhD Thesis., University of Leicester, (2015).
[2] T. Sivalakshmi and G. Sreenivasulu, Comparative Analysis of [20] Hung-Yi Chen and Jin-Wei Liang, Adaptive Wavelet Neural
Different Wavelets for EEG Signal Denoising, International Network Controller for Active Suppression Control of a
Journal of Innovative Research in Science,Engineering and Diaphragm-Type Pneumatic Vibration Isolator, International
Technology, Vol. 6, No. 1,pp. 594-599 (2017). Journal of Control, Automation, and Systems, Vol. 15, no. 3,
[3] S. Mala and K. Latha, Electrooculography de-noising: pp. 1456-1465 (2017).
wavelet based approach to reduce noise, International Journal [21] Masset p, Analysis of Financial Time-Series Using Fourier
of Advanced Engineering Technology, Vol. 7,No. 2,pp. 482- and Wavelet Methods, University of Fribourg (Switzerland)-
487 (2016). Faculty of Economics and Social Science, (2008).
[4] Ramsey,J. B., and Anderson, H. M., U.S. and Canadian [22] Jothimani, D., Shankar, R and Yadav, S.S, Discrete Wavelet
industrial production indices as coupled oscillators, Journal Transform-Based Prediction of Stock Index: A Study on
of Economic Dynamics and Control, Vol. 26, pp. 33-67 National Stock Exchange Fifty Index, Journal of Financial
(2002). Management and Analysis, Vol. 28, no. 2, pp. 35-49 (2015).
c 2018 NSP
Natural Sciences Publishing Cor.
Appl. Math. Inf. Sci. 12, No. 3, 579-585 (2018) / www.naturalspublishing.com/Journals.asp 585
c 2018 NSP
Natural Sciences Publishing Cor.