INFORMATION TECHNOLOGY OF STOCK INDEXES FORECASTING ON THE BASE OF FUZZY NEURAL NETWORKS

In this research the information technology for stock indexes forecast on the base of fuzzy neural networks was created. The possibility of its use for multi-parameter short-time stock indexes forecasts, in particular S&P500, DJ, NASDAC was checked. The created information technology is used making several consequential steps. The stock indexes forecast numeral experiment based on real data for period of several years with use of the technology offered was made. * Computer Science and Information Technology Department, Cherkasy State Technological University,460 Shevchenko Blvd, 18006, Cherkasy, Ukraine, +380 978885231, tryusyv@gmail.com ** Computer Science and Information Technology Department, Cherkasy State Technological University,460 Shevchenko Blvd, 18006, Cherkasy, Ukraine, +380 663056089, LesleyRoot1726@gmail.com *** Computer Science and Information Technology Department, Cherkasy State Technological University,460 Shevchenko Blvd, 18006, Cherkasy, Ukraine, +380 966172088, k_galasun@mail.ru **** Software Department, Cherkasy State Technological University, 460 Shevchenko Blvd, 18006, Cherkasy, Ukraine, +380 97 2609085, gzaspa@ukr.net


INTRODUCTION
The task of future time series values forecasting on the base of its history is the basis for financial planning at economics and trade, for manufacturing volume planning, management, and optimization etc.Recently fuzzy neural network based forecast gets more and more popular among forecast methods (Jang, 1993;Jang & Sun, 1995, 1997;Svalina, Galzina, Lujić, & Šimunović, 2013;Wang, 1994;Wang and Elhag, 2008;Zhang & Hu, 1998).Forecast results received using fuzzy neural networks are often more accurate in comparison with regression methods, for instance, Auto-Regressive Integrated Moving Average (ARIMA) Model (Mohaddes & Fahimifard, 2015).
The research goal is creation the information technology for stock indexes forecast on the base of fuzzy neural networks and checking the possibility of its use for multy-parameter short-time stock indexes forecasts, in particular S&P500, DJ, NASDAQ.

FORECAST REALIZATION STAGES
The use of information technology offered is made in several stages: 1. Downloading data, for instance, from http://finance.yahoo.com("YahooFinance", 2016); 2. Preparing data for inputting into Fuzzy Logic Toolbox Matlab ("Adaptive Neuro-Fuzzy Modeling", 2016) (here the software module developed with the authors is used; it helps to prepare input data using time windows method); 3. Creating fuzzy neural networks ANFIS ("Adaptive neuro-fuzzy inference system", 2016; "Toolbox fuzzy-logic Matlab", 2016) and inputting data including stock index value at trading beginning, maximal and minimal index value on the day, value at trading closing; 4. Configuring the fuzzy neural network (generating the fuzzy output system with given parameters, choosing the type and number of membership functions for every in, choosing the membership function type for network out); 5. Modeling on test data; 6.Stock index value forecast for trading beginning for several future days; forecast result analysis.
Neural networks work with systems which have inputs and the output which depends on inputs variables values set and their work is in building the system which produces maximally close out value for all sets training sample input data on the base of some input data sample.For stock indexes forecast the system with the following variables set was used:  input variables are the values of some stock index for current day stock exchange opening and closing and the highest and lowest index values for current day;  output variable is the value of some stock index for the following day stock exchange opening (tab.1).
So, system output is a stock index value forecast for the trading opening in the day following after the current day.

DATA DOWNLOAD
The data for neural networks learning, for forecast and results comparison were downloaded from «YahooFinance -BusinessFinance, StockMarket, Quotes, News» ("YahooFinance", 2016).For stock indexes values downloaded the following steps are needed: 1. Open web site ("YahooFinance", 2016), in search field enter stock index name, chose the necessary index from the list (Fig. 1).

DATA PREPARATION AND FORMATTING
The following step is to enter the folder with downloaded file, open the file in text editor, replace all symbols «,» for tab «^t» and save as plain text with tab delimiters.After saving we open file in a spreadsheet application (for instance, MSExcel), remove columns with average value data (AdjClose) and sales volume (Volume), delete first row with columns headers, sort all data on first column ascending from the earliest date to the oldest, remove first column with information on date (Date) and save the file.
The forecasting results for indexes DowJones, S&P 500, NASDAQ were researched.The study samples were got for period from September 1st, 2011 to September 7th, 2016.For every index the forecast for 12 days was made, so, from September 8th, 2016 to September 23rd, 2016.
Before fuzzy output system study start the file data must be transformed to form given in tab. 1.For this function CreateAModelOfTheRowNnet can be used (it is presented in listing 1).The following parameters are passed to the function: Rowthe file with formatted data from site name, NameOfFilethe file

