INTRODUCTION
The stock market is a very complex, dynamic and nonlinear system that involves
huge amount of transactions. Many factors affect the stock market trend such
as inflation rates, Foreign exchange (FOREX) rates, Gross Domestic Product (GDP)
growth, Government instability, economic factors, tax rates, Government budget
and various issues (Chang et al., 2009). Stock
market prediction is not an easy task due to its high volatility, irregularity
and unstable environment. Recently, many research studies on the predictability
of the stock market have been concentrated to predict future price movement
of stock market (Huang et al., 2009). The main
objective of developing computational intelligence system is to find out the
price trend in advance by using technical indicators. Technical indicators identify
the patterns and relationships in historical data and this is useful for shortterm
traders.
Recent studies recognized that nonlinearity exists in stock market data. Nonlinear
models such as softcomputing models provide superior prediction results than
linear models (Dhar and Chou, 2001; Yu
et al., 2009). Adaptive NeuroFuzzy Inference System (ANFIS) can
be believed as strong alternative to various soft computing models for forecasting
stock price (Fahimifard et al., 2009; Anari
et al., 2011). ANFIS combines the advantages of Artificial Neural
Network (ANN) and fuzzy logic system that can be applied in the design of the
forecasting system. Each model has its own strengths and limitations. ANN has
the ability to learn complex nonlinear data effortlessly (Solaimani,
2009; Senol and Ozturan, 2008) . In contrast, Fuzzy
logic systems easily deal with problems such as interpretation on a highlevel
than ANN (Lin, 2008). Fuzzy logic looks like closer
to the technique our human brainwork. ANFIS has emerged by integrating the superior
learning capability of ANN and better reasoning ability of fuzzy logic.
Recent improvements in Artificial Immune Algorithm (AIA) have provided a technique
for Adaptive NeuroFuzzy Inference System, with application in optimization,
recognition, timeseries prediction and other research fields. Several researchers
have extended immune algorithms to employ neuro fuzzy systems in order to get
better the recognition and selflearning ability of neural network (Castro
and Von Zuben, 2011; Widyanto et al., 2006).
In ANFIS, the immune algorithm is inspired by natural biological immune system
that is applied to optimize the fuzzy system parameters. Fuzzy system combines
membership functions, fuzzy rules and the consequent rule by immune algorithm
(Chen et al., 2009). First ANFIS creates a fuzzy
rule set and then design the member ship functions using immune algorithm.
The main objective of this study was to forecast the stock market trend using ANFIS with artificial immune algorithm by applying well known technical indicators.
MATERIALS AND METHODS
Recently soft computing techniques, such as Artificial Neural Networks (ANNs)
and fuzzy logic, artificial immune algorithm etc., have been efficiently applied
to forecast stock market. Soft computing technique can able to recognize the
nonlinear relationships in stock market data. Artificial Neural Networks (ANNs)
are nonparametric modeling tools that can be applied for the purposes of forecasting,
clustering and pattern recognition. ANN emulates the neurons of biological network
in human brain. ANN is parallel computing model which are having processing
elements that learning very easily the complex and nonlinear data even though
the data has noisy and chaotic (Rabunal and Dorado, 2006).
However, limitation of ANN model is lack of recognition with multi dimensional
nonlinear models.
Among the soft computing techniques, Adaptive NeuroFuzzy Inference System
(ANFIS) is a prominent model for forecasting the stock market. ANFIS has excellent
convergence characteristics and it can able to extract patterns from numerical
data (Depari et al., 2007). ANFIS is a fuzzy
inference systems based on adaptive neural network, in which inputs have been
processed by fuzzy rules for getting outputs. Fuzzy logic systems use the easily
understandable IFTHEN rules for denoting their decisions and it imitates the
human reasoning. However, fuzzy system lacks a learning system. In this perspective,
the fuzzy logic models integrated with ANN play a very important task in the
development of intelligent system for forecasting the stock market.
In general, ANN is used for selflearning and adoptability, fuzzy logic model is used to deal with ambiguity and improbability and immune algorithm is used for recognizing and optimization. When combine these technologies, the hybrid system is able to achieve high performance forecasting result.
Fusion model: A fusion model ANFIS with artificial immune algorithm
is developed and implemented for forecasting Indian stock price in present study.
ANFIS is suitable for stock market forecasting that has the ability to build
active model in noisy and chaotic stock market data. Immune algorithm can be
integrated in to the construction of ANFIS, because it has the efficiency to
explore huge spaces and find a greater number of local optima issues.

