Stock Prices prediction using Artificial Neural Networks Ajay Kamat Flat 2, Jaysagar 2, Navy Colony Liberty Garden, Malad west, Mumbai – 400064 +919833796261 [email protected] com ABSTRACT The aim of this research paper is to facilitate prediction of the closing price of a particular stock for a given day. A thorough analysis of the existing models for stock market behavior and different techniques to predict stock prices was carried out. These included the renowned Efficient Market Hypothesis and its rival, the Chaos Theory. It was found that the Chaos Theory is the best model for modeling the behavior of a stock market.
Chaos is a nonlinear process which appears to be random, i. e. there is an order-disorder relation between the various parameters affecting the process. Chaos theory is an attempt to show that order does exist in apparent randomness, and can be expressed mathematically. The problem domain required a model which could deal with uncertain, fuzzy, or insufficient data which fluctuate rapidly in very short periods of time. Hence an Artificial Intelligence approach was selected which could adapt to dynamic systems like the stock market.
The model had to make systematic use of hints in the learning-from-examples approach. Artificial Neural Networks represent a general class of non-linear models that has been successfully applied to a variety of problems, with special emphasis on prediction of a time series. The ability of Neural Networks to effectively map non-linear relationships in input data proved to be a useful characteristic. With this in mind, there was an attempt to study similar systems that have been practically and successfully implemented elsewhere, albeit on a much larger scale.
These included the models developed for the Tokyo Stock Exchange and the Johannesburg Stock Exchange. The former adopted a clustering approach using Self-Organizing Maps based on the Kohonen Model, while the latter implemented the system using a Multi-Layer Feedforward Network using the Error-Backpropagation training algorithm. A Multi-Layer Perceptron was selected to implement the system and used the method of gradient descent to train the network. The credibility of the Chaos Theory is proved if the Neural Network can outperform the market by consistently predicting stock prices.
Thus two tasks was accomplished simultaneously; that of validating the Chaos theory and establishing a possibility to build sophisticated large-scale implementations that would prove to be cutting-edge for the investors in the long run. 1. INTRODUCTION From the beginning of time it has been man’s common goal to make his life easier. The prevailing notion in society is that wealth brings comfort and luxury, so it is not surprising that there has been so much work done on ways to predict the markets. Various technical, fundamental, and statistical indicators have been proposed and used with varying results.
However, no one technique or combination of techniques has been successful enough to consistently “beat the market”. With the development of neural networks, researchers and investors are hoping that the market mysteries can be unraveled. Forecasting values of an asset gives, besides straightforward profit opportunities, indications to compute various interesting quantities such as the price of derivatives (complex financial products) or the probability for an adverse mode which is the essential information when assessing and managing the risk associated with a portfolio investment.
Forecasting the price of a certain asset (stock index, foreign currency, etc. ) on the ground of available historical data corresponds to the well known problem in science and engineering of time series prediction. While many time series may be approximated with a high degree of confidence, financial time series are found among the most difficult to be analyzed and predicted. 1. 1Basics of the stock market Stock is a share in the ownership of a company. Stock represents a claim on the company’s assets and earnings. Holding a company’s stock means that you are one of the many owners (shareholders) of a company, and, as such, you ave a claim (albeit usually very small) to everything the company owns. The value of a company is its market capitalization, which is the stock price multiplied by the number of shares outstanding. For example, a company that trades at Rs. 100 per share and has 1,000,000 shares outstanding has a lesser value than a company that trades at Rs. 50 but has 5,000,000 shares outstanding (Rs. 100 x 1,000,000 = Rs. 100,000,000 while Rs. 50 x 5,000,000 = Rs. 250,000,000). The purpose of a stock market is to facilitate the exchange of securities between buyers and sellers, thus reducing the risks of investing.
Stock prices change everyday by market forces. This implies that share prices change because of supply and demand. If more people want to buy a stock (demand) than sell it (supply), then the price moves up. Conversely, if more people wanted to sell a stock than buy it, there would be greater supply than demand, and the price would fall. Understanding supply and demand is easy. What is difficult to comprehend is what makes people like a particular stock and dislike another stock. This comes down to figuring out what news is positive for a company and what news is negative.
The price of a stock doesn’t only reflect a company’s current value; it also reflects the growth that investors expect in the future. The most important factor that affects the value of a company is its net earnings. Net earnings are the profit a company makes, and in the long run no company can survive without them. It makes sense when you think about it. If a company never makes money, they aren’t going to stay in business. Public companies are required to report their earnings four times a year (once each quarter). Wall Street watches with rabid attention at these times, which are referred to as earnings seasons.
The reason behind this is that analysts base their future value of a company on their earnings projection. If a company’s results surprise (are better than expected), the price jumps up. If a company’s results disappoint (are worse than expected), then the price will fall. Of course, it’s not just earnings that can change the sentiment towards a stock (which, in turn, changes its price). It would be a rather simple world if this were the case! During the dot-com bubble, for example, dozens of Internet companies rose to have market capitalizations in the billions of dollars without ever making even the smallest profit.
As we all know, these valuations did not hold, and most all Internet companies saw their values shrink to a fraction of their highs. Still, the fact that prices did move that much demonstrates that there are factors other than current earnings that influence stocks. Hence in essence every type of news, good or bad which is related to a stock affects the price of the stock. The key aspect here is to quantify the impact of the news on the price of the particular stock. 1. 2Analyzing the price movements of stocks So, why do stock prices change?
The best answer is that nobody really knows for sure. Some believe that it isn’t possible to predict how stocks will change in price while others think that by drawing charts and looking at past price movements, you can determine when to buy and sell. The only thing we do know, as a certainty is that stocks are volatile and can change in price extremely rapidly. Financial theorists define stock price as the present value of all future earnings expectations for the company, divided by its number of shares outstanding. In essence the earning capacity of the company is what defines price.
Even companies that lose money today can have a high share price because price is based on the future earnings of the company. So long as there is the potential for future revenue streams to shareholders, there will be a price that someone is willing to pay for the shares. The earnings that a company could make in the future, the growth that the company could realize and the time to the realization of those goals are all factors which affect the estimate that the market makes on the earnings potential of the company. The following factors influence the price of a stock: . 2. 1Information Information is the key, as it gives the market a reason to value a stock at a particular price level. The market will price a stock based on all information that the public is aware of. As new information comes into the public realm, the market will adjust prices up or down based on how the market perceives the information will influence the future earnings capacity of the company. The key thing is to quantify the impact the information on the price of the stock. It can make moves more extreme than they should be.
However, often the power to this amplifier is pulled and the stock moves back to where it should reside based on the information that is known about the company. 1. 2. 2Investor Sentiment Humans are behind the trading activity of the stock market. That means human characteristics also have an impact on the movement of the stock prices. Sentiments such as fear and greed present incorrect valuations in the market that can exist for relatively short periods of time but long enough for smart investors to capitalize on. Emotion in the market can be viewed as an amplifier for new information. 1. 2. 3Supply and Demand
The price movement of a stock is also determined by the supply and demand dynamics of the stock. The SUPPLY is the number of shares offered for sale at anyone one moment. The DEMAND is the number of shares investors wish to buy at exactly that same time. Stock is always purchased with the anticipation that it will rise in value. Stock is always sold with the anticipation that it will fall in value or at least no longer rise. A high demand for stock is created from a widely held belief that it will be worth more in the future. This is what is generally called buying pressure. This would lead to a shortage of the stock, i. . more buyers than sellers at a given price. Speculation is always about the future, not the past or present. If there is no belief that a stock’s value will increase in the future there is no incentive to hold the stock. This is known as selling pressure. This would lead to a surplus of the stock, i. e. more sellers than buyers at a given price. The market price continually adjusts the stock price to eliminate any shortages or surpluses of that stock. An increase in demand for a stock, determined by speculation of future value, will cause by itself, the rise in price that is anticipated.
A stock price movement therefore by definition is a self fulfilling prophecy. Consider an investor who buys into a company because he thinks its stock will raise in value. Others, just like him, buy into the stock for the same reasons. The result is an increase in demand, hence an increase in price, the very thing they were anticipating. Note that the speculative investor, and not the company’s fundamentals, drove up the value of the stock. Hence in essence we can assert that 1. At the most fundamental level, supply and demand in the market determine stock price. 2.
Price times the number of shares outstanding (market capitalization) is the value of a company. Comparing just the share price of two companies is meaningless. 3. Theoretically earnings are what affect investors’ valuation of a company, but there are other indicators that investors use to predict stock price. Remember, it is investors’ sentiments, attitudes, and expectations that ultimately affect stock prices. 4. There are many theories that try to explain the way stock prices move the way they do. Unfortunately, there is no one theory that can explain everything. . 3Role of Technology in Stock Markets Among the methods developed Econometrics as well as other disciplines, Artificial Neural Networks are being used by scientists as non-parametric regression methods. They constitute an alternative to other non-parametric regression methods like kernel regression. The advantage of using Neural Networks as non-linear function approximators is that they appear to be well suited in the areas where mathematical knowledge of the stochastic process underlying the time series is unknown and quite difficult to be rationalized.
There is a second motivation in the research and financial communities. It has been proposed in the Efficient Market Hypothesis (EMH) that markets are efficient in that opportunities for profit are discovered so quickly that they cease to be opportunities. The EMH effectively states that no system can continually beat the market because if this system becomes public, everyone will use it, thus negating its potential gain. There has been an ongoing debate about the validity of the EMH, and some researchers attempted to use neural networks to validate their claims.
There has been no consensus on the EMH’s validity, but many market observers tend to believe in its weaker forms, and thus are often unwilling to share proprietary investment systems. Neural networks are used to predict stock market prices because they are able to learn nonlinear mappings between inputs and outputs. Contrary to the EMH, several researchers claim the stock market and other complex systems exhibit chaos. Chaos is a nonlinear deterministic process which only appears random because it can not be easily expressed.
With the neural networks’ ability to learn nonlinear, chaotic systems, it may be possible to outperform traditional analysis and other computer-based methods. In addition to stock market prediction, neural networks have been trained to perform a variety of financial related tasks. As the application of neural networks in the financial area is so vast, we will be basically focusing on stock market prediction. 2. REVIEW OF LITERATURE 2. 1Artificial Neural Networks Neural Network or more appropriately Artificial Neural Network is basically a mathematical model of what goes in our mind (or brain).
The brain of all the advanced living creatures consists of neurons, a basic cell, which when interconnected produces what we call Neural Network. The sole purpose of a Neuron is to receive electrical signals, accumulate them and see further if they are strong enough to pass forward. 2. 1. 1Network Architectures The most common network architecture used is the backpropagation network. However, stock market prediction networks have also been implemented using genetic algorithms, recurrent networks, and modular networks. This section discusses some of the network architectures used and their effect on performance.
Backpropagation networks are the most commonly used network because they offer good generalization abilities and are relatively straightforward to implement. Although it may be difficult to determine the optimal network configuration and network parameters, these networks offer very good performance when trained appropriately. Genetic algorithms are especially useful where the input dimensionality is large. They allowed the network developers to automate network configuration without relying on heuristics or trial-and-error. Recurrent network architectures are the second most commonly implemented architecture.
The motivation behind using recurrence is that pricing patterns may repeat in time. A network which remembers previous inputs or feedbacks previous outputs may have greater success in determining these time dependent patterns. There are a variety of such networks which may have recurrent connections between layers, or remember previous outputs and use them as new inputs to the system (increases input space dimensionality). The performance of these networks is quite good. A self-organizing system can also be used to predict stock prices.
The self-organizing network is designed to construct a nonlinear chaotic model of stock prices from volume and price data. Features in the data are automatically extracted and classified by the system. The benefit in using a self-organizing neural network is it reduces the number of features (hidden nodes) required for pattern classification, and the network organization is developed automatically during training. One approach is to use two self-organizing neural networks in tandem; one to select and detect features of the data, and the other to perform pattern classification.
Overfitting and difficulties in training were still problems in this organization. 2. 1. 2Neuron The neuron is the basic building block of the neural network. A neuron is a communication conduit that both accepts input and produces output. The neuron receives its input either from other neurons or the user program. Similarly the neuron sends its output to other neurons or the user program. Figure 1. Neuron – A basic building block of the neural network When a neuron produces output, that neuron is said to activate, or fire. A neuron will activate when the sum if its inputs satisfies the neuron’s activation function.
Figure 2. Neuron’s activation fiunction It is interesting to note that the type of activation function used in the neural network nodes can be a factor on what data is being learned. The sigmoid function works best when learning about average behavior, while the hyperbolic tangent (tanh) function works best when learning deviation from the average. Figure 3. Sigmoid and tanh activation functions 2. 1. 3Neural Layers Neurons are often grouped into layers. Layers are groups of neurons that perform similar functions. There are three types of layers.
The input and output layers are not just there as interface points. Every neuron in a neural network has the opportunity to affect processing. Processing can occur at any layer in the neural network. The hidden layer is optional. The input and output layers are required, but it is possible to have on layer act as both an input and output layer. Figure 3. Neuron layers 2. 1. 4Method of Training The most common neural network architecture is the feed foreword back propagation neural network. This neural network architecture is very popular because it can be applied to many different tasks.
The term “feed-forward” describes how this neural network processes patterns and recalls patterns. When using a feed-forward neural network neurons are only connected forward. Each layer of the neural network contains connections to the next layer, but there are no connections back. The term “back-propagation” describes how this type of neural network is trained. Back propagation is a form of supervised training. When using a supervised training method the network must be provided with sample inputs and anticipated outputs. These anticipated outputs will be compared against the output of the neural network.
Using these anticipated outputs, errors are calculated and the weights of the various layers are adjusted backwards from the output layer all the way back to the input layer 2. 1. 5Error Backpropagation Algorithm (EBPTA) : Figure 4. Error Backpropagation Algorithm Create variables for: •the weights W and w, •the net input to each hidden and output node, neti •the activation of each hidden and output node, yi = f(neti) •the “error” at each node, ? i For Each Input Pattern k: Step 1: Forward Propagation Compute neti and yi for each hidden node, i=1,… , h: Compute netj and yj for each output node, j=1,… ,m: Step 2: Backward Propagation
Compute ? 2’s for each output node, j=1,… ,m: Compute ? 1’s for each hidden node, i=1,… ,h Step 3: Accumulate gradients over the input patterns (batch) Step 4: After doing steps 1 to 3 for all patterns, we can now update the weights: 2. 2Analytical Methods Before the age of computers, people traded stocks and commodities primarily on intuition. As the level of investing and trading grew, people searched for tools and methods that would increase their gains while minimizing their risk. Statistics, technical analysis, fundamental analysis, and linear regression are all used to attempt to predict and benefit from the market’s direction.
None of these techniques has proven to be the consistently correct prediction tool that is desired, and many analysts argue about the usefulness of many of the approaches. However, these methods are presented as they are commonly used in practice and represent a base-level standard for which neural networks should outperform. Also, many of these techniques are used to preprocess raw data inputs, and their results are fed into neural networks as input. 2. 2. 1 Technical Analysis The idea behind technical analysis is that share prices move in trends dictated by the constantly changing attitudes of investors in response to different forces.
Using price, volume, and open interest statistics, the technical analyst uses charts to predict future stock movements. Technical analysis rests on the assumption that history repeats itself and that future market direction can be determined by examining past prices. Thus, technical analysis is controversial and contradicts the Efficient Market Hypothesis. However, it is used by approximately 90% of the major stock traders. A widely used technical indicator of a stock is the Moving average. A moving average series can be calculated for any time series, but is most often applied to stock prices, returns or trading volumes.
Moving averages are used to smooth out short-term fluctuations, thus highlighting longer-term trends or cycles. A simple moving average is formed by computing the average (mean) price of a security over a specified number of periods. While it is possible to create moving averages from the Open, the High, and the Low data points, most moving averages are created using the closing price. For example: a 5-day simple moving average is calculated by adding the closing prices for the last 5 days and dividing the total by 5. The calculation is repeated for each price bar on the chart.
The averages are then joined to form a smooth curving line – the moving average line. Continuing our example, if the next closing price in the average is 15, then this new period would be added and the oldest day, which is 10, would be dropped. The new 5-day simple moving average would be calculated as follows: Over the last 2 days, the SMA moved from 12 to 13. As new days are added, the old days will be subtracted and the moving average will continue to move over time. Figure 5. An example of a 50 day and 200 day moving average
As seen from the above graph the shortcoming of the Simple Moving Average is as follows: •Rather than predicting the stock price, the Simple Moving Average follows or traces the movement of the stock price. So it projects trends in hind-sight rather than predicting trends •The smoother the graph like the 200 day SMA, the less accurate is the generalization since most of the short- to- medium term fluctuations are missed •The indicators given by the SMA largely depend on the interpretation of the graphical curves. Hence by nature, SMA is a subjective tool and therefore does not provide a quantified result.
This is exactly where Neural Networks score over technical analysis 2. 2. 2Fundamental Analysis Fundamental analysis involves the in-depth analysis of a company’s performance and profitability to determine its share price. By studying the overall economic conditions, the company’s competition, and other factors, it is possible to determine expected returns and the intrinsic value of shares. This type of analysis assumes that a share’s current (and future) price depends on its intrinsic value and anticipated return on investment.
As new information is released pertaining to the company’s status, the expected return on the company’s shares will change, which affects the stock price. The advantages of fundamental analysis are its systematic approach and its ability to predict changes before they show up on the charts. Companies are compared with one another, and their growth prospects are related to the current economic environment. This allows the investor to become more familiar with the company. Unfortunately, it becomes harder to formalize all this knowledge for purposes of automation (with a neural network), and interpretation of this knowledge may be subjective.
Also, it is hard to time the market using fundamental analysis. Although the outstanding information may warrant stock movement, the actual movement may be delayed due to unknown factors or until the rest of the market interprets the information in the same way. However, fundamental analysis is a superior method for long-term stability and growth. Basically, fundamental analysis assumes investors are 90% logical, examining their investments in detail, whereas technical analysis assumes investors are 90% psychological, reacting to changes in the market environment in predictable ways.
One of the most widely used fundamental indicator is the price to earning ratio, it compares the current price with earnings to see if a stock is over or under valued. Price-to-Earning ratio = (Market value per share)/(Earnings per share) •Generally a high P/E ratio means that investors are anticipating higher growth in the future •The p/e ratio can use estimated earnings to get the forward looking P/E ratio •Companies that are losing money do not have a P/E ratio 2. 2. 3The Efficient Market Hypothesis
The Efficient Market Hypothesis (EMH) states that at any time, the price of a share fully captures all known information about the share. Since all known information is used optimally by market participants, price variations are random, as new information occurs randomly. Thus, share prices perform a “random walk”, and it is not possible for an investor to beat the market.  Despite its rather strong statement that appears to be untrue in practice, there has been inconclusive evidence in rejecting the EMH. Different studies have concluded to accept or reject the EMH.
Many of these studies used neural networks to justify their claims. However, since a neural network is only as good as it has been trained to be, it is hard to argue for acceptance or rejection of the hypothesis based solely on neural network performance. In practice, stock market crashes, such as the market crash in October 1987,  contradict the EMH because they are not based on randomly occurring information, but arise in times of overwhelming investor fear. The EMH is important because it contradicts all other forms of analysis.
If it is indeed impossible to beat the market, then technical, fundamental or time series analysis should lead to no better performance than random guessing. The fact that many market participants can consistently beat the market is an indication that the EMH may not be true in practice. The EMH may be true in the ideal world with equal information distribution, but today’s markets contain several privileged players who can outperform the market by using inside information or other means. 2. 2. 4Chaos Theory A relatively new approach to modeling nonlinear dynamic systems like the stock market is chaos theory.
Chaos theory analyzes a process under the assumption that part of the process is deterministic and part of the process is random. Chaos is a nonlinear process which appears to be random, i. e. there is an order-disorder relation between the various parameters affecting the process. Various theoretical tests have been developed to test if a system is chaotic (has chaos in its time series). Chaos theory is an attempt to show that order does exist in apparent randomness. By implying that the stock market is chaotic and not simply random, chaos theory contradicts the EMH. 10] In essence, a chaotic system is a combination of a deterministic and a random process. The deterministic process can be characterized using regression fitting, while the random process can be characterized by statistical parameters of a distribution function. Thus, using only deterministic or statistical techniques will not fully capture the nature of a chaotic system. A neural networks ability to capture both deterministic and random features makes it ideal for modeling chaotic systems. 2. 2. 5Other Computer Techniques
Many other computer based techniques have been employed to forecast the stock market. They range from charting programs to sophisticated expert systems. Fuzzy logic has also been used. Expert systems process knowledge sequentially and formulate it into rules. They can be used to formulate trading rules based on technical indicators. In this capacity, expert systems can be used in conjunction with neural networks to predict the market. In such a combined system, the neural network can perform its prediction, while the expert system could validate the prediction based on its well-known trading rules.
In a highly chaotic and only partially understood environment, such as the stock market, this is an important factor. It is hard to extract information from experts and formalize it in a way usable by expert systems. Expert systems are only good within their domain of knowledge and do not work well when there is missing or incomplete information. Neural networks handle dynamic data better and can generalize and make “educated guesses. ” Thus, neural networks are more suited to the stock market environment than expert systems.  3. DESIGN 3. 1Target and time frame
One of the most important factors in constructing a neural network is deciding on what the network will learn. The goal of most networks is to decide when to buy or sell securities based on previous market indicators. The target of our neural network is to predict stock prices. Another decision to be made is the size of the time frame. A Neural network model for a short time frame is harder to implement than that for a longer time frame. The market noise is significant in a short time frame. The macroeconomic forces on the other hand move over long periods. However we have decided to use a short time frame. . 2Domain Expertise To build an effective predictive model of the stock market, we must be well acquainted with the factors that influence the market. Therefore a thorough investigation of the domain is required before we train the network and retrieve data. 3. 3Gathering Data The challenge is determining which indicators and input data will be used, and gathering enough training data to train the system appropriately. The input data used may be raw data on volume, price, and daily change. The input data should allow the neural network to generalize market behavior while containing limited redundant data.
The Data Collection Phase focuses on gathering indicators which can be interpreted by the Neural Network to exploit the regularity that is hidden in the apparently chaotic price trend of a given stock. The rationale for collecting the Stock price high and low for the particular day was that it gave an indication of the level of volatility in the stock. The Day’s close gives us the current evaluation of the stock. The Market close on that day gives us an indication of the current orbit of the market. 3. 4Network Training
Training a network involves presenting input patterns in a way so that the system minimizes its error and improves its performance. The training algorithm may vary depending on the network architecture, but the most common training algorithm used when designing financial neural networks is the backpropagation algorithm which has been used in this case. The most common network architecture for financial neural networks is a multilayer feedforward network trained using backpropagation. Backpropagation is the process of backpropagating errors through the system from the output layer towards the input layer during training.
Backpropagation is necessary because hidden units have no training target value that can be used, so they must be trained based on errors from previous layers. The output layer is the only layer which has a target value for which to compare. As the errors are propagated back through the nodes, the connection weights are changed. Training occurs until the errors in the weights are sufficiently small to be accepted. The major problem in training a neural network is deciding when to stop training. Since the ability to generalize is fundamental for these networks to predict future stock prices, overtraining is a serious problem.
Overtraining occurs when the system memorizes patterns and thus looses the ability to generalize. It is an important factor in these prediction systems as their primary use is to predict (or generalize) on input data that it has never seen. Overtraining can occur by having too many hidden nodes or training for too many time periods (epochs). Poor results in papers are often blamed on overtraining. However, overtraining can be prevented by performing test and train procedures or cross-validation 3. 4. 1The Train-Test-Redesign Loop Most of the process of determining the best network parameters is based on trial and error.
The different options to find the best fit for the problem have to be explored. The following steps have to be taken: The train and test procedure involves training the network on most of the patterns (usually around 80%) and then testing the network on the remaining patterns. The network’s performance on the test set is a good indication of its ability to generalize and handle data it has not been trained on. If the performance on the test set is poor, the network configuration or learning parameters can be changed. The network is then retrained until its performance is satisfactory.
Cross-validation is similar to test and train except the input data is divided into k sets. The system is trained on k-1 sets and tested on the remaining set k times (using a different test set each time). Application of these procedures should minimize overtraining, provide an estimate on network error, and determine the optimal network configuration. The amount of training data is also important. Ideally, it is desirable to have as much training data as the system can be feasibly trained with. It is desirable to have a lot of data available, as some patterns may not be detectable in small data sets.
However, it is often difficult to obtain a lot of data with complete and correct values. As well, training on large volumes of historical data is computationally and time intensive and may result in the network learning undesirable information in the data set. For example, stock market data is time-dependent. Sufficient data should be presented so that the neural network can capture most of the trends, but very old data may lead the network to learn patterns or factors that are no longer important or valuable. Finally, there are a variety of network architectures used for financial neural networks which are not trained using backpropagation.
There are different algorithms for some recurrent architectures, modular networks, and genetic algorithms which had to be considered before selecting the backpropagation training method. Regardless of the training algorithm used, all prediction systems are very sensitive to overtraining, so techniques like cross-validation should be used to determine the system error. Backpropagation is the training algorithm used for the Neural Network under consideration because it offers good generalization abilities and is relatively straightforward to implement.
Although it may be difficult to determine the optimal network configuration and network parameters, such a network can offer very good performance when trained appropriately.  3. 4. 2Generalization and Memorization We want the Feed-forward neural network to memorize the training samples it is offered. In order to check if a network is not over-trained, a number of test samples must be kept aside from the training set. With these test samples, we are able to verify whether the network is able to predict correctly. If the network renders poorly to the test set, we can be sure that the network has been over-trained.
Otherwise we can say that the network memorized the training patterns. In the following figure, an arbitrary curve fitting analogy is shown. The generalized fit is labeled G and the over-fit is labeled O. In case of over-fit, any data point outside of the training data results in a highly erroneous prediction.  Figure 6. Comparison of Generalization and Memorization To prevent the network from being over-trained, the number of inputs should be reduced. The objective is to find the function with the least inputs that fits the data adequately.
We must be careful with having too many (unimportant) inputs; the results of the training data may be very good but the performance deteriorated drastically on the test data 3. 5Network Performance A network’s performance is often measured on how well the system predicts market direction. Ideally, the system should predict market direction better than current methods with less error. Some neural networks have been trained to test the EMH. If a neural network can outperform the market consistently or predict its direction with reasonable accuracy, the validity of the EMH is questionable.
Several neural networks were developed to outperform current statistical and regression techniques. Many of the first neural networks used for predicting stock prices were to validate the EMH. The EMH, in its weakest form, states that a stock’s direction cannot be determined from its past price. Several contradictory studies were done to determine the validity of this statement. The ultimate goal is for neural networks to outperform the market or index averages. The Tokyo stock trading system outperformed the buy-and-hold strategy and the Tokyo index. As well, most of hese systems process large amounts of data on many different stocks much faster than human operators. Thus, a neural network can examine more market positions or charts than experienced traders. 3. 6Sliding Window: Time-Delay Neural Network A large performance increase can be obtained by adding “windowing”. Windowing is the process of remembering previous inputs of the time series and using them as inputs to calculate the current prediction. The standard time-delay neural network method of performing time series prediction is to induce the function ? sing any feedforward function approximating neural network architecture using a set of N-tuples as inputs and a single output as the target value of the network. This method is often called the sliding window technique as the N-tuple input slides over the full training set. Figure 7. Basic Architecture of Sliding Window It can be seen that a time-delay neural network is simply a standard network in which each processing element has been replaced by a finite impulse response filter, with the connectivity as shown in the figure.  4.
FURTHER WORK 4. 1Hedging on Exchange Rates An exchange rate is the current market price for which one currency can be exchanged for another. If the supply of a country’s currency increases, it takes more of that currency to purchase a different currency than it did before. Suppose there was a big jump in the supply of the Japanese Yen. We would expect the Japanese Yen to become less valuable relative to other currencies. So the Japanese-to-Indian Exchange rate should decrease. Each Japanese Yen would give us less Indian Rupees than it did before.
Similarly, the Indian-to-Japanese exchange rate would increase. So each Indian Rupee would give us more Japanese Yen than it did before, as a Japanese Yen is less valuable than it used to be. Figure 8. INR vs. JPY ( Source: http://www. x-rates. com/ ) The above graph shows the fluctuations between INR and JPY. According to this graph, if a Japanese investor buys an Indian stock during the first week of Feb and sells it during the third week of Feb, his net profit will be adversely affected because of the decline in JPY with respect to INR.
Hence, the fluctuations in the exchange rates do impact the earnings of the FIIs and thereby an indicator of the direction of movement of the exchange rates will assist the FII. To extend the current application for the convenience of a foreign investor, we can plan to add a module to the existing application which will be in charge of predicting the exchange rates for a given day. The final output will thus be in the foreign currency instead of INR Figure 9. Prediction of Exchange rates 4. 2Impact of International Markets In the current analysis of the factors that affect the stock price we consider only the domestic influences.
I have compared the trading patterns of the domestic market and the international markets like the Dow Jones, Nasdaq and the FOTSE. In my belief the Indian stock market is integrated with mature markets and sensitive to the dynamics in these markets in a long run. Therefore I have decided to factor in the impact of the mature international markets on the stock market in India. Therefore, in this respect, our hypothesis can be summed up as correlation between Figure 10. Impact of International Markets The data set will also contain the previous day’s close of the major international markets.
Due to this the prediction that we will make will be more in sync with the international market situation. 4. 3Live Feeds It would be interesting to investigate if the MLP may exploit regularities in the time-series of price sampled at a higher frequency rather than a daily basis. This will generate the volatility of the stock dynamicaly by capturing the intra-day fluctuations. We can obtain live feeds of a particular stock from the internet which will be fed to the MLP, thus reducing the tediousness of data preprocessing. Figure 11. BAJAJ AUTO (Source: http://charting. bseindia. com/) 5. REFERENCES 1]Simon Haykin, Neural Networks – A Comprehensive Foundation, 2nd Ed. , Asia: Pearson Education, pp. 21-34 and pp. 751-756 K. Mehrotra, C. Mohan and S. Ranka, Elements of Artificial Neural Networks, India: Penram International Publishing, pp. 136-141 and pp. 70-79 Jacek M. Zurada, Introduction to Artificial Neural Systems, 7th Ed. , India: Jaico Publishing House, 2004, pp. 185-220 T. Kimoto, K. Asakawa, M. Yoda, and M. Takeoka. Stock market prediction system with modular neural networks. In Proceedings of the International Joint Conference on Neural Networks, volume 1, pages 1–6, 1990 C. Klimasauskas. Applying neural networks.
In Neural Networks in Finance and Investing, chapter 3,pages 47–72. Probus Publishing Company, 1993. P. G McCluskey. Feedforward and recurrent neural networks and genetic programs for stock market and time series forecasting. Technical Report CS-93-36, Brown University, September 93 R. J. Frank, N. Davey, S. P. Hunt. Time Series Prediction and Neural Networks, Department of Computer Science, University of Hertfordshire, Hatfield, UK. , 1998 Stefan Zemke. On Developing a Financial Prediction System: Pitfalls and Possibilities, Stockholm University and Royal Institute of Technology, Department of Computer and System Sciences, 2000. 9]R. Timothy Edwards. An Overview of Temporal Backpropagation, Stanford University, 1991. Ramon Lawrence on Using Neural Networks to Forecast Stock Market Prices, University of Manitoba, Department of Computer Science, 1997 Dec 12. Master Thesis on Stock Price Prediction using Neural Networks, Leiden University, 1997 Aug 4. Genevieve Orr, Cs-449: Neural Networks, “Error Backpropagation. ” [Online Document], Fall 99, Available HTTP: http://www. willamette. edu/~gorr/classes/cs449/backprop. html