Introduction

Stock value forecast has a vast interest amongst managers, shareholders and experts due to its significance in present age financial trends. The stock market forecast is considered as a complicated and an ambivalent problem due to the many multifarious features prevailing in the stock market such as irregularities, instability, political influence, daily market trends and noise. The investors and traders, nonetheless rely on scientific analysis maneuvering historical or antiquated stock data and recent stock data. It is very difficult to estimate stock market based on daily recorded stock data.

To rectify this problem in past years, a multiple number of forecasting models for predicting stock market have been proposed. Many proposed models depend on soft computing techniques commonly named as Artificial Neural Network (ANN).

Researchers have explored a number of schemes for forecasting stock market developments along with profits. The outcome of the recommended neural network outshines normal feed forward neural network in forecasting market growths [1].

Interval estimate of stock prices camouflage the benefit of taking into consideration, inconsistency and decision in standardized particular valued stock. As authors of [2] emphasized, intermission predict of stock price are advanced to usual point prediction in terms of entire lesser mean error.

Researchers have proposed a specific PSO technique identified as Chaotic Multi Swarm PSO, where genetic PSO has been modified using chaotic succession for multi aspect unidentified factor assessment and optimization by combining several collaborating swarm. Advantage of the technique is that load matching can be augmented with allotting overall optimizing job for concurrently working swarms [3].

To deal with the probable over fitting of weights, some investigators have proposed hybridized techniques by combining different models. A hybrid scheme was proposed earlier, which integrated unseen Markov Model (HMM), Adaline Neural Network and GA to forecast value of three most important stocks [4, 5]. Outcome of this research work show that a day ahead, stock value might be aligned somewhere around 2% of genuine value, which reflects a considerable enhancement over further generic models.

Authors have also Artificial Neural Network have been successfully used in various predictions, classifications and medical diagnosis and many other purposes [6, 7].

In this paper we have proposed a fresh model consisting of Adaline network optimized by modified PSO to predict open price of stock. Ability of model to forecast stock price is revealed for two different most important stocks and result is compared with two other hybrid techniques. The experimental and simulation result shows that the Mean Absolute Percentage Error (MAPE) is less in the proposed technique as compared to other schemes. This prediction model is a potential technique for financial time series forecasting.

This paper is organized as follows: ‘Literature Survey' section describes the details of the literature in the related area, ‘Materials and Methods' section contains materials and methods like validation of datasets, ANN, modified PSO. A facet discussion about the proposed prediction model, work flow of the model along with the data set used to test the proposed model is carried out in ‘The Proposed Methodology for Prediction' section. The simulation and experimental result, condition of input selection, statistical and financial criteria, mean absolute percentage error and comparison with other existing models with proposed prediction model have been discussed in ‘Experimental Result' section. Finally, ‘Conclusion and Future Directions' section concludes this work.

Literature Survey

Prediction of stock market price has been proposed and designed by the researchers through a prediction model based on chaotic mapping, firefly algorithm and Support Vector Regression (SVR). The three staged forecasting model include a delay coordinate embedding method is used to reconstruct unseen phase space dynamics in the first stage. The second stage, a chaotic firefly algorithm is employs a chaotic firefly algorithm to optimize SVR hyper parameter. And the third stage uses the optimized SVR to forecast stock market price [8].

Zou et al. [9] proposed an enhanced similarity method and generative probabilistic prediction framework it first predicts a missing data probability value interval instead of a certain value by using the defined range of similar neighbors’ ratings and the final missing data rating is produced in the interval. Empirical studies on two datasets (MovieLens and Netflix).

The scheme unites Bayesian regularization through Levenberg–Marquardt process to anticipate stock price. The Bayesian ANN Experimental result of this representation specifies that this apparatus further diminishes the probability for over fitting and local minima that adversely plague the Neural Network method [10].

The researchers identified some procedural pointers to predict stock price developments by relying on progressive fractionally associated neural networks (EPCNNs). The Proposed model presented a few new features unlikely from the attributes of ANN like correlation among neurons is arbitrary, there can be more than one hidden layer evolutionary algorithm employed to develop the learning algorithm and training weights for enhancing the significant ability of neural networks within the historic time series data. The presentation of the projected EPCNN model, along with other schemes like BPN, TSK fuzzy system, multiple regression analysis and EPCNN is giving more speck and span result in comparisons with other models [11].

Interval forecasting of stock price is needed for taking investment decisions by providing a range of values. Analysts have used firefly algorithm and Multiple-output Support Vector Regression (MSVR) to forecast inter valued stock price by considering economic criteria for investors [12].

