This action might not be possible to undo. Are you sure you want to continue?

BooksAudiobooksComicsSheet Music### Categories

### Categories

### Categories

Editors' Picks Books

Hand-picked favorites from

our editors

our editors

Editors' Picks Audiobooks

Hand-picked favorites from

our editors

our editors

Editors' Picks Comics

Hand-picked favorites from

our editors

our editors

Editors' Picks Sheet Music

Hand-picked favorites from

our editors

our editors

Top Books

What's trending, bestsellers,

award-winners & more

award-winners & more

Top Audiobooks

What's trending, bestsellers,

award-winners & more

award-winners & more

Top Comics

What's trending, bestsellers,

award-winners & more

award-winners & more

Top Sheet Music

What's trending, bestsellers,

award-winners & more

award-winners & more

Welcome to Scribd! Start your free trial and access books, documents and more.Find out more

**and neural networks
**

Hooman Hidaji Amirkabir University of Technology hooman.hidaji@aut.ac.ir

Abstract

In this study we have tried to develop a model for predicting Tehran Stock Market price via data mining techniques, specifically by use of an artificial neural network and then decision trees and present a new way of rule extraction. Technical indicators are used as input for model. First a suitable neural network is created and trained with the stock data. The intention here is to develop a simple model. The network is able to predict the equity price trend with acceptable hit rate. Then this trained network is used as an input for decision tree. It is believed that rules induced from this tree perform better than those derived directly from the data. Then a rule-based feed-forward expert system is developed Keywords: Tehran Stock Exchange, technical analysis, neural network, decision tree, rule induction, expert system

Introduction

