You are on page 1of 13

International Journal of Computer Engineering and Technology (IJCET), ISSN 0976-6367(Print), INTERNATIONAL JOURNAL OF COMPUTER ENGINEERING & ISSN

0976 - 6375(Online), Volume 4, Issue 6, November - December (2013), IAEME


ISSN 0976 6367(Print) ISSN 0976 6375(Online) Volume 4, Issue 6, November - December (2013), pp. 423-435 IAEME: Journal Impact Factor (2013): 6.1302 (Calculated by GISI)



S.V.S. Ganga Devi Professor in MCA, K.S.R.M. College of Engineering, Kadapa - 516 003 Andhra Pradesh, India.

ABSTRACT Over the last decade, genetic algorithms (GAs) have been extensively used as search and optimization tools in various problem domains, including Sciences, Commerce, and Engineering. The generation of profitable trading rules for stock market investments is a difficult task but admirable problem. In this paper, I first explained about basic functions involved in GAs with examples, later I prepare a model for financial forecasting using Genetic Algorithms. The trading rules would yield highest return over a certain time period using historical data. Key words: Genetic Algorithms, Fitness function, Financial Forecasting. INTRODUCTION For a long time, stock market prediction is long esteemed desire of investors, speculators, and industries. Although several studies investigated to predict price movements in stock market, financial time series too complex and noisy to forecast. Many researchers predicted the price movements in stock market using artificial intelligence (AI) techniques during past decades .Recent research tends to include novel factors and to hybridize several AI techniques. In (Y. Hiemstra, 1995) proposed fuzzy expert systems to predict stock market returns. He suggested that ANNs and fuzzy logic could capture the complexities of the functional mapping because they do not require the functional specification of the function to approximate. A more recent study of (K. Kohara, 1997) incorporated prior knowledge to improve the performance of stock market prediction. In (R. Tsaih, 1998) integrated the rule-based technique and the ANNs to predict the direction of the S&P 500 stock index futures on a daily basis. Previous research using AI techniques almost predicted the price of every trading day, week, and month. It is more important, however, to determine stock market timing, when to buy and sell stocks, than to predict the price movement for everyday because investors in stock market generally do not trade every day. If investors trade their stocks every day, they are charged to tremendous amount of fee for trade. Market timing is an investment strategy

International Journal of Computer Engineering and Technology (IJCET), ISSN 0976-6367(Print), ISSN 0976 - 6375(Online), Volume 4, Issue 6, November - December (2013), IAEME