Researchers have used Morphological Rank Linear Forecasting (MRLF) model consisting of an able hybrid scheme composed of a morphological-rank-linear (MRL) filter combine with a customized Genetic Algorithm (MGA) that hunts down a minimum threshold time lag where the MGA population is enhanced using the Least Mean Squares (LMS) algorithm [13].

Researchers have proposed Multi Objective Particle Swarm Optimization (MOPSO) and Non-dominated Sorting Genetic Algorithm version-II (NSGA-II) to predict stock market. The model has been conditioned to be an adaptive model for stock market [14].

The hybrid intelligent model has been proposed to forecast future market price [15]. The model uses Adaptive Network-based Fuzzy Inference System (ANFIS) optimized by the quantum-behaved particle swarm optimization by the help of membership function.

Further the researcher’s proposed easy infinite impulse response (IIR) filter based Dynamic Neural Network (DNN) which was applied on different Indian stock data to predict stock price [16]. The interval forecasting model for stock value prophecy is one of the executable model optimized by firefly algorithm (FA-MVR) is an ideal one for statistical data time series dataset [17].

Fuzzy time series models were used to solve nonlinear and complexity obstacles. Nevertheless, utilizing artificial neural network with fuzzy logic relationship showcases more accurate prediction. The model also uses adaptive expectation to adjust forecasting accuracy during the defuzzification procedure [18].

Authors have also used self-adaptive fuzzy based optimized functional link artificial neural network for financial time series prediction [19], which provided better result as compared to other techniques. An optimization method was described based on genetic algorithm with fuzzy to forecast complex time series in Dow Jones data and also use optimization of neural network with type-1 and type-2 fuzzy response integration [20]. The result shows more accuracy for Dow Jones data using type-2 fuzzy.

A data mining process has been presented to predict the daily direction of the S&P 500 index [21]. The authors simplify the stock data using three reduction techniques including Principal Component Analysis (PCA), Fuzzy Robust Principal Component Analysis (FRPCA) and Kernel-based Principal Component Analysis (KPCA). Finally, the combination of ANN with PCA gives higher accuracy.

PSO trained with Quantile Regression Neural Network (PSOQRNN) used to forecast volatility from financial time series. The forecasting model is compared with different models like multi-layer perception (MLP), General Regression Neural Network (GRNN), and Random Forest (RF), Quantile Regression Random Forest (QRRF). The result shows that model PSOQRNN gives better accuracy in terms of MSE [22].

A prediction model using Rough Set (RS) and Wavelet Neural Network (WNN) were proposed earlier [23]. The RS is used to reduce the dimensions of stock data. The structure of WNN prediction model has been simplified significantly with improvement in performance. The prediction corresponding to SSE composite Index, CSI 300Index, all ordinaries Index, Nikkei 225 Index and Dow Jones Indexes are 65.75, 66.37, 65.97, 65.52 and 66.75% respectively. The authors show that obtained result are better than SVM and WNN.

Materials and Methods

Data Description

This data set consists of major stock shares like HDFC and JSPL from Jan 2012 to Dec 2014 as shown in Table 1. The data are numerical as shown and input attributes are High, Low, Close and Average Price which were used for prediction. The data set is time series data which will vary according to time. This data is normalized to make it uniform under certain range of positive value from 0 to 1 using the feature scaling method.

Table 1 Stock market data of HDFC and JSPL from Jan 2012 to Dec 2014

Data Validation (m-Fold Cross Validation)

In m-fold cross validation total dataset is split randomly into m mutually special folds of equal size, (Set1, Set2…Setm). To calculate the Cross Validation (CV) accuracy can be represented as

$${\text{Cross}}\;{\text{Validation (C}}_{v} ) = \frac{1}{m}(\varSigma A_{j} )$$
(1)

where, in Eq. (1), Ai is fold accuracy and m is the number of folds. The entire dataset is trained and tested m number of times. We used 5-fold cross validation procedure with 5 equal numbers of folds for entire dataset as shown in Table 1.

Particle Swarm Optimization (PSO)

In PSO each element flies throughout the multidimensional search gap and regulates its location in each step until it reaches an optimum solution. In this technique each particle has some fixed distance from the food source and the fitness value of each particle becomes the output. Commencing the importance of fitness, the finest value is considered as particle best (Pbest). Then all particle moves in the direction of Pbest particle by changing their velocity. The velocity and location of particles in iterations are updated. From that particle best (Pbest) the global best (gbest) value is determined.

