Вы находитесь на странице: 1из 22

1.

INTRODUCTION : Stock market prediction is the act of trying to determine the future value of a company stock or other financial instrument traded on a financial exchange. The successful prediction of a stock's future price could yield significant profit. The stock market is not an efficient market. Herding behavior is common among investors. All investors do not get all information at the same time and the time it takes to evaluate information before they act differs between investors. Many investors do not show rational behavior. Greed and fear are strong feelings and may result in panic sales and stock market bubbles. Hence, to regulate the stock market to obtain maximum profit or achieve a certain objective in general without falling prey to inconsistencies, predicting stock behavior is a pressing requirement. Prediction methodologies fall into two broad categories: fundamental analysis and technical analysis. Fundamental analysis of a business involves analyzing its income statement, financial statements and health, it management and competitive advantages, and its competitors and markets. It is more subjective compared to technical analysis. Fundamental analysis maintains that markets may misprice a security in the short run but that the "correct" price will eventually be reached. Profits can be made by trading the mispriced security and then waiting for the market to recognize its "mistake" and recalculate the security price. On the other hand, Technical Analysis is an approach that uses information of past stock behavior in order to forecast future price movements. Within the technical analysis community there exist several schools with different techniques, but they all have in common that they use price and volume history. A basic thought is that it takes time before the market reacts upon new information and that pattern often occur in price behavior which makes forecasting possible. There are several factors that explain why technical analysis works: 1. Most speculators on the market act upon fundamental analysis, so that kind of facts influence stock prices strongly. But all operators do not get this information at the same time. When there are positive news of a company, those acting immediately can buy shares for a lower price than those getting the news later. 2. Large investors such as mutual funds and banks are often not placing their whole block orders at the same time when they are buying larger quantities of securities because this would risk triggering an unnecessary high price advance. Instead, the orders are spread over a period that can last several weeks. The resulting increased purchase pressure may result in a steady advancing trend under the period the purchases continue. 3. It is more psychological stressing to go against the trend than to follow it. People are herding animals and like to do as others are doing. This is why a rising stock price is a signal in itself that the price will advance even more. Of course one has to be careful with stocks that have been rocketing, because they will often recoil.

Hence, we are trying to limit our focus to technical analysis which has time and again proved its supremacy over other methods. There are many tools available to investors using technical analysis but none of them removes entirely the element of chance from investment decisions. Large trading organizations can employ sophisticated computer systems and armies of analysts. We, as students, attempt to employ a simple set of formidable techniques to achieve the same result for the benefit of small-time investors who cannot afford to hire experts or buy costly softwares to make their investment decisions. Problem Statement and Problem Detail: The aim of this project is to help the investors by providing them with a simple and easily available Software that would predict the stock prices and its changes with respect to the technical indicators which are calculated using historical stock quotes and also analyze the data and generate reports for their better understanding. This includes developing an application with user friendly GUI. The detailed description of the problem and the functional requirements that it is expected to satisfy are highlighted below: Selection of target customers: Our customers are small-time daily or weekly investors who trade on an individual basis and who do not have the time or resources to avail of commercial forecasting services or hire agents. Selection of information to be tracked: We aim to collect and use 10 indicators or patterns for performing technical analysis and provide predictions. We also plan to provide services like RSS feeds, current stock quotes, price charts, recommendations and alerts to help our customer in making a wise investment decision. Data collection: Our major data source is the Yahoo Finance service which provides us with daily stock prices for an entire year. We mine current prices of stocks. Charting: Based on the information in the database, we plan to display the stock prices to the end-user using charts. Machine learning: The logic to recognize trends in market for past one year and make wise decisions based on statistical inference should be coded in the machine in the form of efficient algorithms. We plan to use technical indicators and neural networks to frame such algorithms. Design interface: A user-friendly interface needs to be created and hosted to aid users to get valuable information and timely recommendations and tips about dealing with their stock options.