Tehran Stock Exchange (TSE) is a rather emerging market compared to markets of developed countries. Since its opening in February 1967 it has had lots of ups and downs. Two of the most events that extensively affected the TSE were the 1979 Islamic revolution and the 8 year war. These events made the financial markets turbulent and uncertain of the future and caused a lot of damage to it. But after the war The Tehran Stock Exchange has come a long way. Today TSE has evolved into an exciting growing marketplace where individual and institutional investor trade securities of over 420 companies. Despite the recent growth not much academic study was carried out on TSE several years ago and a huge gap could be distinguished. In recent years, due to government privatization strategies, TSE has played an important role in the country`s economy. The academic growth has also taken place in recent years in universities and a boost has happened in institutional researches. With this significance, academic courses have been launched and lots of researchers have developed interest in stock market. The result has been unprecedented number of dissertations, papers and reviews in this area e.g. Yousefpour (2007), Mohammadnia (2008), Alizadeh (2008). The stock market data has intrinsic trait of being complicated. Numerous interrelated factors of economic, cognitive, political and other sciences affect financial markets and make it difficult to predict by simple linear models. On the other hand the development of intelligent techniques such as neural networks, genetic algorithms and fuzzy logic with abundance of processing machines and PCs has opened new horizons to the studies in this field. Some instances of such studies can be found in works of, Timajchi (2008), Soleimani (2008) and Aghamiri (2009). Technical analysis has been the primary tool for predicting stock patterns for years now. It incorporates different aspects of human behavior, economic and political events etc. Success of technical analysis has made it more desirable and today financial advisors and brokerage firms seldom make decisions without using it (Chavarnakul & Enke 2009). It is important to have a good tool that can rapidly infer from raw data and turn it into useful information that can be used as signals in market. Though the weak form of efficient market hypothesis, theory that has been in markets for several decades, accounts technical analysis as mere waste of time and resources, but numerous

1

Refenes et al. In everyday applications. Thus it is very desirable to develop a system that can effectively use the synergy of these techniques. Then technical analysis. Neural networks on the other hand have shown great potential for different tasks. neural networks have a weak explanatory ability. In the next section the vast literature in the area is discussed. data are segregated according to a variable and this process goes on until desired difference between leafs is acquired. e. political. usually an algorithm that via use of some criteria and target. 1995).g. 2000. Rule-based systems present the knowledge in the symbolic IFTHEN form in which the user can examine the solution based on his knowledge of the field and does not need to understand the underlying method. Yao & Tan (2000) showed that a neural network model is applicable to the prediction of foreign 2 . Simple linear or ARIMA models cannot interpret or predict markets effectively. Decision Trees can provide us with a good understanding of the problem domain in a schematic form of nodes and arches. Literature review In recent years intelligent techniques such as neural networks. Then this network will be used as an input for a decision tree and several rules will be generated. Researchers are always trying to reach better solutions through the use of intelligent techniques. Neural networks can not practically supply this kind of knowledge. At each branch of the tree. clustering. With abundance of computers on the other hand. indicated that traditional statistical techniques for forecasting have reached their limitation in applications with nonlinearities in the data set such as stock indices (Yoa & Tan 2000). Financial markets behave in a complex manner. Each leaf represents a rule in the manner that if we follow the criteria used for classifying. because these systems provide us with easy to understand rules in a symbolic form. inputs and functioning are explained and the expert system is presented. neural networks and decision trees will be introduced briefly. Grundy and Kim (2002) also find value in using technical analysis. After that development of the model is represented and its parameters. One can not understand on what grounds a prediction is made. tries to separate data into classes that each represent homogeneous properties. investment. these networks are substituting traditional statistical models such as Box-Jenkins models. This kind of rules then can be easily implemented in a decision support system. In recent years.g. These intelligent networks can learn patterns and predict future trends. It is said that the network acts as a black box. have been extensively applied to a large variety of applications in areas of stock market prediction. 1. and economical events (Achelist. it is useful to create systems that can do the drudgery of technical analysts. Decision trees have been put to use in areas of classification. While powerful in prediction. it can effectively provide us with easy to understand IF-Then rules. rule based systems are preferred for help in decision making. prediction and so. Neural network representation is incomprehensible to human. Then with the selected attributes and variables. understand the underlying patterns via neural network and represent it by rules induced from decision tree. Lo et al. The rules are compared to the rules induced directly from the data. Blume. technical analysis has proven to be powerful for evaluating stock prices and is widely accepted among financial economists and brokerage firms. and technical analysis. Zareiee 2009. Decision Support Systems and Expert Systems can effectively be put to work for this purpose. The network can predict if the price will rise or fall based on several technical indicators chosen for this purpose. One of the techniques that can be combined with neural network to improve its effectiveness and understandability is decision tree. Easley & O’Hara 1994. In this research we try to create an artificial neural network for prediction of several equity prices in Tehran Exchange Market. This weakness of neural networks calls in some sort of compensation. This is due to the fact that technical analysis appears to be a compromising tool since it offers a relative mixture of human. In time series problems.researchers have shown that this theory does not hold in various markets e. including prediction. Decision tree is a data mining technique. we can rephrase it as IF-THEN rules.

The importance of confirmation bias is noted in this study. (2009) predicted the Brazilian stock market through neural networks and adaptive exponential smoothing methods and concluded that neural networks outperformed the latter method. The empirical results indicated that all of the technical trading rules correctly predict the direction of changes. This produces autocorrelations and patterns of price movement that can predict future prices. Wang & Chan (2007) examined the potential profit of bull flag technical trading rules using a template matching technique based on pattern recognition for the Nasdaq Composite Index and Taiwan Weighted Index. Tsang et al. They developed several market strategies and the final results were far better than buy and hold strategy. neural network and genetic algorithm to form a romantic DSS. Zhu & Zhou (2009) analyzed the usefulness of technical analysis. a technical indicator developed from equivolume charting. The model was run for five exchange rates in FOREX and the results were acceptable. a neuro–fuzzy-based genetic algorithm system was introduced. The study shows that bull flag price and volume pattern heuristic in technical analysis can be effectively used to make profit. De Faria et al. Traders who acquire information and trade on the basis of that information tend to bias their interpretation of subsequent information in the direction of their original view. This study was successful in improving returns both with and without transaction costs. such as moving average were fed to neural networks to capture the underlying rules of the movement in currency exchange rates. Rotundoa & Ausloos (2007) examined the technical analysis method by a co-evolution Bak–Sneppen model. which is likely in practice. pattern recognition. This model has the ability of explaining unusual events. allowing investors to make better stock trading decisions. Leigh. The network signaled buy/sell signals based on one day change in price 3 . (2007) developed a NN5 neural network for prediction of Hong Kong stock price which used several technical indexes such as moving average. fuzzy logic. Time series data and technical indicators. For this research. Purvis & Ragusa (2002) studied a hybrid DSS which combined technical analysis. In their research. RSI and MACD. Their study presented a hybrid stock trading system that integrated neural networks. When uncertainty exists about predictability. Moreover. Fernandez-Blanco et al. the technical trading rules are robust to model specification. just the simple moving average was enough for the prediction. Enke & Thawornwong (2005) studied use of neural networks and data mining in financial market analysis. specifically the widely employed moving average trading rule from an asset allocation perspective and showed that. Friesen. open and close prices. when stock returns are predictable. (2008) in their study took benefit of evolutionary algorithm to optimize the parameter values of technical indices. Chavarnakul & Enke (2009) developed a complex hybrid system. Leigh. and genetic algorithms techniques to increase the efficiency of stock trading. the fixed allocation rules combined with technical analysis can outperform the prior-dependent optimal learning rule when the prior is not too informative. But this kind of prediction is now almost desolate and processes usually are done on data itself. The results showed that the intelligent hybrid system took advantage of the synergy among these different techniques to intelligently generate more optimal trading decisions for the VAMA. This study showed that no complex index was needed to do so. Paz & Purvis (2002) took benefit of a feed-forward neural network and pattern recognition technique to predict short term increase in NYSE index. They proposed a data selection method that could improve results. Weller & Dunham (2009) examined technical trading rules derived from historical data to find out why these rules are profitable. They tested several signals by considering microeconomic factors. which has been shown to play a key role in other types of decision making. The study uses volume adjusted moving average (VAMA). The empirical results demonstrated that the average return of trading rules conditioned on bull flag significantly better than buying every day for the study period. and they tend to substantially outperform the modelbased optimal trading strategies when the model governing the stock price is uncertain. technical analysis adds value to commonly used allocation rules that invest fixed proportions of wealth in stocks. They specifically focused on Moving Average ConvergenceDivergence (MACD) and could improve its performance. This paper provides a model that explains the success of certain trading rules that are based on patterns in past prices. It also was another assault on the weak form of efficient market hypothesis. This finding may provide investors with important information on asset allocation.exchange rates.

In Ha et al. Trepan entailed a neural network and decision tree algorithm similar to CART. Faraki & Keikhaiee (2007) created another backpropagation neural network for predicting different parameters of stock markets. SVM is thought to be a robust method in use for financial time-series forecasting. Wang & chan (2009) made and empirical study on trading rule discovery and proposed a template for doing so. Mokhtari & Ashouri (2007) developed a backpropagation and genetic algorithm hybrid to predict monthly minima and maxima. They have tried to build DSSs and Expert systems to help stock recommendation and exchange. In this research the network was used for predicting Dollar-Mark exchange rate. and neural network for stock trading prediction. Lam (2004) in her research investigates the ability of neural networks. The proposed system was a success in combining several methods. Thus the resulting rules could perform better than traditional rules. He concluded that the neuro-fuzzy architecture was able to recognize the general 4 . Saraiee. The research uses backpropagation algorithm to train the network and achieves good results. The predictor attributes include 16 financial statement variables and 11 macroeconomic variables. Then this network was fed to a decision tree to create rules. The hybrid system was successful in reducing times and costs and had an improvement over the simple SVM system. The inputs of the model are the closing prices for the current and prior three months. Previous studies had not explained why some assumptions are made about specific indexes or data. The developed system uses box theory and two SVMs to create buy/sell signals. Fazel Zarandi et al. He developed a fuzzy rough set system consisted of two agents: a visual agent for monitoring the price and a mining agent that helped traders distinguish buy and sell signals. (2009) rule discovery approach is followed and a recommendation system for stock exchange is developed. This study uses chart data to infer buy signals. The knowledge base proved to be accurate and the system worked effectively. Diederich &Tickle (1995) have also done a survey on this field. The research tries to form a rule base from stock database. thus this study can be used as a black-box for future research. The system developed in this research is a first attempt in the literature to predict the sell/buy decision points instead of stock price itself. specifically. This study is a noble one and has potential for future works. On the grounds of rule induction and use of decision trees in financial markets. Andrews. The rules generated in this manner were by far better than the rules generated directly from the data. This research is another example of a good hybrid system. Thammano (1999) used a neurofuzzy model to predict future values of Thailand’s largest government-owned bank. (2009) In his study developed an integrated system called CBDWNN by combining dynamic time windows. Huang & Tsai (2009) used SVM combined with Self Organizing Feature Map (SOFM) and filterbased feature selection to improve market indexes predictions. case based reasoning (CBR). Skouras (2001) introduced an Artificial Technical Analyst which could select trading rules and could learn from experience. The neural network seemed to reduce the effect of noise in the data and so creating more confident rules. Wen et al. One of the best studies in this field was carried out by Lee & Jo (1999). to integrate fundamental and technical analysis for financial performance prediction. Proposed rules have good performance in USA’s tech market stocks and can be used as a part of an expert system. Wang (2003) attempted to predict stock price via strong rules. Chang et al. (2009) created a type-2 fuzzy rule based expert system which used both technical and fundamental indexes to forecast stock prices and achieves significant results.and had acceptable hit rate. It also develops a support system for stock prediction. and the profitability ratios. They developed an expert system that could give out recommendation based on candle stick charts. The output of the model was the stock prices for the following three months. Graven and Shavlik (1997) developed the Trepan algorithm. Others have tried to develop comprehensive systems. the backpropagation algorithm. (2010) developed an automatic stock decision support system based on box theory and SVM algorithm.

2. The believers of this school are always monitoring the events and news of the companies and examine their financial statements in search for price incoherence that can be used to make profitable transactions. It incorporates different aspects of human behavior. dating back to the 1800s. this information is used to make trading or investing decisions” (Kirkpatrick & Dahlquist 2007).g. It is considered by many to be the original form of investment analysis. technical analysis can not bring any competence privilege to the analyst. Technical analysis normally uses two techniques to evaluate the stock prices. First. These theories state that the burden of monitoring the market is not worth the effort. The fundamentalists believe that the market trend can be predicted via deepening in capital economy conditions and issuers financial situation. technical analysis studies the historical data surrounding price and volume movements of the stock by using charts as the primary tool to forecast future price movements. Also. economic and political events etc. which is the study of economic.characteristics of the stock market faster and more accurately than the basic backpropagation algorithm. So in the viewpoint of the weak form of EMH. it could predict investment opportunities during the economic crisis when statistical approaches did not yield satisfactory results. In this school it is considered that all the information only drawn from the market. e. In the following section further discusses technical analysis. Technicians or sometimes called chartists use different indexes and charts to predict patterns. Market efficiency can be leveled into three. 2. This assumption contradicts weak form of EMH. price and volume data can be used to predict future trend of the market. technical analysis 5 . Reitz (2006) in his study examines and explains the predictive ability of technical analysis and concludes that the logic of technical analysis and its forecasting success is state-dependent. primarily price and volume data. As opposed to fundamental analysis. Random walk hypothesis and efficient market hypothesis (EMH) are major theories of this school. In the semi-strong form all public information is inserted into the price while people with insider information can use it to make a profit. Technical analysts study the action of the market itself rather than the goods in which the market deals. It is usually opposed with fundamental analysis. Second school theory is a fundamental view. 2. industry. Strong form of EMH states that all the knowable data are instantly factored into the market price of a security. Technical analysis is rooted in basic economic theory and uses principles in cognitive and political sciences. The weak form of EMH it is assumed that just the past performance of the security is reflected in the price. Technical analysis It is useful to first take a look at the existing theories in financial markets and their viewpoint toward technical analysis. Success of technical analysis has made it more desirable and today financial advisors and brokerage firms seldom make decisions without using it (Chavarnakul & Enke 2009). all the efforts of the price predictors is mere waste. Technical analysis has been the primary tool for predicting stock patterns for years now (Achelis 1995). Technical analysis belongs to the third school. The technical analyst believes that “the market is always correct”. By assuming this. and company conditions in an effort to determine the intrinsic value of a company`s stock.2 Technical analysis In simple words “technical analysis is the study of past market data. Charts used by technicians are the most important tools for forecasting future price movements. The first school considers that the trend and change in stock prices is completely random and thus the information of market is of no use.1 Theories of financial markets There are three different schools of thought on how the financial markets work and how the information of these markets can be used to make profit (Yoa & Tan 2000).