Functional Modified PSO

Public Parameters

  • c1 and c2: acceleration constant

  • r1 and r2: random numbers

  • x: vectors of n random variable.

  • Loc: local best value

  • gbest: global best value.

  • Pbest: particle best

Working Process

  • Step 1 Initialize the swarm particle in the seek space randomly.

  • Step 2 Compute the fitness value by using objective function and consider it as Pbest.

  • Step 3 Update the rapidity and the location for each element. Velocity of each particle is updated by using the following equation.

$$Vjk = w\left( {Vjk \, + \, c1 \times r1\left( {Locjk - xjk} \right)} \right) + \, (c2 \times \, r2\left( {gbest - xjk} \right))$$
(2)

The acceleration coefficients c1 and c2 are considered as constant value to influence particle velocity.

Location of each particle is updated by using the equation

$$X_{jk} = X_{jk} + V_{jk}$$
(3)
  • Step 4 Update the value of pbest and gbest.

  • Step 5 Stops if max iteration is accomplished or else repeat from step 2.

Adaline Neural Network

The Neural network is a directed graph where nodes are neurons and edges connect two neurons. Weights are associated with each connectivity. Adaline network is simple two-layer neural network having one input and output layer. The number of input layer neurons are equals the number of inputs.

Figure 1 represents an Adaline neural network containing four input neurons in input layer and one output in output layer like X1, X2, X3, and X4 for input layer. The weight factors are represented as W1, W2, W3, and W4. The output of the above network can be stated as follows:

$$O_{i} = \sum {X_{i} \times W_{i} }$$
(4)

where i = 0, 1, 2, 3…n

Fig. 1
figure 1

Adaline neural network

The error in Adaline network is the difference between desired value and observed value which can be stated as:

$$E_{i} = \sum {F_{i} - O_{i} }$$
(5)

where, Fi represents desired output and Oi represents observed values of network.

The Proposed Methodology for Prediction

This paper proposes an efficient prediction model to predict stock price based on Adaline Neural Network and optimized by Modified PSO. The PSO (particle swarm optimization) is used to find universal optimum value from total search space and to improve the convergence rate and doling out speed. A further improvement has been provided to diminish the error by merging PSO algorithm through Adaline algorithm.

The model takes closed price, high, low and average price as input then predicts next day open price. In the proposed model stock market data is normalized using Eq. (6) can be stated as:

$$Y = \left( {Y - Y_{min} } \right)/ \, \left( {Y_{max} - Y_{min} } \right) \,$$
(6)

The above normalization technique Eq. (6) is a simple process of scaling the values within the range of 0–1. This method used to standardize time series data known as Min Max scalar or feature Scaling technique.

In PSO, the velocity of each particle in swam is updated using following equation:

$$v_{i} (t + 1) = wv_{i} (t) + c_{1} r_{1} [\hat{x}_{i} (t) - x_{i} (t)] = c_{2} r_{2} [g(t) - x_{i} (t)]$$
(7)

Where, i is the index of particle, vi(t) is the velocity of particle at time t and xi(t) is the position of particle at time t. The parameter w, c1 and c2 are user given coefficients. r1 and r2 are the random values, ranges from 0 to 1.

Parameters are chosen to calculate fitness value of each swarm. Using fitness values we determine particle best (pb) value based on following equations.

$${\text{If f}}\left( {\text{Zi}} \right) \, > {\text{Pb}}\left( {\text{Zi}} \right)$$
$${\text{Pb}}\left( {\text{Zi}} \right) = {\text{f}}\left( {\text{Zi}} \right)$$

else

$$Pb\left( {Zi} \right) = swarm\left( {Zi} \right) \,$$
(8)

where, f(Z) is the fitness value of every particle and swarm (Z) is the current or previous fitness value. After a number of iterations parameters are updated and from that maximum fitness value is considered as global best (gb) value of PSO technique.

Working Steps Proposed Model

Step 1:

Collection of stock market data and variables.

Step 2:

Verify the features of data collected by feature extraction.

Step 3:

Normalize the data set using Eq. (6).

Step 4:

Initialize the particles in sample space.

Step 5:

Determine fitness value of each particle using mean square error as objective function.

Step 6:

Training the dataset using proposed Neural Network and calculating the error.

Step 7:

Set the modified PSO parameters.

Step 8:

Modified PSO search of finest solution according mean Square error.

Step 9:

Test the dataset after successful training of new model.

Step 10:

After successful testing the model will predict response through ANN objective model if the optimal solution is reached.

