# Introduction orecasting is an important task the fund managers perform for decision making and controlling especially very important for those who are managing other people's money like fund managers. With the uncertain future, the manager needs to have a set of guidelines and tools in assisting him to predict the future movement of financial time series like share prices (Yoon and Swales, 1991; Thomaidis and Dounias, 2007). Investments are made with the objective of maximizing the return and simultaneously reducing the risk (Banz, 1981;Hirt and Block, 1996). The Sharpe ratio gives the investors how much they earn for every unit of risk they face (Jones, 2007). The mutual fund managers' objective is to maximize the return, minimize the risk and in addition they have to guarantee the safety of the funds invested by hedging. Several hedging tools are available for a fund manager presently and he has to select the best tool with minimum cost and fewer complexities to manage. All these require a well balanced efficiently forecasted share prices. The forecasted prices not only serve the purpose of hedging but also they help in controlling and decision making (Mitchell and Pavur, 2002) whether to buy or hold or sell. The objective of this paper is to apply ADALINE neural network technique to forecast the share prices. Though several traditional techniques are available like moving averages, Bollinger bands, and chartist approach (Janssen, Langager and Murphy, 2011) they depend too much on the past data and they predict the future prices for a long period ahead with the same base data. The traditional linear regression technique (Grønholdt and Martensen, 2005) takes fundamental economic variables as independent and share price as dependent variable, fail to achieve good convergence because the independent variables are macro economic variables which slowly change but the share prices are dynamic and changes daily. This mismatch results in poor forecasting. There are several plus points in applying neural networks to forecast the share prices. The first major merit is that it does not consider fundamental assumptions like normality of data (Aleksander and Morton, 1995), extreme data etc. All traditional statistical assumptions are absent here. In addition the neural nets always go for iterations which update the weights several times repeatedly with a learning rate which controls the weights of the neurons (Hecht-Nielsen 1989; Govindarajan and Chandrasekaran, 2007). Yet another advantage of neural net is the data memory issue. The old data becomes obsolete as the data has life cycle. The recent data is more useful than the oldest data. To capture this moving window technique is adopted in networks which ignore the oldest data and adds the new data for training and forecasting. This gives the required efficiency in forecasting. # II. # Adaline Neural Network Adaptive Linear Neuron known as ADALINE is a single layer neural network which is useful in predicting time series like share prices (Lin and Yeh 2009; Matilla-Garcia, and Arguello, 2005; Remus and O'Connor, 2001; Rude 2010). ADALINE is adopted with the assumption that the relationship between historical daily returns and the forecasted daily returns are linear and each of it carried different weight. The weight is not constant but ever changing when a new data arrives (Kaastra and Boyd, 1996). The main reason to convert the daily share price to daily return is to avoid non-stationary nature of share price. Moreover the daily share price does not indicate whether the price is moving up or down. The positive sign or negative sign of the daily return will be useful in finding the hit rate. There are three stages in this study, i.e., initialisation phase, training phase and forecasting phase. # III. Initialisation Phase At this phase the learning rate, number of neurons. Synapses, weights and bias are decided and given to the net for starting the computation process. The random weights and bias will change at every time we start the program. To avoid this we have set the random state as 10. This will make sure the random numbers are identical whenever or wherever the program is executed. # IV. # Training Phase The training of the network is performed through a windowing technique (Sapena, Botti, and Argente, 2003). The window will move as time progresses. The net will compute the activation value by multiplying the random weights and window of five returns and the result will be added to bias. This will be treated as the forecasted return. This value will be compared with the target the sixth day return to find variance. It is stored as error. This error with learning rate and the original sixth day's return and old weight all determine the new weight. This process will be repeated by dropping the oldest data and taking the newest data in updating weights till the end of the training set. Similar approach has been used by Buscema & Sacco (2000) in attempting to predict the stock market index returns. The same procedure is adopted by Refenes and Francis (1993) V. # Testing or Forecasting Phase The training process will be carried out in forecasting phase also. First five returns will be taken from the December 2010 data and January 2011 first return will be computed and stored. Then as in training the error will be computed comparing final return with the predicted return. Then this error, final return of 2010 and the updated weight in the training phase all will decide the first new weight and bias for 2011. This procedure will be repeated for 252 days. Later all 252 returns will be converted to predicted share prices. # VI. # Measurement of Effectiveness The difference in actual and predicted prices is recorded for the purpose of performance evaluation. The root mean squared error (RMSE), mean absolute error (MAE), mean absolute percentage error (MAPE) and hit rate are computed and recorded as follows. The RMSE is computed based on following formula Where ? = root mean squared error n = total number of days t = days x t = t th actual share price y t = t th forecasted share price The MAE is computed based on the following formula The MAPE is computed based on the following formula VII. # Hit Rate The hit rate is one if the actual and predicted returns have the same sign. This shows the direction of prediction. Average hit rate is computed as follows # VIII. Sample, Analysis and Interpretation With the above ADALINE architecture and methodology a MATLAB program was written to test the efficiency of neural networks forecasting time series, the The correlation coefficients show the relationship between the actual price and predicted prices at various learning rates. A high correlation indicates that the actual and predicted prices move in tandem and vice versa. At the learning rate of 75% the correlation is 78%. The correlation coefficients increase continuously as the learning rate increases. This implies at lower learning rates the actual prices and forecasted prices do not converge and more gaps is existing between them. When the learning rate increases the error levels fall steeply. At 15% learning level the RMSE was 0.83 but in 75% learning level it decreased to 37%. The same trend is visible in MAE and MAPE. Hit rate also reduces but not as steep as other error measures. These results imply at higher learning rates the ADALINE neural net predicts the share prices more precisely. # X. # Axiata Axiata share prices are forecasted at different learning rates ranging from 15% to 75% for 2011 and the results are as follows. The actual mean price for 2011 is RM 4.89 and the forecasted mean prices are very close to this price except at the learning rate of 15% which is RM 4.95. When the learning rate increases the mean prices are decreasing and come closer to actual mean price which implies at the higher learning rates the net learns better and forecasts better. The volatility is 0.13 for actual prices but for forecasted prices the volatility is slightly more. Median prices show similar trends as mean prices. The range also decreases when the learning rate increases. The correlation coefficients increase from 5% to 33% when the learning rates increase from 15% to 75%. These results imply that the net forecasts well in higher learning rates and the movements are also closer to actual prices. # Year The thin black line shows the actual price and the thick line shows the predicted prices. It could be observed that both lines are moving in tandem capturing the same trend. However the thick line is more volatile and oscillates up and down more compared to the actual line. At 15% learning rate the lines diverge more than at 75% learning rate where the convergence is better. At the learning rate of 15% all errors are very high including the hit rate. When the learning rate increases the errors decline gradually but the hit rate falls steeply. The results indicate the net performs well in higher learning rates. # XI. # HLB HLB is another listed company in the Malaysian stock exchange. By applying the same procedure the share prices are predicted by the ADALINE net after training by the 2010 return data. The actual mean price is RM 11.07 for HLB in 2011 and at various levels of learning rates the forecasted mean prices are very close in the range of RM 11.03 to 11.09. The average price predicted at the learning rate of 15% is very low at RM 10.88. The standard deviation is also very high for this company price when compared to all other companies' standard devotions. Like mean prices the median prices also increase when the learning rate increases. The range is higher for the predicted prices than the actual price. The correlation coefficients between the actual and forecasted prices are strong around 85% to 89% except at 15% learning rate which indicates the actual and the forecasted prices move very closely in tandem. All these reveal that the net is producing robust results at higher learning rates. The following figure shows the convergence of actual and predicted share prices for HLB. The first graph which is predicted at 15% learning rate shows wider gap between the actual and predicted prices. This gap reduces gradually with the same trend when the learning rate increases progressively. The convergence is excellent at 75% learning rate. The following figures also reveal the poor convergence of actual and predicted prices of KLK for 2011. The gap is substantial in 15% learning rate. When the learning rate goes up the gap between the actual and predicted price reduces a bit but not to the expected levels as in the other companies. The volatility is also very steep in the predicted lines. The RMSE declines when the learning rate increases from 15% to 75% by 44% approximately. Similarly the MAE and MAPE decline by 47.69% and 47.94% respectively. The hit rate declines when the learning rate increases by 2.51%. In absolute terms it declines from 48.97% to 47.74%. These higher error levels reveal the poor convergence of actual and predicted share prices of KLK. # XIII. # Conclusion In this article we applied ADALINE neural network to predict the selected share prices of companies listed in Malaysian stock market. The ADALINE neural network predicts the trends well for all the four companies. The convergence of actual and predicted prices is excellent at higher learning rates in three companies. KLK company's graph shows poor fitting. The predicted prices closely converge with the actual prices with negligible gap at the higher learning rates. At lower learning rates the convergence is poor for all four companies. Our finding will be useful for fund managers to predict the share prices which will facilitate not only in decision making, controlling, and hedging but also in selection of shares for constructing share portfolios. # Global Journal of Computer Science and Technology Volume XIII Issue II Version I 1![Figure 1 : Training and forecasting flow algorithm](image-2.png "Figure 1 :") 2![Figure 2 : Neuron and synapse connection in forecasting](image-3.png "Figure 2 :") ![in predicting the currency exchange rate and (De Faria et al, 2009) in predicting the Brazilian stock market index.](image-4.png "") ![Update bias b (new) = b (old) + alpha *](image-5.png "") 1![Figure 1 : Convergence of actual and forecasted share prices of AMMB A close observation of the figures reveal at 75% of learning rate the forecasting is efficient because the forecasted price and the actual price converge almost perfectly. In January and February the forecasted line and the actual lines show a larger gap and later predicted line follows the actual price line closely. At](image-6.png "Figure 1 :12") 2![Figure 2 : Convergence of actual and forecasted share prices of Axiata](image-7.png "Figure 2 :") 3![Figure 3 : Convergence of actual and forecasted share prices of HLB Global Journal of Computer Science and Technology](image-8.png "Figure 3 :14") 4![Figure 4 : Convergence of actual and forecasted share prices of KLK](image-9.png "Figure 4 :") Small random weight for each neuron, a bias and a learning rateConvert:Share prices to returns?? = ?? ?? /?? ???1Wherer = daily returnp t = price todayp t-1 = previous day's priceIterate:Until a condition is satisfied (say, 100 times)Compute the net input and keep it in y i ?? = ? ?? ?? * ?? ?? + ?? ?? ??=1wherey = forecasted daily returnb = biasw = weightx = historical daily returnn = number of synapseUpdate weights w i(new) = w i(old) + alpha * (t-y)wherealpha = Learning ratet = target return (6 th day return) 1(t-y)End iteration after 100 timesForecasting: Take the above updated weights and biasIterate:for 252 days (? stock market works for 252 days approximately)Compute the return?? = ? ?? ?? * ?? ?? + ?? ?? ??=1Convert:Returns to Share price?? = ?? * ?? ???1 2learning rates -AMMBLearningRMSE MAEMAPEHit Raterates(%)(%)0.150.830.7411.8242.390.350.420.345.4439.090.550.360.284.5337.450.750.370.314.8935.80 3Actual share priceLearning Rates Predicted share pricesParameters0.150.350.550.75Mean4.894.954.914.894.88Std Deviation0.130.180.170.160.17Median4.894.954.924.904.88Range0.571.040.940.920.90Maximum5.145.545.375.365.35Minimum4.574.504.444.444.45Correlation coefficients--0.050.250.300.33 4learning rates -AxiataLearningRMSE MAE MAPEHit Raterates(%)(%)0.150.220.173.5250.210.350.190.142.9345.270.550.180.132.7543.210.750.170.132.7043.21 5Actual Share priceLearning Rates Predicted share pricesParameters0.150.350.550.75Mean11.0710.8811.0311.0811.09Std Deviation1.451.631.561.551.54Median10.5810.4610.5810.6410.68Range4.556.295.455.275.18Maximum13.7614.8114.3514.3114.23Minimum9.218.528.919.059.05Correlation coefficients--0.710.890.880.85 6increases by 8% approximately. It seems at higherlearning rates -HLBlearning rates the net forecasts well.Learning ratesRMSE MAE MAPE (%)Hit Rate (%)XII.KLK0.151.190.797.1741.560.350.840.544.8845.270.550.740.494.3945.680.750.690.464.1845.27The RMSE, MAE and MAPE all decease steeplywhen the learning rate increase from 15% to 75%. TheRMSE declines from 1.19 to 0.69 almost a drop of 42%.The MAE and MAPE also fall by the same percentage.The hit rate behaves in an opposite way. When learningrate increases from 15% to 75% the hit rate also 7Actual Share priceLearning Rates Predicted share pricesParameters0.150.350.550.75Mean21.4524.05 23.42 23.01 22.78Std Deviation0.670.950.890.880.89Median21.3423.92 23.31 22.91 22.66Range3.545.564.704.595.68Maximum23.1027.27 26.26 25.41 25.56Minimum19.5621.70 21.56 20.81 19.88Correlation coefficients--0.090.350.420.44 8learning rates -KLKLearningRMSE MAE MAPEHit Raterates(%)(%)0.152.822.6012.1448.970.352.161.989.2148.150.551.781.587.3546.500.751.571.366.3247.74 Convergence of Actual and Predicted Share Prices -An ADALINE Neural Network Approach E Convergence of Actual and Predicted Share Prices -An ADALINE Neural Network Approach * An Introduction to Neural Computing IAleksander HMorton 1995 International Thompson computer press London * The Relationship between Return and Market Value of Common Stocks RWBanz Journal of Financial Economics 9 1 1981 * feed forward networks in financial predictions: The future that modifies the present MBuscema PSacco Expert Systems 17 2000 * Predicting the Brazilian stock market through neural networks and adaptive exponential smoothing methods DeFaria ELAlbuquerque MPGonzalez JLCavalcante JTAlbuquerque MP Expert Systems with Applications 2009 * Classifier Based Text Mining for Neural Network MGovindarajan RMChandrasekaran World Academy of Science, Engineering and Technology 27 2007 * Analysing Customer Satisfaction Data: A Comparison of Regression and Artificial Neural Networks LGrønholdt AMartensen International Journal of Marketing Research 47 2005 * Theory of the Back propagation Neural Network RHecht-Nielsen International Joint Conference IEEE 1 Washington, DC, USA IEEE 1989 * GAHirt SBBlock Fundamentals of Investment Management Irwin New York McGraw-Hill 1996 * CJanssen CLangager CMurphy 2011 The Basic Assumptions Technical Analysis * Investments: Analysis and Management CPJones 2007 John Wiley & Sons, Inc Hoboken, N.J. * Designing a neural network for forecasting financial and economic time series Neuro computing IKaastra MBoyd 1996 10 * Empirical of the Taiwan Stock Index Option Price Forecasting Model -Applied Artificial Neural Network CTLin HYYeh Applied Economics 41 2009 * A Hybrid Approach Based on Neural Networks and Genetic Algorithms to the Study of Profitability in the Spanish Stock Market MMatilla-Garcia CArguello Applied Economics Letters 12 2005 * Using modular neural networks for business decisions Management Decision DMitchell RPavur 2002 40 * Currency exchange rate prediction and neural network design strategies ANRefenes GFrancis Neural Computing and Applications Journal 1 1993 * Neural networks for time-series forecasting -A handbook for researchers and practitioners WRemus MConnor 2001 * MANorwell Kluwer Academic Publishers * Using Artificial Neural Networks to Forecast Financial Time Series ARude 2010 Norwegian University of Science and Technology * Application of neural Networks to Stock Prediction in "Pool OSapena VBotti EArgente Companies Applied Artificial Intelligence 17 2003 * A Comparison of Neural Network Model Selection Strategies for the Pricing of S&P 500 Stock Index Options NSThomaidis VSTzastoudis GDDounias International Journal on Artificial Intelligence Tools 16 2007 * Predicting stock price performance: A neural network approach YYoon GSwales Proc. 24th Annual International Conference of Systems Sciences 24th Annual International Conference of Systems SciencesChicago 1991