All prior price action would be ignored. Usually. Neural Networks An artificial neural network. a comparison can be made between present and past levels. 3. Leading indicators are designed to lead price movements. these indicators are picked up in this paper to prove the proposed technique (Fernández-Blanco et al. simple. They are designed to get traders in and keep them in as long as the trend is intact. Price data are included into the formula and every data point is produced by using the selected information. Price data includes any composition of the opening. Neural networks are non-linear statistical data modeling tools. indicators are classified in two big classes (Reily 1989): oscillators or leading indicators. Momentum. ANN. creates a complicated whole which has many applications in different sciences and industries. or any other kind of information into their formula. Trend-following indicators work best when markets develop strong trends. trend-following indicators will likely lead to many false signals and whipsaws. usually called a neural network. Some of the most popular leading indicators include Commodity Channel Index (CCI). Neural 6 . others include volume. Therefore prediction of stock price movements is a very difficult task. high. a 20. and weighted) and Moving Average Convergence-Divergence (MACD). Like the linear and polynomial approximation methods. The use of technical indicators is another technique that includes calculations or mathematic equations to investigate the trading decisions (Chavarnakul & Enke 2008). Because of the high volatility. which is the time lapse used to calculate the indicator. Some popular trend-following indicators include moving averages (exponential. 2008). they can not be described by simple linear models. Some indicators require only the closing prices. For analysis purposes. The crowd of these simple units. neural networks are prime candidates for prediction purposes (Yoa & Tan 2000). and lagging indicators. is a mathematical or computational model that tries to simulate the structure and/or functional aspects of biological neural networks. known as transfer function. They can be used to model complex relationships between inputs and outputs or to find patterns in data. So many factors affect prices in an interrelated manner. A technical indicator is a series of data points derived by applying a formula to the price data series. thus making a complex nonlinear behavior. low or closing values over a period of time. a neural network relates a set of input variables to a set of one or more output variables. For example. Any single data point does not offer much information and it is not enough to make an indicator. The lagging indicators follow the price action and are commonly referred to as trend-following indicators. Relative Strength Index (RSI). These indicators are not effective in neither trading nor sideways markets. It is required to have a series of data points over a period of time to create valid reference points to allow analysis. Use of appropriate intelligent systems in recent years has had exponential growth and has helped this task. It consists of an interconnected group of artificial neurons and processes information using a connectionist approach to computation. it represents a very efficient way to model nonlinear statistical processes (McNelis 2005). complexity. in which the input variables are transformed by a special function. If used in exchange markets. technical indicators may be shown in a graphical way above or below a price chart. The difference between a neural network and the other approximation methods is that the neural network makes use of one or more hidden layers. they are not simple white noise or even random walks. NN.technique uses charts to study the movement of stock prices. While this hidden layer approach may seem esoteric. Stochastic Oscillator and Williams %R.day Stochastic Oscillator would use the past 20 days of price action (about a month) in its calculation. called nodes. By creating a series of data points along the time. These techniques have been able to help market makers decide more confidently. Financial market data are not simple ARIMA processes. They represent a form of price momentum over a fixed look-back period. and noise market environment. Many investors and traders use indicators to predict the direction of future prices.