The work flow of proposed model (Fig. 2).

Fig. 2
figure 2

Represents the work flow of the proposed model

Experimental Result

Performance Measures

The proposed forecasting model is trained well to give reduced Mean Square Error (MSE) and reduced MAPE in case of stock data of HDFC and JSPL.The error and Mean absolute percentage error are calculated using Eqs. (5) and (8) respectively. The assessment of actual and predicted values of JSPL in Fig. 3 for the year 2012, Fig. 4 for year 2013, Fig. 5 for the year 2014 and predicted values of HDFC in Fig. 6 for the year 2012, Fig. 7 for the year 2013, Fig. 8 for the year 2014. The Table 2 contains the result obtained from different datasets for different year. In the figure both values Actual and predicted are indistinguishable for stock data of year 2012, 2013 and 2014. The Fig. 9 shows error in network for dataset of HDFC for the year 2012–2014 similarly the Fig. 10 shows error in the network for JSPL for year 2012–2014. The error in network for HDFC and JSPL is almost reduces to less than one as shown in Figs. 9 and 10.

Fig. 3
figure 3

Actual verses predicted stock price of JSPL 2012

Fig. 4
figure 4

Actual verses predicted stock price of JSPL 2013

Fig. 5
figure 5

Actual verses predicted stock price of JSPL 2014

Fig. 6
figure 6

Actual verses predicted stock price of HDFC 2012

Fig. 7
figure 7

Actual verses predicted stock price of HDFC 2013

Fig. 8
figure 8

Actual verses predicted stock price of HDFC 2014

Table 2 Represents the result obtained from the proposed model for different datasets
Fig. 9
figure 9

Mean square error of network of HDFC entire data set

Fig. 10
figure 10

Mean square error of network of JSPL entire data set

Performance Evaluation

The Mean for vectors of data can be represented with a sample size of n which finds middle value for sample data as shown in Eq. (9). If Y hat is a vector of n predictions and Y is the vector of observed values of the variable being predicted, then within the sample MSE of predictor is represented in Eq. (10). The performance for projected replica can be evaluated by help of Eqs. (11) and the public parameters shown in Table 3 which shows mean absolute percentage error [24]. The proposed representation is evaluated on basis of following equations.

$$Mean = \frac{1}{n}\sum\limits_{i = 1}^{n} {X_{i} }$$
(9)
$$MSE = \frac{1}{n}\sum\limits_{i = 1}^{n} {(Y_{i} - \hat{Y}_{i} )^{2} }$$
(10)
$$MAPE = \frac{1}{n}\sum\limits_{1}^{n} {\left( {\frac{{\beta_{i} - \gamma_{i} }}{{\gamma_{i} }}} \right)}$$
(11)

where, in Eq. (10), γ represents vector of predictions and β represents the vector of observed values of variable being predicted.

Table 3 Represents the public parameters to evaluate the proposed model

Discussion

Comparison of Model Performance

The final result of actual versus predicted value of the entire dataset from the year 2012 to year 2014 of HDFC and JSPL is represented in Figs. 11 and 12 respectively. The actual value represented in red lines and predicted value represented in blue lines. The projected replica is comparatively enhanced in terms of classification accuracy and it reduces error up to 1.1% MAPE as shown in Table 4. The result makes us believe that our proposed model is best for financial time series data. The result of proposed model is compared with different forecasting models like Bayesion-ANN, Interval measurements and CMS-PSO as shown in Table 4. The accuracy of proposed model is better than the specified models.

Fig. 11
figure 11

Actual verses predicted stock price of HDFC entire dataset

Fig. 12
figure 12

Actual verses predicted stock price of JSPL entire data set

Table 4 Comparison of performance based on MAPE

Conclusion and Future Directions

This novel neural network approach optimized by PSO is presented which is efficient sculpts for predicting the open price of stock market and tested in real dataset of JSPL and HDFC. It seems that this model is proficient in stock prediction. From the results obtained, we can observe that MAPE is minimum for the proposed technique which is 1.1 for JSPL and 1.08 for HDFC. The parameters used in this model are the optimal parameter and data input is from real world normalized data series. The network is trained, test and validated using same series of normalized data. We believe that our representation is improved can be used for perdition of stock market open value.

This experiment is executed and tested in MatLab2013a of standard processor of core2Duo 2.94 GHz; Ram 2 GB and 32 bits operating system. The proposed model can be extended to other fields like price prediction of petrol, electric price or different goods price. The prediction model will work by modifying certain parameter and environment.