which is used for the purpose of obtaining the excess return. Traditionally excess return is achieved by switching. For this reason, the trend toward automatic learning systems is particularly evident in the financial services sector. Advances in chaos theory provide the theoretical justification for constructing nonlinear models, which is typically the goal in machine learning. Previous studies on this issue suggest that artificial intelligence techniques such as artificial neural networks (ANN) have more frequent chances to detect nonlinear patterns in stock market (H. Ahmadi, 1990; K.Kamijo, 1990; T. Kimoto, 1990). ANN, however, has a drawback that the users of the model can not readily comprehend the final rules. In this paper, the buying or selling of trading rule which would have yield the highest return over a certain time period using historical data is explained. Section 2 describes the literature survey on Genetic Algorithms and Technical Analysis .Section 3 deals with Stock forecasting using Genetic Algorithms is explained and finally section 4 the conclusion. 2. LITERATURE REVIEW 2.1 Genetic Algorithms John Holland of the university of Michigan, Ann Arbor, first conceived the concept of a Genetic Algorithm (GA). Thereafter, he and his students have contributed much to the development of the field. In India, we recognize the use of GAs in various fields. There is a research laboratory in Indian Institute of Technology Kanpur called as Kanpur Genetic Algorithms Laboratory (KanGAL). GAs are general purpose, parallel search techniques for solving complex problems. Based upon genetic and evolutionary principles, GAs work by repeatedly modifying a population of artificial structures through the application of genetic operators. GAs require only fitness information, not gradient information or other internal knowledge of a problem. GAs have traditionally been used in optimization but, with a few enhancements, can perform classification and prediction as well. GAs offers several advantages over traditional parameter optimization techniques. Given a non-differentiable or otherwise ill-behaved problem, many traditional optimization techniques are of no use. Since GAs do not require gradient information, they can be used in such situations. In addition, GAs are designed to search highly nonlinear spaces for global optima. While traditional optimization techniques are likely to converge to a local optimum once they are in its vicinity, GAs conduct search from many points simultaneously, and are therefore more likely to find a global optimum. A further advantage is that GAs are inherently parallel algorithms, meaning that their implementation on multiple machines or parallel machines is straightforwardly accomplished by dividing the population among the available processors. Finally, GAs are adaptive algorithms, capable, in theory, of perpetual innovation. First examine how a traditional GA performs optimization. In optimization, the goal is ideally to find the best possible solution to a problem. For real-world problems, one does not usually know the best possible solution. Therefore, a more realistic objective is to find a good solution or, given a current benchmark, to search for a better solution. A GAs fitness function measures the quality of any particular solution. The traditional GA begins with a population of n randomly generated structures, where each structure encodes a solution to the task at hand. The GA proceeds for a fixed number of generations, or until it satisfies some stopping criterion. During each generation, the GA improves the structures in its current population by performing selection, followed by crossover, followed by mutation. After a number of generations, the GA converges, meaning that all structures in the population become identical or nearly identical. The user typically chooses the best structure of the last population as the final solution. The working principle of a GA can be shown as a flow chart like below.


International Journal of Computer Engineering and Technology (IJCET), ISSN 0976-6367(Print), ISSN 0976 - 6375(Online), Volume 4, Issue 6, November - December (2013), IAEME

Initialize Population






The main operators used in genetic algorithms are 1. Selection: It is the population improvement or survival of the fittest operator. Basically, it duplicates structures with higher fitnesss and deletes structures with lower fitnesss. 2. Crossover: when combined with selection, results in good components of good structures combining to yield even better structures. Crossover forms n/2 pairs, randomly without replacement, from the n elements of its input population. Each pair advances two offspring structures to the mutation stage. The offspring are the results of cutting and splicing the parent structures at various randomly selected crossover points. The crossover stage advances a total of n elements to the mutation stage. 3. Mutation: It creates new structures that are similar to current structures. With a small, prespecified probability, mutation randomly alters each component of each structure. The mutation stage advances n elements to the selection stage of the next generation, completing the cycle. A Simple Generational GA Randomly generate a population of chromosomes Decode each chromosome to get an individual Evaluate the fitness of each individual Generate a new population using selection, crossover and mutation operations on the fittest individuals. 5. Repeat steps 2, 3 and 4 until a stop condition is true. The above steps can be explained by considering a maximization problem as below Example : Find the maximum value of x for which y=2x will not exceed 32. Solution: The genetic algorithm parameters are: Assume, the probability of Crossover Pc=1 (i.e. all chromosomes will participate in crossover).The probability of Mutation Pm=0 (i.e. no chromosome will participate in mutation).The length of the variable x is 4bits.

1. 2. 3. 4.

International Journal of Computer Engineering and Technology (IJCET), ISSN 0976-6367(Print), ISSN 0976 - 6375(Online), Volume 4, Issue 6, November - December (2013), IAEME

The fitness function can be determined as, Since the value of y (i.e. 2x) should not exceed 32 means x should be less than or equal to log232 (i.e. 5). The fitness value should increase while reaching towards 5 and it should decrease when its going away from 5. So the fitness function can be defined as F=max(5-|5-x|). Step1: Generate random chromosomes We should generate random chromosomes using any random generator function Assume the random generated numbers are 4, 2, 8, 12, 3. Step2: Decode each chromosome into binary form to get the initial population So initial population is 0 0 1 1 0 1 0 0 1 0 0 1 0 0 1 0 0 0 0 1 (4) (2) (8) (12) (3)