Many algorithms have been developed for making such trees. CHAID and QUEST. i. e. on cannot infer from the mechanism of the network why an output is derived. Neural networks representation is not comprehensible for human. ANNs appear to be particularly suited for financial time series forecasting. And third. each based on a purity criterion. and the number of training epochs. In the area of financial stock market forecasting. Lisboa. Second. for purposes of classification or prediction and have recently become a popular tool for financial decision making (Leigh. they have their fair share of problems. the ANNs have been reported as good methods to predict financial stock market levels (Huang & Cheng 2009) Neural networks can be trained to map past values of a time series. These algorithms. input selection problems. conflicting and erroneous information due to noisy data. have general learning algorithms.e. prediction and estimation which provides us with a good graphical representation. It is believed that (Lam 2004) neural networks are appropriate tools for forecasting financial performance for the following reasons: First. Rule extraction is a post processing technique which can generate a more precise and accurate results by reducing redundant.g. New data can be introduced to the network to retrain and update it in a parallel manner and thus sustainably improve its performance. This feature allows neural networks be applicable to a wide collection of problems compared to statistical techniques such as regression. which is especially suitable for processing numeric data. Decision Trees and Rule Extraction Decision tree in area of data mining is a technique used for classification. decision tree.g. the learning rate. but the selection process remains as an art rather than a science. One of the desirable features of a decision tree is the potential of extracting rules from it. Purvis & Ragusa 2002). Backpropagation is by far the most popular neural network algorithm that has been used to perform training on the multi-layer feed-forward neural networks.networks. and parameter misspecification (Lam 2004). and Vaughan. 2009). and varies from problem to problem. fuzzy logic and genetic algorithms are obvious examples of such intelligent techniques that have been applied to a large variety of applications in technical analysis. specifically financial data and indicators. Building a decision tree has not any exact procedure. It is for this incompetence that in our research we tried to improve its representation via a symbolic technique. Since the feed-forward neural networks are well known. but is a rather heuristic act. Although neural networks as a data mining tool have the above merits. the network structures and backpropagation algorithms are not described in this paper. requiring the distribution to be normal. neural networks do not require any limiting assumption on data distribution for input data e. This problem is sometimes called the black box criticism (McNelis 2005). as they can learn highly non-linear models. recursively create branches for the tree and make it grow or first make all possible branches and then prune it. There are various heuristic rules and common practices for selecting the parameters. clustering. It has shown to be one of the most widely used learning methods for multilayer networks and are believed to have great potential for financial forecasting (Adya & Collopy 1998). CART. 7 .0. many studies focused on application of ANNs. 4. a neural network is an intrinsically numeric method. and can use inputs of different kinds (Chang et al. neural networks are data mining techniques that enable us to train it even after the first training phase. C5. Multi-layer feed-forward neural networks have been widely used for financial forecasting due to its ability to correctly classify and predict the dependent variable (Vellido. 1999). the order of submitting training examples to the network. One common difficulty for neural network applications involves the determination of the optimal combination of training parameters including the network architecture (the number of hidden layers and the number of hidden nodes). can handle noisy data. Another problem is their understandability.

It compares the magnitude of a stock's recent gains to the magnitude of its recent losses and turns that 8 .5. if not solely. lower highs. e. Yao & Tan 2000. In this research we have tried to use more credited indexes (Tsang et al. with accordance to other factors. The oscillator can be used like any other momentum oscillator by looking for higher lows. Our intention in this study is the use of solely technical indicators for prediction. In the study carried out by Timajchi (2008) 14-day Aroon oscillator was known to work best in TSE. Timajchi (2008) recommended a 20-day Bollinger Bands for use in TSE. There are numerous indexes in the area of technical analysis. something that is especially helpful in volatile markets. Aroon oscillator is formed from two indicators. Relative Strength Index (RSI) The RSI is another extremely useful and popular momentum oscillator. Bollinger bands give an idea about the range of price and it signals when price reaches the upper and lower bands. Aroon up and Aroon down. So we have incorporated this information in the model as three separate inputs. Below is a short description of indexes used in the model as inputs. In this study we used a 10-day exponential moving average to capture short period changes and a 25-day simple moving average as proposed by Timajchi (2008) as an appropriate index for TSE. Zareiee 2009.g. an upper band (SMA plus 2 standard deviations) and a lower band (SMA minus 2 standard deviations). But it has disadvantage of being late or so called to be lagging. Rate of Change (ROC) The ROC indicator is a very simple yet effective momentum oscillator that measures the percent change in price from one period to the next.1 Inputs Selection of the input variables is a modeling decision that can greatly affect the model performance. Many researchers use this information as input s to their models. Aroon Oscillator Aroon is an indicator system that is used to determine whether a stock is trending or not and how strong the trend is. The interpretation of MAs is rather simple. But some indexes are more widely accepted and put to work by more researches. It also forms the building blocks for many other technical indicators. Timajchi (2008) compared ROC with similar indicators like CCI and conclude that 3-day ROC outperforms other momentum indicators. a buy signal is created when the price is higher than MA and a sell signal is created when it falls lower. Day information It is fair to assume that the month and the day of the month and the day of the week may affect the security price trend. Moving average may be the most famous one. But we took use of RSI index too. Huang & Tsai 2009. Moving average smoothes a data series and make it easier to spot trends. Model Development 5. 2007. positive and negative divergences. we have used former research on Tehran Exchange Market and the indexes that perform better in it by Timajchi (2008). and crosses above and below zero for signals. Bollinger Bands Bollinger Bands index is consisted of three bands designed to encompass the majority of a security's price action: a simple moving average in the middle. Lam 2004) and specially. Moving Average Moving average is one of the most popular and easy to use tools in technical analysis.