SCOPE: Different prediction models need to be built that give a fair recommendation to the customer whether to buy/sell/hold stock. The system should train itself from a set of past data and simulate on a remaining set of test data to improve its precision. The technical analysis predicts the appropriate time to buy or sell a share. Technical analysts use charts which contain technical data like price, volume, highest and lowest prices per trading to predict future share movements. Price charts are used to recognize trends. These trends are understood by supply and demand issues that often have cyclical or some sort of noticeable patterns. To understand a company and its profitability through its share prices in the market, some parameters can guide an investor towards making a careful decision. These parameters are termed Indicators and Oscillators. This is a very popular approach used to predict the market. An artificial neural network method can also be used to predict stock prices. The input to these neural networks is obtained from the mined data obtained after applying data mining techniques on the huge available data. These data could be anything ranging from the simple past stock prices to the complex technical indicators obtained by applying complex operations on the available data.

LITERATURE REVIEW: Share Market is an untidy place for predicting since there are no significant rules to estimate or predict the price of share in the share market. A share market is a place of high interest to the investors as it presents them with an opportunity to benefit financially by investing their resources on shares and derivatives of various companies. It is a chaos system; meaning the behavioral traits of share prices are unpredictable and uncertain. Trading shares and commodities were primarily based on intuitions. A great deal of work has gone into analyzing the psychology of the stock market. Simply put, the stock market is a place, be it abstract or real, where large groups of people gather to buy and sell stocks. The dynamics of such a place is often linked with that of group psychology and many have tried to build theories of how the stock market functions based on the psychology of large groups. The Efficient Market Hypothesis (EMH): The only widely accepted theory of how the stock market works is called the Efficient Market Hypothesis (EMH) (Warneryd, 2001), and in its simplest form, states that stock prices always reflect all the available information about the market and companies in question (Shleifer, 2000). The Efficient Market Hypothesis (EMH), as stated by Fama, assumes that 'Stock prices fully reflect all their relevant information at any given point in time'. Previous researches have also proved that there is a strong correlation between the time at which news articles are published and the time when the stock prices fluctuate. As the trading grew, people tried to find methods and tools which can accurately predict the share prices increasing their gains and minimizing their risk. Many methods like fundamental analysis, technical analysis, and machine learning method have all been used to attempt predictions of share prices but none of these methods have been proven as a consistently applicable prediction tool.

Fundamental Analysis: Fundamental analysis is the physical study of a company in terms of its product sales, manpower, quality, infrastructure etc. to understand it standing in the market and thereby its profitability as an investment. The fundamental analysts believe that the market is defined 90 percent by logical and 10 percent by physiological factors. But, this analysis is not suitable for our study because the data it uses to determine the intrinsic value of an asset does not change on daily basis and therefore is not suitable for short-term basis. However, this analysis is suitable for predicting the share market only in long-term basis. Fundamental analysis posits that companies that do well in their line of work, be it by having high profits, a good managerial structure, a successful focus on research and innovation, or any other similar factors, will do well in the stock market. Many argue that this type of analysis is much more reliable than technical analysis for longer term investments, as stocks are supposed to reflect the value of the company they represent. while stock prices change on a regular basis, the same is not true for fundamental variables. Many of the variables below are released monthly, though corporation earnings information is released quarterly incorporating data that appears from numerous time periods within a neural network is difficult, especially when one has access to a nearly-continuous stream of information, like share prices. Examples of fundamental indicators are given below: Consumer Price Index (CPI) Consumer Confidence Index Leading Indicators Index Price-Earnings (P/E) Ratio