Step3: Evaluate the fitness of each individual Initial population 0 1 0 0 0 1 1 0 0 1 1 0 0 0 1 Fitness Value 5-|5-4|=4 5-|5-2|=2 5-|5-8|=2 5-|5-12|=-2 5-|5-3|=3.

0 0 0 0 1

(4) (2) (8) (12) (3)

Step4: We should apply selection, crossover, and mutation operators to get the new generation Selection: We should select only those chromosomes, which are having highest fitness value for the crossover operation Population 1 0 0 1 0 1 0 0 Fitness (4) (3) (2) (8)

0 0 0 1

0 1 0 0

4 3 2 2

Crossover: Select n/2 (i.e. 4/2=2) pairs randomly for crossover Select the following chromosomes for crossover 0 1 0 0 0 0 1 1 Select a random crossover point and swap the right hand side elements. 0 1 0 0 0 0 1 1

International Journal of Computer Engineering and Technology (IJCET), ISSN 0976-6367(Print), ISSN 0976 - 6375(Online), Volume 4, Issue 6, November - December (2013), IAEME

New chromosomes for mutation are 0 1 0 1 0 0 1 0 Select the following chromosomes for another crossover 0 0 1 0 1 0 0 0 Again Select a random crossover point and swap the right hand side elements. 0 0 1 0 1 0 0 0 New chromosome pair for mutation is 0 0 0 0 1 0 1 0 Mutation: since in our problem Pm is 0, there is no need for mutation operator The population for next generation is 0 0 0 1 1 0 0 0 0 1 0 1 1 0 0 0 (5) (2) (0) (2)

The fitness values for this population are Population fitness 0 1 0 1 (5) 5 0 0 1 0 (2) 2 0 0 0 0 (0) 0 1 0 1 0 (2) 2 The best solution after first generation is of fitness 5 and the value of x is 0101 (i.e 5). This is how the GA works in solving optimization problems. 2.2 Technical Analysis There are two major types of analysis for predicting the performance of a company's stock fundamental and technical. The latter looks for peaks, bottoms, trends, patterns and other factors affecting a stock's price movement and then making a buy / sell decision based on those factors. It is a technique that many people attempt though very few are truly successful. Today, the world of technical analysis is huge. There are literally hundreds of different patterns and indicators investors claim to be successful. What is Technical Analysis? Technical Analysis is a method of evaluating securities by analyzing statistics generated by market activity, past prices, and volume. Technical analysts do not attempt to measure a security's intrinsic value instead they look for patterns and indicators on stock charts that will determine a stocks future performance. Technical analysis has become popular over the past several years, as more and more people believe that the historical performance of a stock is a strong indication of future performance. The use of past performance should not come as a big surprise. People using fundamental analysis have always looked at the past performance by comparing fiscal data from previous quarters and years to determine future growth. The difference lies in the technical analysts belief that securities move


International Journal of Computer Engineering and Technology (IJCET), ISSN 0976-6367(Print), ISSN 0976 - 6375(Online), Volume 4, Issue 6, November - December (2013), IAEME

with very predictable trends and patterns. These trends continue until something happens to change the trend, and until this change occurs, price levels are predictable. Some technical analysts claim they can be extremely accurate a majority of the time. There are many instances of investors successfully trading securities with only the knowledge of its chart and without even understanding what the company does. Technical analysis is a terrific tool, but most agree that it is much more effective when combined with fundamental analysis. Let's now look at some of the major indicators that the technical analysts use. Bar Chart Bar charts are some of the most popular type of charts used in technical analysis. As illustrated in the below, the top of the vertical line indicates the highest price a security traded at during the day and the bottom represents the lowest price. The closing price is displayed on the right side of the bar and the opening price is shown on the left side of the bar. A single bar like the one to the left represents one day of trading. The advantage of using a bar chart over a straight-line graph is that it shows the high, low, open and close for each particular day. High Close