Price ROC Wilder RSI MACD Vol. It takes a single parameter. which are lagging indicators. It can be used to determine if the overall volume trend is increasing or decreasing. MACD uses moving averages. the number of time periods to use in the calculation. Volume Indicators Volume is one of important predicting factors in stock markets. These indicators are turned into a momentum oscillator by subtracting the longer moving average from the shorter moving average.Trend Table 1 Model inputs Description A number between 1 and 12 indicating number of the month A number between 1 and 31 indicating the number of the day in month A number between 1 and 5 indicating the number of the day in week The volume of the stocks traded Closing price of the day 25-day simple moving average 10-day exponential moving average 20 day bollinger upper limit 20 day bollinger lower limit Richard Arm's Aroon Oscillator 3-day Rate-of-Change of equity Relative Strength Index Moving Average Convergence-Divergence Difference between two moving averages of a security's volume The cumulative total of volume that is adjusted depending on changes in closing prices 9 . but unlike OBV. The resulting plot forms a line that oscillates above and below zero. This indicators acts like MACD for volume. The Volume Oscillator displays the difference between two moving averages of a security's volume. Input Month Day of month Day of week Volume Closing price 25-D SMA 10-D EMA Bollinger Upper Band Bollinger Lower Band Aroon Osc. Thus we have used the amount of volume as well as two volume indicators as inputs of the model: Volume Oscillator Points and Price Volume Trend. The Price and Volume Trend is similar to On Balance Volume in that it is a cumulative total of volume that is adjusted depending on changes in closing prices. Moving Average Convergence-Divergence (MACD) MACD is one of the simplest and most reliable technical indicators available. Sudden rises and falls in the trend of volume can be relatively accurate signals.Osc. Points Price Vol. Volume Oscillator is calculated in points or percentage but we chose to use points.information into a number that ranges from 0 to 100. to include some trend-following characteristics. the PVT adds/subtracts only a portion of the daily volume. We use a 14-day RSI in our study which is proposed by both the creator of index (Wilder 1987) and Timajchi (2008). There are many ways to interpret changes in volume trends. without any upper or lower limits. Many investors feel that the PVT more accurately illustrates the flow of money into and out of a security than OBV does (Achelis 1995).

Table 2. This division is done randomly.000.000 189.500.789.800.000 4 KhZamia Feb-99 1. For this reason we decided to choose securities from the top 50 active corporations’ securities which had more records for a financial year than other companies.000 Rank in Top Active Companies 22 16 33 Symbol Company Name VPars DJaaber Fmelli Parsian Bank Jaaber Ebne Hayyaan Pharmacy National Copper Company Hepco Heavy Equipment Production Company Zamiad Company TEpco Feb-04 272.000 840. This list is available on TSE website.095 397.4 Model development The training set contains 80% of the collected data. Table 2 Securities chosen for the model ETS Acceptance Date Nov-04 Sep-91 Oct-06 Company Description A private banking company Company in pharmacy industry National Company in copper industry Producer of heavy machinery A company in Iran's automotive industry Market Value (Milion Rials) 17. He found that for most exchange-rate predictions on a daily basis. 5.760 Number of Shares 7. After these considerations and with consults from several experts in TSE.731.000 2 5. 10 .Note that we developed models for five equity data and not all the inputs were used for all of them.645. We have also tried to run the proposed model on several industry sections in the TSE and not to limit it to one. As a second factor we tied to use stocks with high liquidity. So in TSE we proffered to use almost 3 years’ data because better networks were acquired in this way.000.3 Selection of securities In training of the network one important issue is the amount of data available.850. 5. while the validation and the testing sets contain 10% each. We examined this amount of data for our models and concluded that this amount is not enough for the complete training of the network. five securities were chosen.800 1. a maximum of two years produces the best neural network forecasting model performance.483 41. Another dataset was selected from another period to further test the performance of the model and the hit rate of the model was calculated based on this test.200.000.528.000 5. The division percentages are based on a rule of thumb derived from the experience of the authors.2 Training set size Walczak (2001) in his research examined the issue of length of the training set or in-sample data size for producing accurate forecasts in financial markets. maybe the reason is the less number of open days for securities in Iran than international markets or the frequency of noise in the data. It is important for a stock to be tradable if we want to perform active investment management on trading it.