Technical Analysis: Whereas fundamental analysis looks at many different aspects of a company and economy to predict how well a stock will perform, the assumption inherent in technical analysis is that all such required information is available in a share's past prices. Specifically, technical analysis is often defined as The process of analyzing a securitys historical prices in an effort to determine probable future prices. The way technical analysis helps predict whether a stock will increase or decrease in value is by signaling trend reversals. According to technical analysts, many securities exhibit different types of growth over time, and the key to making a profit in the stock market is to predict when a stock's tendency to increase in value will rise, or a falling stock price will stop and begin to increase. By viewing a stock's past performance, one may begin to understand how people investing in that stock act and which prices they are comfortable with. A large area of technical analysis deals with study of human psychology, i.e. the behavior of investors which is repetitive in nature. For example, since they are the result of human behavior whose character is permanent in time, some of the technical formations that were identified more than a hundred years ago are still valid. One of the most important characteristics of technical analysis is its adaptability to virtually any financial instrument, which includes stocks, bonds, stock indexes, currencies, gold, oil, i.e. any subject of trading on the organized securities market. Technical analysis is also applicable to any time dimension and is flexible with regard to the time

aspect. Despite its jargon and methods, technical analysis may well be an effective means for extracting useful information from market prices A technical indicator is any class of metrics whose value is derived from generic price activity in a stock or asset. Technical indicators look to predict the future price levels, or simply the general price direction, of a security by looking at past patterns. Collectively called "technicals", they are distinguished by the fact that they do not analyze any part of the fundamental business, like earnings, revenue and profit margins. Technical indicators are used most extensively by active traders in the market, as they are designed primarily for analyzing short-term price movements. To a long-term investor, most technical indicators are of little value, as they do nothing to shed light on the underlying business. The most effective uses of technicals for a long-term investor are to help identify good entry and exit points for the stock by analyzing the long-term trend. Examples of various technical indicators are given below: Variable Moving Average (VMA) Typical Price (TP) Chaikin Money Flow indicator (CMI) Ease Of Movement (EAM) Market Facilitation Index (MFI) Moving Average (MA).

Machine Learning Methods: Machine learning approach is attractive for artificial intelligence since it is based on the principle of learning from training and experience. Connectionist models such as ANNs are well suited for machine learning where connection weights adjusted to improve the performance of a network. The technical indicators evaluated by applying various mathematical formulae on historical stock quotes can be used as inputs to the neural networks. Simple closing prices of the stocks can also be used as inputs to the neural networks. Back propagation is the most widely used algorithm to train neural networks. The training is based on a simple concept: if the network gives a wrong answer, then the weights are corrected so that the error is lessened and as a result, future responses of the network are more likely to be correct. A neural network using back propagation algorithm to train is often called a back propagation neural network. Back propagation corresponds to a propagation of errors backwards through the network. It involves an iterative procedure for minimization of an error function, with adjustments to the weights. Firstly, the derivatives of the error function with respect to the weights must be evaluated. Then the derivatives are used to compute the adjustment to be made to the weights. Backpropagation with Feedforeword Neural Network: Back-propagation algorithm is basically the process of back-propagating the errors from the output layers towards the input layer during training sessions. Back-propagation is necessary because the hidden units have no target values which can be used, so these units must be trained based on errors from the previous layers. The output layer has a target value which is used to compare with calculated value. As the errors are backpropagated through the nodes, the connection weights are continuously updated. Training will occur until the errors in the weights are adequately small to be accepted. On the other hand the computational complexity of

Backpropagation Algorithm is only O(n). These features of the algorithm are the main criteria for predicting share prices accurately. The main steps using the Backpropagation algorithm as follows: Step 1: Feed the normalized input data sample, compute the corresponding output; Step 2: Compute the error between the output(s) and the actual target(s); Step 3: The connection weights and membership functions are adjusted; Step 4: IF Error > Tolerance THEN go to Step 1 ELSE stop.

Analysis:
Following are some UML diagrams with their descriptions:

Interaction Diagrams:

Interaction diagram for use case #1 (login):

Interaction diagram for use case #2 (Get Quotes/Graphs):

Interaction diagram for use case #3 (Get Prediction):

Activity Diagrams:

Activity diagram for use case #1 (login):

Activity diagram for use case #2 (Get Quotes/Graphs):