Open Low Candle Stick Charting Candlestick charts have been around for hundreds of years. They are often referred to as "Japanese Candles" because the Japanese would use them to analyze the price of rice contracts. Similar to a bar chart, candlestick charts also display the open, close, daily high, and daily low. The difference is the use of color to show if the stock was up or down over the day.

High Open/close Body is red if stock closed Body is green if stock closed higher

Lower Open/close Low

The Moving Averages Moving averages are one of the oldest and most popular technical analysis tools. A moving average is the average price of a security at a given time. When calculating a moving average, you specify the time span to calculate the average price (e.g., 25 days).


International Journal of Computer Engineering and Technology (IJCET), ISSN 0976-6367(Print), ISSN 0976 - 6375(Online), Volume 4, Issue 6, November - December (2013), IAEME

A "simple" moving average is calculated by adding the security's prices for the most recent "n" time periods and then dividing by "n." For example, adding the closing prices of a security for most recent 25 days and then dividing by 25. The result is the security's average price over the last 25 days. This calculation is done for each period in the chart. Note that a moving average cannot be calculated until you have "n" time periods of data. For example, you cannot display a 25-day moving average until the 25th day in a chart. The general assumption behind all moving averages is that once the stock price moves above the average that it may substantial momentum behind it and is worth buying. The opposite is true, if the price of a security moves below the moving average. It's a pretty simple approach to technical analysis, perhaps the simplest of them all, but plain and simply it works, and it is the base for many other much more complicated indicators. Different versions of moving average Exponential Moving Average (EMA) - are calculated by applying a percentage of today's closing price to yesterday's moving average value. Use an exponential moving average to place more weight on recent prices. Moving Average Convergence Divergence (MACD) - The "MACD" is a trend following momentum indicator that shows the relationship between two moving averages of prices. To Calculate the MACD, subtract the 26-day EMA from a 12-day EMA. A 9-day dotted EMA of the MACD called the signal line is then plotted on top of the MACD. There are 3 common methods to interpret the MACD: Crossovers - When the MACD falls below the signal line it is a signal to sell and vice versa when the MACD rises above the signal line. Divergence - When the security diverges from the MACD it signals the end of the current trend. Overbought/Oversold - When the MACD rises dramatically (shorter moving average pulling away from longer term moving average) it is a signal the security is overbought and will soon return to normal levels. Other less common moving averages include triangular, variable, and weighted moving average. All of them being slight deviations from the ones above and are used to detect different characteristics such as volatility, and weighting different time spans. Price Rate - of Change (ROC) The Price Rate-of-Change ("ROC") indicator displays the difference between the current price and the price x-time periods ago. The difference can be displayed in either points or as a percentage. The ROC displays the wave-like motion in an oscillator format by measuring the amount that prices have changed over a given time period. As prices increase, the ROC rises; as prices fall, the ROC falls. The greater is the change in price, the greater the change in the ROC. The time period used to calculate the ROC may range from 1-day (which results in a volatile chart showing the daily price change) to 200-days (or longer). The most popular time periods are the 12- and 25-day ROC for short to intermediate-term trading. The 12-day ROC is an excellent short- to intermediate-term overbought/oversold indicator. The higher the ROC, the more overbought the security; the lower the ROC, the more likely a rally.

International Journal of Computer Engineering and Technology (IJCET), ISSN 0976-6367(Print), ISSN 0976 - 6375(Online), Volume 4, Issue 6, November - December (2013), IAEME