We initiated another neural network model for the same period on Jaaber Pharmacy (DJaber). The remaining14 inputs seem to be adequate for the model. stating that it is not a good idea to make use of less input variables. 11 . Learning algorithm used is Levenberg-Marquardt. Three years of data.5 Model Results The test was carried out on Parsian Bank stock data (VPars) and the hit rate was amazing number of 78%. The data are chosen and segregated in time order. This algorithm is one of most widely used algorithms in neural netwoks. It was a 15-30-30-1 network and with it we reached acceptable hit rate of 69% while the MSE of the network was as low as 0. the data of the earlier period are used for training. The process times for this research were negligible and always less than a minute. i. The performance of the network reached 0. June 2006.001. We tried to remove some of the inputs an make a simpler model. The structure of the network in most cases had two hidden layers with 20 to 35 nodes in each. Another performance measurement is the gradient of the target. In these models we used a Principal Component Analysis on input factors and decided that the PVT indicator was not really necessary and so was canceled as an input. 74 and 75 percent respectively. MSE is the most accepted and widely used performance measure and is the default in most softwares. The proposed neural network structure after experimenting on several feed-forward and cascade-forward models. Mapping the maximum and minimum of the data to 1 and -1 is very common in training neural networks.e. So Bollinger bands and the day of the month and week were omitted from data. The performance of the network is measured by Mean Squared Error of the model targets and real targets. We run similar models for two other equities. is a 15-30-35-1 feed-forward model with Levenberg-Marquardt backpropagation learning. 5. but due to several shocks in the pharmacy market and influence of fundamental factors the hit rate became lower than expected. usually few seconds and thus we chose not to perform sensitivity analysis for the process time. The experiment on Iran National Copper Company (FMelli) was carried out differently. We tried to keep the model as simple as possible. The gradient is used to measure the error and further train the network.June 2009 were used for training of the network and test was performed on data July 2009. This also reduces the training time required for the network. The result deteriorated.December 2010. In other words. validation and primary test and the data of the later period are used for final testing of the model. Hepco (tepco) and Zamiad (KhZamiad) and received acceptable results.The values of the input variables were first preprocessed by normalizing them within a range of -1 and +1 to minimize the effect of magnitude among the inputs and thus increase the effectiveness of the learning algorithm. the network has 15 input nods (according to inputs) with two hidden layers with 30 and 35 nods in each layer respectively and one output which signals if the stock price prediction is rising or falling.05 (MSE). The final hit rate with the best network we could find was 60%.

Thus we used CART algorithm to generate our rules. Several similar changes were carried out on data. Nov & Dec-09 (66 records) May-09 . SMA minus closing price was used instead of SMA.0052 0. In this section TEpco data was used to generate rules. thus the tree made by this kind of data is too large and ineffective. First we do this on the raw data and see the results.0043 74.0043 0. this means that at each step only two subgroups can be made.0116 Gradient 0. Then the network created before will be used as input to the decision tree algorithm and rules are generated in this manner. As an instance. 15 with prediction of upward trend and 12 with downward trend. One disadvantage of using tree for the raw data is that the inputs should be altered based on the interpretation that an index has.Sep-09 (500 records) Aug-06 . but Classification and Regression Tree (CART) has been more widely put to use and is more general. because the amount of SMA by itself does not state anything and by dividing it we can not infer any conclusion. leafs represent rules and thus a rule set can be derived from it.Dec-09 (90 records) Network Architecture 15-30-35-1 15-30-30-1 Learning Algorithm LM Backpropagation LM Backpropagation LM Backpropagation LM Backpropagation LM Backpropagation Performance 0. As stated before.00% 5. 27 rules could be induced from the tree. We created a tree with 6 levels under the root.Table 3 Model details Symbol VPars DJaaber Training and Validation Data Jun-06 . Target and predictor fields can be range or categorical but all splits are binary.00% 69.Mar09 (560 records) Jul-06 .0024 0.6 Decision Tree and Extraction of Rules In this section we try to extract rules from our data.0049 0. We set a limitation on the rules to be extracted: rules should not entail less than 10 instances and the minimum confidence required is 60%. For example we cannot use mere SMA as an input.0084 Hit Rate 78. where a node is considered pure if all of cases in the node fall into a specific category of the target field.Jun-09 (575 records) Test Data Jul-09 . in 1984.00% Fmelli 11-25-25-1 0.Dec-09 (100 records) Jul-09 . Thus several amendments had to be made to the data. Then we implemented CART algorithm on the data. As stated before many algorithms are developed for creating trees. This method uses recursive partitioning to split the training records into segments by minimizing the impurity at each step. The CART algorithm was developed by Breiman et al.005 0.00% TEpco KhZamia 14-25-25-1 14-25-25-2 0. 12 .0276 60.Jan-10 (156 records) Mar & Apr-07. yet more simple than the others.00% 75.Jun-09 (700 records) Jun-06 .0089 0.Dec09 (96 records) Jul-09 .Jun-09 (570 records) Apr-07 . The performance of the two rule sets are compared to see what improvements have been made. This data set entails 500 records in which 210 of them are instance in which price goes up the next day and in 290 records it goes down. Two samples of these rules are tabulated in table 4. when the tree is complete.