Activity diagram for use case #2 (Get Prediction):

Design:

General System Architecture:

The system consists of three main components: historical stock quotes, a simulation server and a client interface. Figure above visualizes the system architecture and interactions between the components. Basic descriptions of the individual components are listed below:

1. Historical Stock Quotes: The quotes are collected for each trading day. These quotes will be used by the simulation server for the purpose of prediction of the stock price.

2. Simulation Logic: The simulation logic loads the information from the historical quotes and runs the prediction strategies when instructed by the client. 3. Client The client provides the users with a graphical interface to specify strategies to simulate. The results returned by the simulation server are then visualized appropriately.

Detailed System Model:

Methodology Of Implementation:

Step 1:Collection Of Historical Stock Quotes: 1. The project goal of predicting stocks requires huge amount of stock data for each company, for training our neural network model. 2. The data collected needs to be updated at regular intervals to make our system robust and accurate. 3. We have also planned to implement indicators for the sake of short term investors and hence they require historical data of a particular security, to get accurate stock price indication. 4.The data source that we use is Yahoo Finance which provides us with daily stock quotes in with attributes such as open, high, low, close and volume. 5. Similar data needs to be obtained for all 10 companies since we aim to build a software that predicts stock prices for 10 companies. Following is a snapshot of the format of data collected from Yahoo Finance.

Step 2:Evaluation of various technical indicators:

Out of the huge range of technical indicators available we have selected 5 to be used for our project. These 5 can be used directly based on the algorithm associated with each of them or can be used as inputs to the neural networks which on training for certain amount of time can predict the selling or buying trend in the stock. Thus in any case evaluation of these indicators is an important part of the methodology that we are planning to adopt for our system. All that user would need to do is login into the system with proper credentials. The technical indicators that we planned to use for our system are given below: Typical Price (TP) Chaikin Money Flow indicator (CMI) Ease Of Movement (EAM) Market Facilitation Index (MFI) Moving Average (MA). The definition of each of these indicators, the mathematical formulae to evaluate each of them and the indication that each of them gives is briefed below:

Typical Price The Typical Price indicator is calculated by adding the high, low, and closing prices together, and then dividing by three. The result is the average, or typical price. Algorithm: 1. Inputting High, Low, Close values of the daily share 2. Take an output array and add the values of H,L,C 3. Divide the total by 3 TP = [H+L+C]/3 HLC where H=High; L=Low; C=Close. Where the TP greater than the bench mark we have to sell or to buy. Moving Average The most popular indicator is the moving average. This shows the average price over a period of time. For a 30 day moving average you add the closing prices for each of the 30 days and divide by 30. The most common averages are 20, 30, 50, 100, and 200 days. Longer time spans are less affected by daily price fluctuations. A moving average is plotted as a line on a graph of price changes. When prices fall below the moving average they have a tendency to keep on falling. Conversely, when prices rise above the moving average they tend to keep on rising.

Ease Of Movement The EMV emphasizes days in which the stock is moving easily and minimizes the days in which the stock is finding it difficult to move. This indicator is used frequently with equivolume charts to identify market formations. A buy signal is generated when the EMV crosses above zero, a sell signal when it crosses below zero. When the EMV hovers around zero, then there are small price movements and/or high volume, which is to say, the price is not moving easily. The volume is divided by a volume increment (typically 10,000) to make the resultant numbers larger and easier to work with. The EMV is usually smoothed with a moving average.

The Arms Ease of Movement indicator was developed by Richard W. Arms, Jr. See also Arms Index (TRIN).

Chaikin Money Flow The Chaikin Money Flow compares the total volume over the last n time periods to the total of volume times the Closing Location Value (CLV) over the last n time periods. The CLV calculates where the issue closes within its trading range. When the Chaikin Money Flow is above 0.25 it is a bullish signal, when it is below -0.25, it is a bearish signal. If the Chaikin Money Flow remains below zero while the price is rising, it indicates a probable reversal. The Chaikin Money Flow indicator was developed by Marc Chaikin.