Relative Strength Index (RSI) RSI was developed by Welles Wilder as an oscillator to gauge overbought/oversold levels. RSI is a rescaled measure of the ratio of average price changes on up days to average price changes on down days. The most important thing to understand about RSI is that a level above 70 indicates a stock is overbought, and a level below 30 indicates that it is oversold (it can range from 0 to 100) Also, realize that stocks can remain overbought or oversold for long periods of time, so RSI alone isnt always a great timing tool. Williams %R Williams %R is a momentum indicator. This is also an indicator which is plotted upside down on a scale using negative numbers. For interpretation purposes it is the absolute value which counts so disregard the negative sign. The indicator itself measures overbought and oversold levels. The calculation is as follows: [(Highest High in n periods minus today's close) divided by (Highest High in n periods minus Lowest Low in n periods)] * (times) -100. Always wait for a change in the security's price before taking action based on an oversold/overbought indicator like Williams %R. This is because overbought/oversold indicators tend to be leading indicators in that they turn before the security. Oversold readings tend to occur in the 80 to 100 range and overbought readings tend to occur in the 0 to 20 range. Stochastic oscillator The stochastic oscillator compares where a security's price has closed relative to its price range over a specifically identified period of time. George Lane, who developed this indicator, theorized that in an upwardly trending market, prices tend to close near their high; and during a downward trending market, prices tend to close near their low. Further, as an upward trend matures, price tends to close further away from its high; and as a downward trend matures, price tends to close away from its low. The stochastic indicator attempts to determine when prices start to cluster around their low of the day for an up-trending market, and when they tend to cluster around their high in a downtrending market. Lane's theory is these are the conditions, which indicate a trend reversal is beginning to occur. The stochastic indicator is plotted as two lines. They are the %D line and the %K line. The %D line is more important than the %K line. The stochastic is plotted on a chart with values ranging from 0 to 100. The value can never fall below 0 or above 100. Readings above 80 are strong and indicate that price is closing near its high. Readings below 20 are strong and indicate that price is closing near its low. Ordinarily, the %K line will change direction before the %D line. However, when the %D line changes direction prior to the %K line, a slow and steady reversal is usually indicated. When both %K and %D lines change direction, and the faster %K line subsequently changes direction to retest a crossing of the %D line, but doesn't cross it, this is a good confirmation of the stability of the prior reversal. A very powerful move is underway when the indicator reaches its extremes around 0 and 100. Following a pullback in price, if the indicator retests these extremes, a good entry point is indicated. Many times, when the %K or %D lines begin to flatten out, this is an indication that the trend will reverse during the next trading range. Quite often, divergence's set up on the chart. That is, price may be making higher highs, but the stochastic oscillator is making lower lows. Or conversely, price may be making lower highs, and


International Journal of Computer Engineering and Technology (IJCET), ISSN 0976-6367(Print), ISSN 0976 - 6375(Online), Volume 4, Issue 6, November - December (2013), IAEME

the stochastic oscillator is making higher highs. In either case, the indicator usually is demonstrating a change in price before price itself is changing. The formula for %k is as follows: %K = 100[(C - L5close)/(H5 - L5)] Where: C = the most recent close L5 = the lowest low for the last 5 trading periods H5 = highest high for the same five trading periods %D is a smoothed version of the %K line. Usually, 3 periods is used. The %K are as follows: %D = 100 X (H3/L3) Where: H3 = the 3 period sum of (C - L5) L3 = the 3 period sum of (H5 - L5)


Commodity Channel Index A description of the formula is as follows: 1. Calculate each periods mean. This is the high, plus the low, plus the close, divided by 3. 2. Calculate the n period simple moving average of these means, its recommend to use 52 weeks as the period for n. 3. From each periods mean price, subtract the n period simple moving average of mean prices. 1. Compute the mean deviation. This is the difference between each period's mean price and the n period simple moving average of those mean prices. 2. Multiply the mean deviation by .015 3. The mean price, which we calculated in step three, is divided by .015 times the mean deviations from step 5. Ordinarily, CCI ranges in value from +100 to -100. The rules are to buy and go long when CCI crosses above +100 and close the long when CCI falls back below +100. Conversely, sell short when CCI crosses below -100 and close the short when CCI crosses back above -100. Linear Regression Linear regression is a statistical tool used to measure trends. Linear regression uses the least squares method to plot the line. The linear regression line is a straight line extending through the prices. The formula for linear regression is as follows: y = a + bx , where y = the closing price x = the total number of time periods a = y - bx divided by n b = n(xy) - (x)(y) divided by nx2 - (x)2 There are two primary ways to use linear regression. The first is to trade in the direction of the linear regression line. Colby and Meyers found that trading in this manner provided good results using a 66 week figure for n. The only drawback was a large drawdown in relation to the profitable trades. The second way to trade using linear regression is to plot the linear regression line. Then plot two parallel lines to the linear regression line - one above and one below - the linear regression line.

International Journal of Computer Engineering and Technology (IJCET), ISSN 0976-6367(Print), ISSN 0976 - 6375(Online), Volume 4, Issue 6, November - December (2013), IAEME

These should be equidistant from the linear regression line. To determine the distance, use a point, which is the furthest away from the linear regression line on a price bar. These two lines form a linear regression channel. The two lines act as support and resistance. Once the lines are broken for a sustained period of time, this is an indication that the trend has reversed or gained tremendous momentum. A stock which is moving slightly upward or downward for a period of time which suddenly moves outside the channel in the same direction of the previous move is showing signs that it will continue the move. A stock which was trending upward or downward and has changed direction and broken the opposite channel for a sustained period is showing signs that the trend will probably continue. The space inside the channel is where equilibrium exists. This is the area in which prices can be expected to deviate from the original linear regression line. What I have found is that generally, when prices move outside or to the extreme channel line, price tends to move back to the opposite channel line. De-trended Price Oscillator The De-trended Price Oscillator is a technical indicator that smoothes the trend in prices. When price is de-trended using the de-trended price oscillator, many technicians believe that cycles and overbought and oversold levels can be more easily identified. The principal is similar to using longer length technical indicators rather than shorter length technical indicators. It removes some of the 'noise'. To calculate the de-trended price oscillator an x-period moving average is centered. This is done by shifting the moving average back [(x/2) + 1] period. This centered moving average is then subtracted from the close. Because it is set up as an oscillator, it will cross above and below zero. The last [(x/2) + 1] period will have no value. This is because the de-trended price oscillator is shifted back [(x/2) + 1] period. The de-trended price oscillator may recognize underlying cyclical movements in price. 3. FORECASTING USING GENETIC ALGORITHMS In this section, how to forecast the market with the help of genetic algorithms and market indicators is explained. Genetic algorithms are very much useful to find the best possible solution in a given search space. Time series forecasting is the biggest task in financial forecasting. Genetic algorithms are useful to find out the best time series. The financial indicators will helpful to find out the actual financial position. The steps involved in financial forecasting are 1. Evaluate the financial parameters or indicators for the given financial data. 2. Categorize the indicators/parameters so that all will show the same type/range of category. 3. Apply genetic algorithm to find out the best financial indicators/parameters will follow the latest financial data. 4. Analyze the financial parameters/indicators that are predicted in the above step to get the actual financial position. Application: Stock market / Individual stock Forecasting For a given collection of historical data pertaining to a stock, the task is to predict the future performance of that stock. The prediction can be made from 1day to any number of days depending upon the availability of data.


International Journal of Computer Engineering and Technology (IJCET), ISSN 0976-6367(Print), ISSN 0976 - 6375(Online), Volume 4, Issue 6, November - December (2013), IAEME

The steps involved in the prediction of individual stock is as follows 1. Evaluation of stock indicators The stock indicators like Moving Average Convergence Divergence (MACD), Price Rate of Change (ROC), Williamss %R, Relative Strength Index (RSI), Price to Earnings Ratio (P/E) etc should calculate. I had taken MACD, ROC and %R as my stock indictors and calculated the values for all the days. 2. Categorization of indicators I categorize the evaluated stock indicators into four categories based on the indicator signal as follows 0- if there is a perfect buy signal. 1- if there is a partial buy signal. 2- if there is a partial sell signal. 3- if there is a perfect sell signal. MACD values are categorized into above 4 categories like below If MACD > 102 indicator = 0 Else if MACD > 100 indicator = 1 Else if MACD > 98 indicator = 2 Else indicator = 3. ROC values are categorized into 4 categories like below If ROC > 105 indicator = 0 Else if ROC > 100 indicator = 1 Else if ROC > 95 indicator = 2 Else indicator = 3. Williamss %R-values are categorized into above 4 categories like below If %R < 20 indicator = 0 Else if MACD < 50 indicator = 1 Else if MACD < 80 indicator = 2 Else indicator = 3. The above indicator values are useful to run the genetic algorithm. 3. Prediction using Genetic Algorithm Before applying Genetic Algorithm we have to define the following genetic parameters. Initial Population: - The indicator values, which are categorized above are selected as initial population. Select a random population that indicates the categorized values. For example 0 2 2, 1 2 3, 1 2 1..etc are initial population. Fitness Function: - We know the importance of a fitness function in genetic algorithm as goal finder. We should clearly define the fitness function before applying genetic algorithm. The fitness function in our stock market prediction is the number of times the population sequence available in the database following the latest sequence. We can give the fitness function as: If today sequence = 123 and population chromosome =121 then search the database for how many times the sequence 121 follows 123, the number of times will be the fitness value. Crossover: - Take any two chromosomes in the population and apply crossover function. There are different crossover techniques are available, some of them are one point crossover and two-point crossover.

International Journal of Computer Engineering and Technology (IJCET), ISSN 0976-6367(Print), ISSN 0976 - 6375(Online), Volume 4, Issue 6, November - December (2013), IAEME

Mutation: -One way of applying mutation is select two random positions and swap the values at those two positions. Here we have very less number of parameters, so mutation could not give much effect. We can explain this problem as, If we have a chromosome after cross over as say 221 and we got random positions as 1&2 i.e values 2&2, even if we interchange the values no change will come in the chromosome. This problem will come even if all the elements in the chromosome are equal. The above problem will yield to local optima, in which the search space is limited to a certain area for different generations. To avoid the above problem we have to select a mutation technique that will change the values at selected locations. I defined the mutation operator as follows: Select one (or more) element at random position and then increase the element value by one and apply modulus operator to fit the data into predefined range. Now apply the following genetic algorithm with the above-defined parameters 1. Randomly generate a population of chromosomes 2. Evaluate the fitness of each individual 3. Select the fitted individuals 4. Generate a new population using selection, crossover and mutation operations on the fittest individuals. Repeat steps 2, 3 & 4 till the given number of generations reached.

4. Analysis of predicted indicators The predicted values in the above step are not sufficient to take a decision. The indicators are showing values like 0,1,2,3 for perfect buy, partial buy, partial sell, perfect sell signals respectively. Sometimes we may get one indicator showing perfect sell and other with perfect buy, its important to take a decision properly under such situations. We can analyze the indicators like below. If we have 3 indicators, for getting perfect buy signal from all the indicators the sum of the indicator values must be 0, for partial buy signal the sum of indicator values must be 3, for partial sell signal the sum of indicator values must be 6, for perfect sell signal the sum of indicator values must be 9. Based on the above analysis we can decision as If Sum of Indicator Values are from 0 to 3 then buy that stock. If Sum of Indicator Values are from 4 & 5 then dont take any decision. If Sum of Indicator Values are from 6 to 9 then sell that stock. From this type of analysis sometimes we are in a position to take decision like if sum of indicator values equals to 4 & 5 in above analysis. In this type of situations we can take decision by prioritizing the indicators. 4. CONCLUSION In this paper, the buying or selling of trading rule which would have yield the highest return over a certain time period using historical data is explained. Although the trading systems that have worked well in the past seem to have a reasonable chance of doing well in the future, we need a more extensive validation process because the future is never exactly as the past. We are working towards verifying and enhancing the trading rules using current data.


International Journal of Computer Engineering and Technology (IJCET), ISSN 0976-6367(Print), ISSN 0976 - 6375(Online), Volume 4, Issue 6, November - December (2013), IAEME

REFERENCES 1. 2. 3. 4. 5. Ahmadi, H., Testability of the arbitrage pricing theory by neural networks ,Proceedings of the IEEE International Conference on Neural Networks, 1990, pp.1385-1393. L. Davis, Handbook of genetic algorithms, Van Nostrand Reinhold, NY, 1991. Y. Hiemstra, Modeling structured nonlinear knowledge to predict stock market returns, In Trippi, R. R. (Eds.), Chaos & Nonlinear Dynamics in the financial Markets: Theory, Evidence and Applications, Irwin, 1995, pp. 163-175. K. Kohara, Ishikawa T., Fukuhara Y. and Nakamura Y., Stock price prediction using prior knowledge and neural networks, International Journal of Intelligent Systems in Accounting, Finance and Management, vol. 6, 1997, pp. 11-22. Arun K Punjari Data mining techniques universities press (India) Pvt. Ltd. 2001. K. Kamijo and Tanigawa T., Stock price pattern recognition: A recurrent neural network approach Proceedings of the IEEE International Joint Conference on Neural Networks, 1990, pp. 1215-1221. T. Kimoto, Asakawa K., Yoda M. and Takeoka M., Stock market prediction system with modular neural networks, Proceedings of the IEEE International Joint Conference on Neural Networks, 1990, pp. 11-16. R. Tsaih, Hsu, Y. and Lai C. C., Forecasting S&P 500 Stock index futures with a hybrid AI system, Decision support Systems, 1998, pp. 161-174. G. Waksman, Sandler M., Ward M. and Firer C., Market timing on the Johannesburg Stock Exchange using derivative instruments, Omega, International Journal of Management Science, Vol.25, No. 1, 1997, pp. 81-91. R. R. Trippi, and DeSieno D., Trading equity index futures with a neural network, The Journal of Portfolio Management, 1992. L.S. Duke and Long, J., Neural network futures trading - A feasibility study, Adaptive Intelligent Systems, Elsevier Science Publishers, 1993. David de la Fuente, Alejandro Garrido, Jaime Laviada, Alberto Gomez, Genetic Algorithms to Optimize the Time to Make Stock Market Investment. GECCO 2006, Vol.2, pp.18571858, 2006. Cyril Schoreels, Brian Logan, Jonathan M.Garibaldi, Agent based Genetic Algorithm Employing Financial Technical Analysis for Making Trading Decisions Using Historical Equity Market Data, IAT04, 2004. K. V. Sujatha and S. Meenakshi Sundaram, Regression, Theils and MLP Forecasting Models of Stock Index, International Journal of Computer Engineering & Technology (IJCET), Volume 1, Issue 1, 2010, pp. 82 - 91, ISSN Print: 0976 6367, ISSN Online: 0976 6375. Ashwini Pravin Navghane and Dr.Pradeep Mitharam Patil, Forecasting Stock Market Movement: A Neural Network Approach, International Journal of Electronics and Communication Engineering & Technology (IJECET), Volume 4, Issue 5, 2013, pp. 117 - 125, ISSN Print: 0976- 6464, ISSN Online: 0976 6472. Viddulata. A. Patil and Prof. Satyawan. R. Jagtap, Genetic Programming for Object Localization using Fitness Function Based on Relative Localization Weighted F-Measure, International Journal of Computer Engineering & Technology (IJCET), Volume 3, Issue 2, 2012, pp. 659 - 666, ISSN Print: 0976 6367, ISSN Online: 0976 6375.

6. 7.


9. 10.

11. 12. 13.