FUZZY NEURAL NETWORK STUDY
For fuzzy logical output system study the following actions must be executed: 1. Open Anfis editor (in Matlab command line write: >>anfisedit).2. Download to Anfis editor (Load data) the study sample data (Training) from Matlab working area or from file, for example, DJ_train.dat(Fig. 3, item 1-2).3. Build the initial system of fuzzy logical output.It can be made in several ways:  download the system created before (Load from file or Load from workspace) (Fig. 3, item 3);  generate the system (Generate FIS) with full rules set on inputs and output membership functions number which are given the user for input in «Grid partition» mode.In this case membership functions will be located equidistant from each other on all in/out variable range of (Fig. 3, item 4);  generate the system (Generate FIS) using study sample values clusterization (Sub.clastering) and creation on its base the membership function (Fig. 3, item 5). 4. Execute the fuzzy neural network study (Train Now) using hybrid algorithm (Optim.method: hybrid) or converse error spread algorithm (Optim.method: backpropa) (Fig. 3, item 6). 5.After system study it is possible to compare system outputs values with real data in «Training data» (Test Now) mode (Fig. 3, item 7).

Fig. 3. Fuzzy logical output system study stages
The received system of fuzzy logical output can be used for stock indexes forecasting.To check the forecasting efficiency the data from file should be downloaded (Load data) to the editor for checking (for example, DJ_tail.dat) in Checking mode.Then real data diagrams and fuzzy output system generated data diagrams should be superimposed (Fig. 4 item 1-2).For loading NNTool application the following command must be written in command line: >>nntool.Then in NNTool editor window the data are loaded and neural network is created with configuration given in Fig. 5.

Fig. 5. Loading data to NNTool and neural network creation
Then one should go to neural network study control window and execute the study having selected the proper analysis parameters (Fig. 6).

Fig. 6. Neural network study
After the study one can generate system output for data which were selected for checking forecast effectiveness (Fig. 7).Then the result can be loaded to Matlab working area using «Export…» function in NNTool application command panel.The comparison of forecast data and real data is given in diagram (Fig. 8).
In Fig. 9 and 10 the real values of S&P 500 stock index for the period from September 8th, 2016 to September 23rd, 2016 and forecast result using fuzzy neural network and classical neural network respectively.The forecast errors using both methods are given in tab. 2. Classical neural network produced better result for stock indexes Dow Jones and S&P 500 but fuzzy neural network produced better result for NASDAQ index.
The success in classical neural network study depends significantly on generation the initial system parameters, so, sometimes the study doesn't produce even satisfactory result.Fuzzy neural networks in given experiment produced forecasts with almost the same error that classical neural network did but the forecast accuracy was more stable.

CONCLUSION
1.The results of numeric experiment in stock indexes forecast on real data for period of several years on the base of proposed technology has shown the possibility and expediency of fuzzy neural networks use short-term stock indexes forecast and their advantage over common artificial neural networks on criterion of forecast accuracy and stability.2. The information technology offered can be used for single parameter and multi-parameter short term forecasting of currency rates and shares price if data in form of time series are available.

Fig. 2 .
Fig. 2. Stock indexes values downloading stages (source: own work using Internet resource http://finance.yahoo.com) study sample data will be saved name, NumOfTaildays number for which the forecasting will be made (some rows are truncated in study sample file), NameOfTailFilename of file for saving data for checking.The example of function call from Matlab command line: >>CreateAModelOfTheRowNnet('tableDJ.txt','DJ_train.dat',12, 'DJ_tail.dat');

Fig. 4 .
Fig. 4. Checking the efficiency of forecasting using fuzzy neural network

Fig. 7 .
Fig. 7. Neural network output generation for forecast efficiency checking data

Fig. 9 .Fig. 10 .Fig
Fig. 9. Real values of S&P 500 stock index for the period from September 8th, 2016 to September 23rd, 2016 and forecast result using fuzzy neural network