Market Facilitation Index Market Facilitation Index (MFI) is the trading range divided by the volume. The MFI measures the price movement per unit of volume. To interpret the MFI, compare it to the volume. When the MFI is high and volume is low, it signals a fake trend which will soon reverse. When the MFI is low and volume is high, it signals a new trend in either direction is about to occur. When the MFI is low and volume is also low, it signals a fading market and an impending trend reversal. When the MFI is high and volume is also high, it signals a strong trend.

The Market Facilitation Index was developed by Dr. Bill Williams and is described in his 1995 book, Trading Chaos.

Step 3: Prediction of Stock Prices for any selected company using neural network approach:

Prediction of stock market returns is an important issue in finance. Nowadays artificial neural networks (ANNs) have been popularly applied to finance problems such as stock exchange index prediction. An ANN model is a computer model whose architecture essentially mimics the learning capability of the human brain. The processing elements of an ANN resemble the biological structure of neurons and the internal operation of a human brain. The use of ANN comes in because they can learn to detect complex patterns in data. It is able to work parallel with input variables and consequently handle large sets of data swiftly. The principal strength with the network is its ability to find patterns and irregularities as well as detecting multi-dimensional non-linear connections in data. In mathematical terms, they are universal non-linear function approximators meaning that given the right data and configured correctly; they can capture and model any input output relationships. This not only removes the need for human interpretation of charts or the series of rules for generating entry/exit signals but also provides a bridge to fundamental analysis as that type of data can be used as input. In addition, as ANNs are essentially non-linear statistical models, their accuracy and prediction capabilities can be both mathematically and empirically tested. This quality is extremely useful for modeling dynamical systems, e.g. the stock market. We plan to use a back propagation algorithm in a feed forward neural network whose basic functionality is as shown in the fig. below:

We used feedforward neural network which has a input layer with 5 neurons, a hidden layer which has 5 neurons and a output layer with single neuron. The backpropagation algorithm has been used for training the network. With the neural network we just need to simply show the correct output for the given inputs. With sufficient amount of training, the network will mimic the function. Another advantage of neural network is that during the tanning process, the network will learn to ignore any inputs that dont contribute to the output . For our system, there is a training phase where some parameters named weights are found from this section and Back propagation Algorithm is used for this training phase. These weights are used in prediction phase using same equations which are used in training phase. This is our basic Architecture of our System and this approach is known as a Feed forward Network. There are a lot of inputs in share market which are impacts in share price. But all the inputs are not used in our system because their impacts are not significant in share market price. We used 5 inputs for the system. The inputs are: Typical Price (TP), Chaikin Money Flow indicator (CMI), Ease Of Movement(EAM), Market Facilitation Index(MFI), Moving Average(MA). The fig. below shows an ANN with these 5 inputs. Also prediction can be done with only closing price as the input to the neural network.

The error in the output e is evaluated using the formula: Error = Desired Output - ANN Output; The ANN is then trained to minimize this error as much as possible.

System Specification:
The system should collect data from web sources like Yahoo Finance, Google finance at and update its database from a set of 10 companies. http://finance.google.com http://finance.yahoo.com Different prediction models need to be built that give a fair recommendation to the customer whether to buy/sell/hold stock. The system should train itself from a set of past data and simulate on a remaining set of test data to improve its precision. The system should aggregate all indications given by technical indicators and try to provide a recommendation that supports the more robust neural network system. The system should track various stock movements simultaneously that might not be owned currently by customers and generate alerts if it notices a favorable tilt in the graph that hints at immediate purchase. A friendly user interface should be designed for customers and access to specific services should be restricted to only registered users. There should be three key options that a user should be able to select from according to his requirement. Those are: Get Quote (to get the quotes for a selected stock) Get Graphs (to get the graphs for a selected stock) Get Prediction (to get the prediction for a selected stock).

Вам также может понравиться