Fig. 1: 
Framework of the fusion model 
Finally, a fusion model of ANFIS and immune algorithm has provided the superior
results by combining the qualities of both techniques.
In the fusion model, fuzzy system uses Sugenotype fuzzy system and the membership
function’s parameters are adjusted using immune algorithm (Lin
et al., 2008; Zhang and Li, 2011). The technical
indicators are given as inputs to the input layer of ANN for learning their
relationship to find the future trend of stock market. The main processes of
the fusion model are shown in Fig. 1 and the each block of
this model is described in the following sections.
Adaptive Neuro Fuzzy Inference System (ANFIS): The Adaptive NeuralFuzzy
Inference System (ANFIS) integrates the advantage of both fuzzy systems and
neural networks (Liu et al., 2010). The fuzzy
system initially fuzzifies inputs to values at interval (0, 1) with a set of
Membership Functions (MF). Next, it is inferred by fuzzy logic through rules
in the form of IFTHEN.

Fig. 2: 
The architecture of ANFIS model 
The basic part of fuzzy system is the fuzzy inference engine that can be used
for creating fuzzy rules. The example of fuzzy rules is:
Neuro fuzzy system consists of five layers: fuzzy layer, product layer, normalized
layer, defuzzy layer and summation layer (Lee, 2005).
The architecture of ANFIS model used in this article is shown in Fig.
2.
Layer 1 (input layer): We using TSK Membership Functions (MFs) as inputs such as triangularshaped function. Output of a node in the first layer is the member’s degree of input:
where, μ_{Ai} represents membership function and x_{j} denotes input variable.
If the membership function μ_{A} (x) is triangularshaped, i.e.,
The parameters a and c locate the “feet” of the triangle and the parameter b locates the peak.
Layer 2 (product layer): AND operator is used to product the input membership values. Output of each node represents the waiting factor of a rule:
for m = 1,2….N i.e. product layer has N nodes.
Weighting factors of the ith rule is evaluated as follows:
Layer 3 (normalization layer): It calculates the ratio of weighting factor of the rules with the total weighting factors:
Layer 4 (defuzzification layer): Output of every node is calculated by multiplying the normalized one with consequent parameters (C_{0} …. C_{5}) of linear function (f_{1} = c_{0}+ c_{1} x_{1}+c_{2} x_{2}...+c_{5} x_{5}):
Layer 5 (total output layer): The single node is labeled as Σ in the fifth layer computes the overall output as the summation of all incoming signals. It can be expressed as follows:
Inputs X_{1} to X_{5} show various technical Indicators. The value of each variable is described by one of a possible five fuzzy membership sets (VL L M H VH ) : Very Low (VL), Low (L), Medium (M), High (H) and Very High (VH). The ANFIS has 5 input values for each of the 5 input variables and one output. Therefore, the number of possible fuzzy ifthen rules for ANFIS is 3125 (5^{5}).
Clonal selection algorithm: Artificial immune algorithm is a new computational
intelligence procedure inspired by biological human immune system (Do
et al., 2009). In present study, we utilized an immune algorithm
is called clonal selection algorithm, named CLONALG. The CLONALG is functioning
as genetic algorithm and has superior qualities for the exploration and optimization
(AlEnezi et al., 2010). It is simulated on the
natural B cell system. Antibodies are affixed on the B cell which recognizes
the antigens which coming from external environment. In brief, Clonal selection
algorithm clones more antibodies of best fitness antibody for eliminating the
antigen. As a result, immune system produces more antibodies against antigen.
Basic elements of this algorithm are antibodies and antigens. In ANFIS, antigen
is an input from stock market data and antibody is a fuzzy rule. The algorithm
is applied to train fuzzy rules with best fitness from stock market data (Mezyk
and Unold, 2008; Su et al., 2008). The basic
structure of CLONALG is described below:


Fig. 3: 
Actual historic data of NSE Nifty index 
Inputs parameters have been applied to set up financial system for forecasting index value of Indian stock market. The forecasting system was tested on NSE Nifty index of Indian stock market based on historical data from 2010 to 2011. We have applied different data sets for training and testing. Neural network was trained using the data from 1st March 2010 to 31st August 2010. The testing period is selected to be from 1st September 2010 to 28th Feb 2011. The actual index values of both training and testing periods are shown in Fig. 3. The historical data is served as information resource on the daily closing values for NSE Nifty index: the number of observations for index is 253.
Stock market forecasting can be evaluated by technical analysis with some technical indicators to predict the future stock trend in the early stage. In present study, we used some of important technical indicators along with price and volume of NSE Nifty index. Exponential Moving Average (EMA) and Relative Strength Index (RSI) are utilized to evaluate the price trend. Arms Index is used for volume analysis.
We have taken three important technical indicators, price and volume for the configuration of our trading system and their formulas are given below.
• 
Exponential Moving Average moving (EMA) which gets the price
from the previous closing price of periods adds them up and divides by the
number of periods: 
where, CP is a closing price.
• 
Relative Strength Index (RSI) measures the velocity of price
movements and determines the overbought and oversold conditions: 
where, RS = (Avg. of nday up closes) / (Avg. of nday down closes); n = days (915 days)
• 
Arms Index is used to measure relative volume flows: 
where, AI = No. of Advancing issues; AV = Advancing Volume; DI = No. of Declining issues; DV = Declining Volume. If Arms Index > 1.0, Market is down trend and If Arms Index < 1.0, Market is up trend.
The performances of the different stock forecasting models are evaluated by
various statistical metrics, namely Root Mean Squared Error (RMSE), Mean Absolute
Percentage Error (MAPE) and Mean Absolute Error (MAE) (Singh
and Ahmad, 2011). In order to test and evaluate the performance of our fusion
system ANFIS with artificial immune algorithm, not only compared with benchmark
NSE nifty index, but also a comparison should be made with other forecasting
models: pure ANFIS and ANN. If RMSE is very less, the forecasting precision
of the system is very close to 100%.
RESULTS AND DISCUSSION
We have implemented and tested our model for forecasting stock using MATLAB. Training and Testing data of NSE Nifty selected from the Yahoo server, the rules are designed for the ANFIS editor (Sugeno type) using Fuzzy Logic Toolbox of MATLAB for forecasting the Indian stock index. Expected outcomes and forecasted values of ANN, pure ANFIS and ANFIS with immune algorithm are compared with current trends of benchmark index NSE Nifty.
Forecasted results of these three stock forecasting models were estimated by calculating the error between the current closing price and the forecasted closing price. Our new fusion forecasting model is compared with another forecasting models and benchmark index NSE Nifty.
Figure 4 shows the forecasted values of three forecasting
models during the period 20102011. It is clearly shows that our forecasted
data of our fusion system is very close to actual NSE Nifty data than other
models.

Fig. 4: 
Actual and forecasted value of NSE Nifty generated by different
forecasting model 
Table 1: 
Comparison of errors for ANFIS+AIA, ANFIS and ANN 

Table 1 shows the results have been obtained by three forecasting
models, such as ANN, pure ANFIS and ANFIS with AIA for forecasting NSE Nifty
index. The forecasting performance is estimated by the differentiation between
the forecasted value and actual value.
The comparison results show that our fusion model is more desirable than other forecasting models with regard to the precision of predicted index values. To compare the accuracy of stock forecasting models, the RMSE, MAPE and MAE of three models are evaluated (Table 1). Table 1 indicates that the proposed fusion model has the smallest RMSE, MAPE and MAE among the three forecasting models. Thus, the proposed fusion model can predict more accurate future stock market trend than those obtained form other forecasting models.
CONCLUSION
Present study has provided a framework to demonstrate the good properties of fusion forecasting system for identifying the future stock market trend. Since ANFIS is an efficient model to build forecasting system for making decision. However, finetuning of the weighting and membership function is a difficult task. We have proposed an artificial immune algorithm for ANFIS to improve an optimal learning technique. Experimental results showed that forecasted value of our proposed fusion model is very similar to actual benchmark index value of NSE Nifty than other forecasting models: ANFIS and ANN. In addition, Statistical measures of fusion model, such as RMSE, MAPE and MAE are very less significant than other stock forecasting models. Consequently, the proposed fusion model ANFIS with AIA can be able to produce a better decisionmaking and thus it is successfully used for stock market forecasting.