We created another decision tree.Mov. this time we used the data created by the neural network developed earlier.857 And Price ROC <= 2. The performance of the rules is summarized in table 6. but the extracted rules could be used for more instances.352 And volume > 77.8) Number of Instances 20 Confidence 0. Output of the network is imported to the decision tree algorithm as target values. we generate random data for the network (due to the distribution of variables) and feed it to the network as input data. Rules with high generalization are more desirable.8) Number of Instances 35 Confidence 0. We generated 500 records to conform to the records we had for direct rule induction. Table 5 Rule set characteristics (directly extracted from data) Number of Rules 27 Average Rule Confidence 0. We believe that the randomly generated data and targets can better represent underlying patterns of the market. 0. states how often a rule can be fired. because there is less noise in the data. though better results can be achieved by use of more data.840 And SMA <= 1083. The data are used in the same manner as before for rule extraction. 0. With the same constraints we induce rules from the tree. 12 rules for cases which predict lower closing prices and 12 for cases predicting higher prices.857 And Wilder RSI > 60.8 IF Price ROC > -1. These rules were applied to the same dataset to calculate the performance of the rules on real data and compare it to direct approach.8 Rule 5 for up (20. For doing so.787 And Exp.352 And volume <= 77. if proposition of the rule happen. Although the number of rules reduced.785 THEN up IF Price ROC > -1.Avg. Another criterion for goodness of a rule is its fewer propositions. Number of instances measures generalizability of the rule.Table 4 Two examples of rules extracted directly from data Proposition Rule 3 for down (35.79 Total Entailing Instances 380 (76% of total) Average Entailing Instances 14. 13 .680 THEN down In the table 5 performances of the rules is summarized. In this case the number of rules has fallen to 24 rules.901 And EMA-CP > 50. It is a measure of goodness of the rule.07 Average Preposition In Each Rule 5 Almost half of the rules are induced in 6th level of the tree below the root. Rules with too many ands are hard to put to work.930 And Wilder RSI <= 73. <= 1702. it means than in half of the rules the branch is in the edge of the tree (limitation of 6 level was applied to the tree).254 And SMA <= 1092. Confidence is the probability of happening result of the rule.

Development of Expert System The extracted rules can be easily used as the rule base of an expert system. 2 and 3. TAES obtains … inputs from the user and stores the data in its working memory. Number of propositions in rules has reduced and thus rules are easier for use.79 0. i. Comparison of the two methods is summarized in figures 1. 1 Number of rules for each method 20 Instance 15 10 5 0 Direct from DT Fig. 2 Average rule confidence for each method Fig. The nature of technical analysis is feed-forward. confidence of the rules and the generalizability of the model have improved.2 As it can be seen.78 0. Then it searches 14 . 28 Number of rules 27 26 25 24 23 22 Direct from DT Confidence 0. the analyst is continually monitoring the market via technical indicators for finding opportunities.81 0.8 0. 6.82 0.e.96 Average Proposition In Each Rule 4. This way the analyst can use the system as a recommendation. Thus we built a feed-forward rule based expert system called TAES standing for technical analysis expert system. It can be used as a substitute for technical analysts or more usefully as a support to them.1 General features The feed-forward expert system is the system which derives results from the rules based on data provided by the user. The number of rules with 6 propositions is 2 (15%) compared to 6 (42%) which shows that this tree is more effective than the former and has reached rules before the constraint stopped it.Table 6 Rule set characteristics (extracted from neural network data) Number of Rules 24 Average Rule Confidence 0. Although the number of the rules is lower.82 Total Entailing Instances 407 (81% of total) Average Entailing Instances 16.77 Direct from DT Fig. these rules can effectively be used for more number of instances. 3 Average number of entailing instance for each method 6.83 0.

Another contribution can be reached via using other indicators. When the result is shown. It is also desirable to take costs and economical aspects into account and see if the model can be used as an analyst expert and if it is economically feasible. A snapshot of the interface can be seen in appendix. A good study can be carried out on the indicators and measure their performance and predictability. Appendix Below is a snapshot of the Technical Analyst Expert System 15 . Then rule extraction from the network was pursued and a rule set was generated from it. The model is simple. not merely up/down signal. more comprehensive tests can be carried out. It is good to develop a model that can predict the amount of change in the price.the rule base for compliance with the data and if it finds a suitable rule. Using fundamental indicators and data in addition to technical ones potentially can improve the model performance and is worthy to study. Each extracted rule has a confidence level. Acknowledgements MATLAB® Neural Network Toolbox and SPSS Clementine® softwares were used in this research for coding and development of neural network and decision tree models respectively. Conclusion and future research In this research we developed a neural network for predicting price trends of equities in Tehran Stock Exchange. User provides the system with data via this interface and can see the results in it and ask the system why a specific result was derived. its confidence is also available to the user. The system then tells what rule was fired to conclude that result and by which input data.e. especially VAMA which is becoming popular nowadays. the degree to which the rule is correct. In the rule induction section.2 User interface User interacts with the system via an interface. This kind of model can more effectively help analyzers in their decision. Moreover. TAES has the ability to provide user with confidence of the results. The expert system was also developed using MATLAB®. yet accurate. 6. 7. and using a feature selection paradigm to select other indicators. It is important that the interface is userfriendly. It is useful to compare the neural network presented in this research with ARIMA models which are the benchmark in this area and calculate how much improvement is made through the proposed model. the user can ask the system why a specific result has been derived. proving to perform better than a rule set derived directly from the raw data. the rule is fired and the results are shown to the user via system’s interface. i.

G. pp. Rezaee. 34. 139-154. Journal of Forecasting. Journal of Banking & Finance. 72. L. pp. 49(1). USA.H. [12] Enke. ‘Stock market volatility in a heterogeneous information economy’. pp. M. Celeste.6889-6898.P 2009. Journal of Finance. Journal of Expert Systems with Applications. Proceedings of GECCO’08. D 2008. L. [10] Craven.B 1995. pp.A & Dunham.T. P. M. Liu. 36. E. 12506-12509. 37. vol. Marcelo P. B. Technical Analysis from A to Z. Y. 36 pp. Special Issue on Data Mining. Future Generation Computer Systems. vol. [16] Grundy. Amirkabir University of Technology. Albuquerque. Weller. 36. D. Turksen. pp. vol. pp. 'DSS for portfolio selection'.B. 16 .Y. 2002. 1995. P. [13] Fazel Zarandi. ‘Using neural networks for Data Mining’. Amirkabir University of Technology. ‘Market statistics and technical analysis: the role of volume’. vol.B. Journal of Neurocomputing. D 2009 . vol. [15] Friesen.L. ‘How effective are neural networks at forecasting and prediction: A review and evaluation’. ‘D. 153-181. T & Enke. D. [8] Chavarnakul . S.H.L. vol. 1089-1100. J. 17. Journal of Expert Systems with Applications. Shavlik. MSc dissertation. Lin. Fan. [3] Aghemiri. V 2009. B. pp. Journal of Financial and Quantitative Analysis. vol. 33. ‘A type-2 fuzzy rule-based expert system model for stock price analysis’ Journal of Expert Systems with Applications. ‘The use of data mining and neural networks for forecasting stock market returns’. D. 1-27. M & Collopy. pp. 373-389. Soltero. [14] Fernández-Blanco.Technical Market Indicators Optimization using Evolutionary Algorithms’ . P. 927-940. M 1994. I. J. J. ‘A neural network with a case based dynamic window for stock trading prediction’. 481-495.C. R. pp. ‘Predicting the Brazilian stock market through neural networks and adaptive exponential smoothing methods’. Journal of Expert Systems with Applications. F 1998. M 2008. [2] Adya.. [4] Alizadeh. C.L 2008. Easley.M 2009. T & Enke. [7] Chang. S. S 2005.Snapshot of the TAES References [1] Achelis.‘A hybrid stock trading system for intelligent technical analysis-based equivolume charting’. Kim. Thawornwong. Albuquerque. E 2009. J. pp. [5] Andrews. Cavalcante. J. ‘Intelligent technical analysis based equivolume charting for stock trading using neural networks’. vol. MSc dissertation.C. 1997. 8(6). Gonzalez. [11] De Faria. vol. Knowledge-Based Systems. 29. Marcio P 2009. 3517-3528. Bodas-Sagi. 1004-1017. 'A model for stock categorization using data mining techniques'.P. Probus Publisher. Diederich J & Tickle A. C. F & Hidalgo. [9] Chavarnakul ..vol. [6] Blume.L. & O’Hara. ‘A survey and critique of techniques for extracting rules from trained artificial neural networks’. ‘Price trends and patterns in technical analysis: A theoretical and empirical examination’. Neshat. Vol. Journal of Expert Systems with Applications.

'Stock price behavior determination using stochastic process and chaos theory' MSc dissertation. Q. pp. 203-222. Technical Analysis: The Complete Resource for Financial Market Technicians. pp. 569-585. ‘Neural networks in business: a survey of application 1992-1998’. 2007.W. Journal of Neurocomputing.’ A stock recommendation system exploiting rule discovery in stock databases’.T 2009. P 2005. Elsevier Academic Press. Y & Jia. J. Amirkabir University of Technology. Journal of Engineering Applications of Artificial Intelligence. Mamaysky. pp. Driden Ed. [19] Kirkpatrick. 'Risk management modeling for securities' MSc dissertation. J. 'Utilizing fuzzy logic in using of technical analysis for stock selection' MSc dissertation. M & Purvis. pp.L. [44] Zareiee.H. ‘Microeconomic co-evolution model for financial technical analysis signals’. 304-315. 17. pp. J. Faraki. A 2008. A. & Vaughan. [21] Lee. Journal of Decision Support Systems. Journal of Information and Software Technology. 30.H 2007.R & Ragusa J. Journal of Financial Economics. vol. [37] Walczak. P 2010. Wang. 357-364. 17 . pp. J. ‘Foundation of technical analysis: computations. [23] Leigh. 55(4). [43] Yousefpour. ‘New Concepts in Technical Trading Systems’. 1140-1149. J 1999. 51. Journal of Expert Systems with Applications.S 1999. Journal of Expert Systems with Applications. vol. vol. FT Press.L 2000. 24. [45] Zhu.O. neural network. A 2008. Kim. 1015-1022. H 2008 'Portfolio selection and optimization using genetic algorithm' MSc dissertation. [25] McNelis. pp. 92. K. Amirkabir University of Technology. [18] Huang. Investment Analysis and Portfolio Management. vol. Journal of Decision Support Systems. G.581. S 2007.M. vol. 213-244. J & Tan. 361-377. ‘An analysis of a hybrid neural network and pattern recognition technique for predicting short-term increases in the NYSE composite index’ Omega. [29] Rotundoa. Journal of Economic Dynamics & Control. Journal of Expert Systems with Applications. 36. vol. 69-76. ‘Expert system for predicting stock market timing using a candlestick chart’. journal of Expert Systems with Applications.L & Chan. H 2009. vol. [31] Skouras. S. S.D & Dahlquist. 37. proceedings of Iran Data Mining Conference (IDMC`07). [33] Thammano. ‘A hybrid SOFM-SVR with a filter-based feature selection for stock market forecasting’. 25. J.M. [34] Timajchi. J. 567. 36. C. ‘Design and implementation of NN5 for Hong Kong stock price forecasting’. ‘Monthly minima & maxima stock prediction using Backpropagation & Genetic Algorithm hybrid’. vol. [26] Mohammadnia. Physica A. Y & Zhou. S 2001.H 2009.W. pp. ‘Stock market trading rule discovery using pattern recognition and technical analysis’. 51-70. 17.W 1987. 79-98. pp. vol. ‘Automatic stock decision support system based on box theory and SVM algorithm’. vol. pattern recognizer. Amirkabir University of Technology. ‘Financial returns and efficiency as seen by an artificial technical analyst’. 1529-1539. vol.H 2009. G. USA. P. 13-23. 587-591. 37. vol. Tsang. Park. Mak. Journal of Expert Systems with Applications. K 1989. Journal of Management Information Systems. Purvis. Proceedings of the artificial neural networks in engineering conference (ANNIE ’99).C. [38] Wang. Y. G 2009. ‘Parameter values of stock prediction model using backpropagation algorithm: a case study’. C.M 2002. Trend Research publications. vol. Expert Systems with Applications. 34. ‘Neuro-fuzzy model for stock market prediction’. Won.I. 20. M 2004. NG.F 2003. Z. MSc dissertation. [22] Leigh. Jo.W. and empirical implementation’ Journal of Finance. [35] Tsang. A 1999. pp. Wong. C. 32.. & Wang. H. statistical inference. J. ‘Mining stock price using fuzzy rough set system’. S 2001. 1705-1765. pp. pp. K. ‘Technical analysis: An asset allocation perspective on the use of moving averages’. vol. Lisboa. [28] Reilly. J 2000. J. 373.. [42] Yao. Yang. S. pp. M. pp. 16.R. P 2007. vol. A. [20] Lam. R. [24] Lo. [30] Saraiee. Kwan.[17] Ha. Paz. G & Ausloosb.L & Chan. ‘Neural network techniques for financial performance prediction: integrating fundamental and technical analysis’. P. [36] Vellido. Amirkabir University of Technology. vol. P. pp. ‘Forecasting the NYSE composite index with technical analysis. F. R 2007. Amirkabir University of Technology. vol. Yoon. & Tsai. C. J. [41] Wilder. T 2007. vol. Choy. S. Ashouri. [40] Wen. 5450-5455. pp. ‘Trading rule discovery in the US stock market: An empirical study’. S. algorithms. S. and genetic algorithm: a case study in romantic decision support’.’ Development of a fuzzy DSS/ES for selection and improvement of stock portfolio’. Kwok. [39] Wang. R 2002. 453-461. M 2007. pp. Y. Song. Faraki. M. proceedings of Iran Data Mining Conference (IDMC`07). ‘A case study on using neural networks to perform technical forecasting of FOREX’. pp.W. pp. ‘An empirical analysis of data requirements for financial forecasting with neural networks’. [32] Soleimani. 519-544. M.H. [27] Mokhtari. 33. Neural Networks in Finance: Gaining Predictive Edge in the Market. Journal of Expert Systems with Applications. Koong.

Are you sure?

This action might not be possible to undo. Are you sure you want to continue?

We've moved you to where you read on your other device.

Get the full title to continue

Get the full title to continue listening from where you left off, or restart the preview.

scribd