Modeling Stock Analysts' Decision Making: An Intelligent Decision Support System

It is well known that security analysis is a time-consuming and error-prone process. However, it can be improved or enhanced considerably by automated reasoning. Efforts to reduce the inaccuracy and incorrectness of analyses and to enhance the confidence levels of stock selection have led to the development of an intelligent decision support system called Trade Expert, which assists, not replaces, portfolio managers. Trade Expert assumes the role of a hypothetical securities analyst capable of analyzing stocks, calling market turns, and making recommendations. It has a knowledge base of stock trading expertise, and a case base of past episodes and consequences of decisions. By combining knowledge-based problem solving with case-based reasoning and fuzzy inference, Trade Expert demonstrates forms of intelligent behavior not yet observed in traditional decision support systems and expert systems. The novelty of this research lies in its application to analogical reasoning, fuzzy reasoning, and knowledge-based decision making.


Introduction
Over 60% of the families in the United States have billions of dollars invested in mutual funds. Consequently portfolio managers are under tremendous pressure to make critical investment decisions in dynamically changing financial markets. Experts have been forecasting and trading financial markets for decades, using their knowledge and expertise in recognizing patterns and interpreting current financial data. This paper describes a knowledge based decision support system with the analogical and fuzzy reasoning capabilities to be used in financial forecasting and trading. In an attempt to maximize a portfolio's return and avoid costly losses, the portfolio manager must decide when to enter trades as well as when to exit and thus, must predict the duration as well as the direction of stock price movement. A portfolio manager is faced with a daunting information management task and voluminous amounts of rapidly changing data. It is simply an impossible task to manually and simultaneously follow many investment vehicles, stocks and market moves effectively. To assist portfolio managers' decision making processes, tens of millions of dollars are spent every year on Wall Street to automate the process of stock analysis and selection. Many attempts have been made at building decision support systems by employing mathematical models and databases (Liu et al, 2010;Tan 2010). These traditional decision support systems are composed of three components: a database, a user interface, and a model base. The user interface allows the end user (in most cases, a manager) to select appropriate data and models to perform an analysis for a given stock. The database contains data necessary to perform the analysis, such as market capitalization, shares outstanding, price ratio, return on equity, and price to book ratio. The model base consists of mathematical models to deal with the present value of expected future payoffs from owning the stock, such as the dividend discount model, price-to-earning ratio(P/E) models, and their variants. Standard decision support systems employ quantitative approaches to decision making. Specific quantities in the form of payoffs and probabilities are used to arrive at a quantitative expected value. The decision maker simply selects the alternative that has the highest expected value. Despite the mathematical soundness and systematic approach of traditional decision support systems, researchers have discovered compelling reasons for developing qualitative approaches in decision making. It is inappropriate to suggest that people reason about decisions in a purely quantitative fashion. In the domain of security analysis and trading, if we expect a stock to go up in value, we are likely to invest in the stock despite not knowing quantitatively how much or how soon a stock will rise. A qualitative analysis of a decision problem is usually logically prior to a quantitative analysis (Sen, 2009). In order to develop a decision support system with the capabilities of qualitative analysis, considerable progress has been made toward developing "knowledge-based decision support systems", sometimes known as expert systems (Silverman, 1992). An expert system designed in the domain of security analysis is an intelligent decision support system whose behavior duplicates, in some sense, the ability of security analysts. Expert systems are computer programs with characteristics that include the ability to perform at an expert level, representing domain-specific knowledge and incorporating an explanation of conclusions reached. Traditional expert systems consist of five major components: an end user interface, an inference engine, a working memory, a knowledge base, and an explanation mechanism. The interface allows the end user to input data to and receive explanations or conclusions from the expert system. The working memory keeps track of specific data, facts and inferences relevant to the current status of the problem solving. The knowledge base contains problem-solving knowledge of a particular domain collected from an expert. The inference engine matches data in the working memory with knowledge in the knowledge base, and acts as the interpreter for the knowledge base. By combining the five components together, an expert system is able to act as a knowledgeable assistant and provide "expert quality" advice to a decision maker in a specific domain. Despite the impressive performance of expert systems, they have a number of inherent flaws, especially when operating in a dynamically changing environment. An expert system solves problems by taking input specifications and then "chaining" together an appropriate set of rules from the knowledge base to arrive at a solution. Given exactly the same problem situation, the system will go through the same amount of work to come up with a solution. In addition, traditional expert systems are "brittle" in the sense that they require substantial human intervention to compensate for even slight variations in descriptions, and break down easily when they reach the edge of their knowledge (Zhou, 1999). In response to weaknesses associated with traditional decision support systems and expert systems, this paper presents a knowledge-based and case-based intelligent decision support system with fuzzy reasoning capabilities called TradeExpert, designed for assisting portfolio managers to make investment decisions based not only mathematical models, but also facts, knowledge, experiences, and prior episodes.

Efficient market hypotheses and trading opportunities
Since the 1960's, the theory of Efficient Market Hypothesis (EMH) has been popular and well-known in the investment community (Eugene,1965;Malkiel, 1987). The basic idea behind EMH is that at any point in time, prices of stocks in an efficient market reflect the information from a variety of sources available to all investors involved in the market. According to EMH, past stock prices, movements, and patterns provide little or no guidance as to the direction of future prices. EMH asserts that stock markets are "informationally efficient". That is, one cannot consistently achieve returns in excess of average market returns on a risk-adjusted basis, given the information publicly available at the time the investment is made. The validity of the hypothesis has been questioned by critics who blame the belief in rational markets for much of the financial crisis of 2007-2010(Fox, 2009Nocera, 2009). Since the 1980's, there was a resurgence of interest in questions of the accuracy of www.intechopen.com EMH. A variety of empirical tests developed new and often elaborate theories that sought to explain subtle security-pricing irregularities and other anomalies. Market strategist Jeremy Grantham has stated flatly that the EMH is responsible for the current financial crisis, claiming that belief in the hypothesis caused financial leaders to have a "chronic underestimation of the dangers of asset bubbles breaking" (Nocera, 2009). More recently, institutional investors and computer-driven trading program appeared to be resulting in more anomalies. Anomalies may also arise from the market's incomplete assimilation of news about particular securities, lack of attention by market participants, difference of opinion about the meaning and significance of available data, response inertia and methodological flaws in valuation (Robertson & Wolff, 2006). Findings like the preceding suggest that the EMH is not perfect representation of market realities that behave as complex systems. Because security markets are complex, time-variant, and probably nonlinear dynamic systems, one simple theory cannot adequately represent their behavior; From time to time there may arise anomalies that are exploitable. In the design of TradeExpert, technical analysis rules, trend analysis rules, and fundamental analysis rules are used to exploit whatever inefficiencies may exist and unearth profitable situations. Technical analysis is the systematic evaluation of price, volume and patterns for price forecasting (Wilder 1978). There are hundreds of thousands of market participants buying and selling securities for a wide variety of reasons: hope of gain, fear of loss, tax consequences, short-covering, hedging, stop-loss triggers, price target triggers, broker recommendations and a few dozen more. Trying to figure out why participants are buying and selling can be a daunting process. Technical analysis puts all buying and selling into perspective by consolidating the forces of supply and demand into a concise picture. As a complete pictorial record of all trading, technical analysis provides a framework to analyze the battle raging between bulls and bears. More importantly, it can help determine who is winning the battle and allow traders and investors to position themselves accordingly. Technical analysis uses trading indicators and stock trading prices to analyze the stock trend. Trading indicators, e.g. Moving Average, Bollinger Bands, Relative Strength Index, and Stochastic Oscillator, provide trading signals which can be used to determine when to trade stocks. Trend analysis, also known as Momentum Trading (Simple, 2003), is the process by which major and minor trends in security prices are identified over time. The exact process of trend analysis provides investors with the ability to identify possible changes in price trends. As securities prices change over time it will exhibit one of three states: uptrend, downtrend or sideways consolidation. It is the job of the technical analyst to identify when a security may change from one trend to another as these may provide valid trading signals. Trend analysis uses a fixed trading mechanism in order to take advantages from long-term market moves without regards to past price performance. Trend analysis is a simplistic trading strategy that tries to take advantage of stock price movements that seem to play out in various markets. Trend analysis aims to work on the market trend mechanism and take benefits from both sides of the market. It gains profits from ups and downs of the stock market. Traders who use this approach can use current market price calculation, moving averages and channel breakouts to determine the general direction of the market and to generate trade signals. 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 reprice the www.intechopen.com security. One of the most important areas for any investor to look when researching a company is the financial statement of that company. Fundamental analysis is a technique that attempts to determine a security's value by focusing on underlying factors that affect a company's actual business and its future price. To summarize, technical analysis, fundamental analysis, and trend analysis do not really follow the theory of Efficient Market hypothesis. They attribute the imperfections in financial markets to a combination of cognitive biases such as overconfidence, overreaction, representative bias, information bias, and various other predictable human errors in reasoning and information processing.

System architecture
TradeExpert is a hybrid system that uses both quantitative and qualitative analysis to exploit changing market conditions and to grind through mountains of economic, technical and fundamental data on the market and on individual stocks. Furthermore, TradeExpert incorporates the mechanism of case-based reasoning which enables it to recall similar episodes from the past trading experience, and the consequences of that action. The goal, of course, is to ferret out patterns from which future price action can be deduced, to meaningfully assimilate vast quantities of information automatically, and to provide support intelligently for portfolio managers in a convenient, timely and cost-effective manner. TradeExpert assumes the role of a hypothetical securities analyst who makes a recommendation for a particular stock in terms of strong buy, buy, hold, sell and strong sell based on chart reading, fundamental analysis, investment climate, and historical performance. TradeExpert is designed and implemented based on principles consistent with those used by a securities analyst (Kaufman 2005). It is capable of reasoning, analyzing, explaining, and drawing inferences. In terms of system architecture, TradeExpert consists of the following major components: a user interface, databases, knowledge bases, a case base, a similarity evaluator, an explanation synthesizer, a working memory, and an inference engine, shown in the following diagram 1. The user interface provides communication between the user and the system. Input data from the user to the system contains the parameters of a stock under consideration, such as Yield, Growth rate, P/E, Return on net worth, Industry sector, Profit margins, Shares outstanding, Estimated earning per share, Price to book ratio, Market capital, Five-year dividend growth rate, Five-year EPS growth rate, and Cash flow per share. If a stock being analyzed is already stored in the database, TradeExpert retrieves data and fills in the parameter fields on the input screen automatically. The fuzzy inference component employs fuzzy logic and reasoning to measure partial truth values of matched rules and data. It makes reasoning processes more robust and accurate. The output from the system is a trading recommendation with a list of reasons justifying the conclusion. With human expertise in the knowledge base, past trading experience in the case base, and stock's data in the database, TradeExpert is capable of analyzing a stock, forecasting future price movements, and justifying the conclusion reached.

Knowledge bases and organization
The knowledge bases capture the knowledge of human securities analysts in the form of If-Then rules. In the design of TradeExpert, the knowledge base is divided into three separate www.intechopen.com knowledge bases: technical analysis knowledge base, fundamental analysis knowledge base and trend analysis knowledge base. TradeExpert can use any or all of these different but somewhat complementary methods for stock picking. For example it uses technical analysis for deciding entry and exit points, uses trend analysis for deciding the timing of a trade, and uses fundamental analysis for limiting its universe of possible stock to solid companies. As a justification of the expert system serving as a model of human thought processes, it is believed that a single rule corresponds to a unit of human knowledge. In the design of an intelligent decision support system, knowledge representation for human problem solving expertise is a critical and complex task.  In what follows, the knowledge representation of stock analysis and selection in TradeExpert is described along with a rule frame as an example (Trippi & Lee 1992 The key word INVESTMENT HORIZON designates the period of the investment: day trading, short term or long term. The key word INVESTMENT OBJECTIVES indicates the investment objective of the user, such as trading for profits, income, and capital appreciation. The key word REASONS provides justifications and explanations of how a rule arrives at a conclusion. The key word UNLESS excludes the stock even when the hypothesis(condition) part of a rule is satisfied. The key word CERTAINTY FACTOR contains a real number in the range of (0..1) measuring the strength of evidence in support of the rule's hypothesis. In order to invoke a rule, both the hypothesis part and the A S S U M P T I O N p a r t m u s t b e m e t . G i v e n a situation, investors may reach different conclusions and select different trading strategies based on different assumptions. Some examples are: "Can the Asian financial crisis be over in the next 12 months?", "Will the U.S. dollar be stronger or weaker over the next 3 months?", or "Will the FED cut interest rates at its next meeting?" Of course, different answers to these questions lead to different trading strategies. Since investing is a subjective process, TradeExpert allows the user to determine the future direction of financial markets and then select stocks accordingly. One of the rules in the knowledge bases is listed below: <downgrades-by-analysts > 2 in last 5 days> OR <earning-warning-by-peers > 1 in last 5 days>) (CERTAINTY-FACTOR: 0.85) With a set of reasons associated with the conclusion of a rule, TradeExpert is able to justify its reasoning by providing evidence and rational of its conclusion in addition to a certainty factor. In order to retrieve appropriate rules efficiently, the rules in TradeExpert are organized in a hierarchical structure. They are classified in terms of their scope and attributes. One rule designed for day trading may not be important at all for long-term investment and vice versa. A technical break out of stock price and daily price fluctuation may not have impact on long-holding investors. Classifying rules into different categories makes logical sense in terms of knowledge retrieval and maintenance. Of course, one rule may be indexed by multiple categories so that the match and evaluation steps during the inference process can be completed efficiently. Another factor for consideration is an investor's subjective judgmental call, such as the assessment and long term view of a www.intechopen.com particular market. Given current economic data and political environment, different investors market be up or down over the next 6 months?" will definitely elicit several answers from the investor community. A partial diagram that shows the knowledge organization (Trippi & Lee 1992) in TradeExpert is presented in figure 2.

Fig. 2. Knowledge Organization
It is worth noting the above diagram is a simplified version, many levels and branches of indices have been left out. Hot stocks that satisfy certain criteria such as high daily trading volume, large percentage price gain and belonging to a best-performing industrial sector are identified and collected daily.

Fundamental analysis knowledge base
There are two models of investing: growth-oriented and value-based. Growth-oriented investing seeks companies that show consistent earnings and sales growth, usually 20% or more per annum for the past three to five years. These stocks usually carry a high PE and have a record of better-than-average earnings growth. They usually beat analyst estimates by a large percentage quarter after quarter. Acceleration in earning growth often indicates the future upward price movements of a stock. Value-based investing looks for bargains and gravitates to stocks with a low price/ratio(P/E) and a low price-to-book value. As a foundation of growth-oriented and value-based investing, fundamental analysis relies on the following factors to make an evaluation: P/E, price-to-cash flow, market value-to-book, sales-to-price, debt ratios, yield, and projected earnings. It is a method of evaluating securities that attempts to measure intrinsic values by examining related economic, financial and other qualitative and quantitative factors. Fundamental analysis views the stock market as a relatively ordered system and each company is represented by factors such as financial ratios and performance measures, which are used to draw inferences. The rules in the fundamental analysis knowledge base are concerned with analysis of the company itself and deriving estimates of net worth per share, current assets, future earnings and dividends, and other related measures of value. The fundamental analysis rules attempt to estimate the future earning of a stock and therefore define a stock's true value. It performs analysis on industries or the economy as a whole. The term refers to the analysis of the economic wellbeing of a financial entity as opposed to its price movements. It does not pay attention to daily price movements and short term fluctuations. The investment horizon is often in the range of multiple years, not days and weeks.
Fundamental analysis serves to answer questions, such as:  Is the company's revenue growing?  Is it actually making profits?  Is it in a strong-enough position to beat out its competitors in the future?  Is it able to repay its debts? One of the rules in the fundamental knowledge base is listed below: Fundamental analysis is a technique that attempts to determine a security's value by focusing on underlying factors that affect a company's actual business and its future prospects. It believes that the intrinsic value of the stock eventually drives long-term stock prices. It looks at revenue, expenses, assets, liabilities and all the other financial aspects of a company to gain insight on a company's future performance and therefore, the stock's future price.

Technical analysis knowledge base
Fundamental analysis tells us what stocks are capable of but does not tell us just how high or low stock prices will go or when they will peak or bottom out. Technical analysis works in opposite principle of the fundamental analysis (Edwards & Magee, 1992). The underlying philosophy for this approach is that market prices well reflect all known factors at all times. So the price is already a solid performance indicator as a result of the supply and demand for that particular stock. Therefore technical analysis evaluates solely on market prices themselves rather than on any fundamental factor outside the market. The rules in the technical analysis knowledge base are concerned with studies of supply and demand for a stock and statistics which are related to price and volume. Technical indicators are tools invented on concept of technical analysis. There are many kinds of technical indicators that have been developed to gain insight about the market behavior. Each of them may have different concept about when to buy and sell (trading signals). Some well-known and widely used technical indicators are listed below briefly. Moving Average (MA) is used to remove market noise and find the direction of prices. It is calculated by sum up the stock prices over n days divided by n. Relative Strength Index (RSI) compares the magnitude of the stock's recent gains to the recent losses then turns into the number ranged from 0 to 100. It compares the magnitude of recent gains to recent losses in an attempt to determine overbought and oversold conditions of an asset. It is calculated using the following formula: RSI = 100 -100/(1 + RS*), where RS = Average of x days' up closes / Average of x days' down closes. If RSI is less than 30, it shows an oversold market condition. Stochastic Oscillator (SO) is an oscillator that measures the relative position of the closing price within a past high-low range. Volatility Index(VIX) is derived from the prices of ALL near-term atthe-money call and out-of-the-money call and put options. It is a measure of fear and optimism among option writers and buyers. When a large number of traders become fearful, then the VIX rises. Conversely, when complacency reigns, the VIX falls. The VIX is sometimes used as a contrarian indicator and therefore can be used as a measurement of how oversold or overbought the market is. Usually it increases as the market decreases. Its usefulness is in showing when a trend reversal is about to take place. One popular form of technical analysis is charting, in which the graphic display of past price performance, moving-average trends, cycles, and intro or inter-day stock price ranges are studied in an attempt to discern cues for profitable trading. Stock price pattern analysis is the basis of the technical analysis of stocks. It relies on the interpretation of some typical configurations of the ups and downs of price movements like "head and shoulders", "top and bottom formations" or resistance lines. Stock price pattern analysis comes down to comparing known patterns with what is evolving on the chart. Charting makes use of techniques such as moving indices, trend analysis, turning-point indicators, cyclical spectral analysis, and the recognition of various formations or patterns in prices in order to forecast subsequent price behavior. Some examples of patterns are assigned names such as "flag", "triangle", "double bottom or top", "symmetrical triangles", and "head-and-shoulders". The rules in the technical analysis knowledge base represent the expertise of chart reading without concerning the fundamentals of a company. By analyzing MA, RSI, SO, VIX, and trading volumes of a stock, the technical analysis rules suggest entry points as well as exit points, taking advantage of market fluctuations instead of being victimized by them. One technical analysis rule used by TradeExpert is presented below: Technical analysis maintains that all information is reflected in the stock price. Trends 'are your friend' and sentiment changes predate and predict trend changes. Investors' emotional responses to price movements lead to recognizable price chart patterns. Technical analysis does not care what the 'value' of a stock is. Their price predictions are only extrapolations from historical price patterns. Like x-rays and brain scans are used to diagnose diseases and seismic data is used to exploit oil, technical analysis is used to help determine the behavior and future price movements of a stock. TradeExpert as well as investors can use technical analysis to buy stocks and sell stocks at the most advantageous and profitable prices.

Trend analysis knowledge base
Instead of striving to predict a market direction, Trend analysis, also known as Momentum Trading, reacts to the market's movements whenever they occur (Eng 1993). It responds meticulously to what has recently happened and what is currently happening, rather than anticipating what will happen. Unlike the strategy "buy low and sell high" often employed in value-based investing, the trend analysis rules are based on a different approach: "buy high and sell higher." The basic rational behind this approach is based on the well known Wall Street statement: "go with the tape". That is, if you try to short a stock in an up trend, you will get killed. The same is true if you try to go long on a stock in a down trend. Since investing is an art not a science, a reasonable guess is that tomorrow will likely follow the trend established over the past few days. The stocks which have been strong relative to all other stocks should continue to be relatively stronger in the near future. Trend analysis rules reflect and implement this idea in TradeExpert. The rules in the trend analysis knowledge are designed and selected to recognize some short-term persistence in markets and to identify the stocks that may generate significant returns in a short period of time. Fortunes are made by those who recognize trends and ride them. In the period of 1997-1998, the internet sector was white hot. A company would have done much better if it could create a website than buying back its own stock to pop up its stock's price. The trend then was internet-related stocks. For example, the 400 plus percentage gain of Amazon and Yahoo, the gravity-defying internet stocks, was made in the first 10 months of 1998. These rules attempt to unearth stocks whose prices move far beyond any reasonable estimate of intrinsic value and often outperform the market index averages by a big margin in a short period of time.
In what follows, one formula used in trend analysis rules and momentum trading is presented (Schulmeister, 2002). It consists of a short-term moving average (MAS j ) and a long-term moving average (MAL k ) of past prices. The length j of MAS usually varies between 1 day (in this case the original price series serves as the shortest possible MAS) and www.intechopen.com 10 days, the length k of MAL usually lies between 10 and 30 days. (if one uses 30 minutes data, then Buy (go long) when the short-term (faster) moving average crosses the long-term (slower) moving average from below and sell (go short) when the converse occurs. Or equivalently: Open a long position when the difference (MAS j −MAL k ) becomes positive, otherwise open a short position. If one expresses this difference as percentage of MAL k one gets the moving average oscillator: This type of representation facilitates a (graphical) comparison of the signal generation between moving average models and momentum models. Another way to express the basic trading rule is then: Hold a long position when MONTENTUM is positive, hold a short position when MONTENTUM is negative. The second type of model works with the relative difference (rate of change in %) between the current price and that i days ago: The basic trading rule of momentum models is as follows (Carter, 2006): Buy (go long) when the momentum M(i) turns from negative into positive and sell (go short) in the opposite case. Or equivalently: Hold a long position when M is positive, hold a short position when M is negative. The variables MONMENTUM(j,k) or M(i) are called "oscillators" because they fluctuate around zero. The basic trading rule of moving average models and momentum models is trend-following since MONMENTUM(j,k) t and M(i) t , respectively, are positive (negative) only if an upward (downward) price movement has persisted for some days (or some 30 minutes intervals). When and how often MONMENTUM(j,k) t and M(i) t , respectively, cross the zero line depends not only on the persistence of recent price movements but also on the lengths of moving averages and the time span i in the case of momentum models, respectively. As an example, a rule in the trend analysis knowledge base is presented below:

RULE <45>
(ASSUMPTION: <bull market>) (INVESTMENT OBJECTIVES: <trading for profits>) (IF <growth_rate > PE> AND <Momentum > 0) AND <the industrial sector = Hot> AND <reported-peer-earnings = beat the estimate> AND <floating-shares = small> AND <estimated EPS = increase over last two months> AND <earning_release_day < 5 days> AND <average-daily-volume >= 1.5 average) THEN <Short term Strong Buy> ) (REASONS: <possible short squeeze> AND <Stock price is on uptrend> AND <momentum before earning release> AND <expectation of good earning report> AND <historical performance of hot stocks before earning> )

(UNLESS: <downgrades-by-analysts > 2 in last 5 days> OR <earning-warning-by-peers > 1 in last 5 days>) (CERTAINTY-FACTOR: 0.78)
Trend analysis observes a security price movement, times an exit and entry point, analyzes price change directions, and jumps on a trend and rides it for the purpose of making quick profits. It tries to profitably exploit the frequent occurrence of asset price trends ("the trend is your friend").Hence, this trading technique derives buy and sell signals from the most recent price movements which indicate the continuation of a trend or its reversal.

Object-oriented databases
The objected-oriented database contains financial data of industries and companies, such as the company name, debt ratio, price-earning ratio, annual sales, value to book value and projected earnings (Trippi & Lee 1992). An object in the database is defined by a vector of three components: <I, P, M>. The component I is a unique ID or name for the object, which may represent an industry or a company. The component P is a set of properties belonging to an object represented as a vector. The vector characterizes an object in terms of its attributes. The component M is a set of methods implemented by member functions. In addition to direct input, these functions are the only means of accessing and changing the attributes of objects. There are two kinds of objects in our database: industry-based objects and company-based objects. The company-based objects contain company-specific data, such as P/E ratio, projected growth rate, debt ratio, and annual sales. The industry-based objects contain data and information related to a specific industry, such as tax benefits, stage of life cycle, sensitivity to interest rates, legal liability, and industry strength. Examples of such objects are shown below: An industry-based object: (<ID> :-industry-name (xyz)) (<ATTIBUTES> :-(Tax-Benefits: (direct-input)) (Stage-in-life-cycle:(direct-input)) (total-sales: (method1)) (daily-volumes: (method2)) (Sensitivity-to-interest-rate: (direct-input)) (Potential-legal-liability: (direct-input)) (industry-strength: (method3)) (<METHODS> :-(method1: sum up sales from companies) (method2: sum up from related stocks) (method3: average up from companies) )) A company-based object: {(<ID> :-company-name <abc>) (<Attributes> :-(Sales: <database retrieval>) (Sales-growth-rate: <database retrieval>) (Debt-ratio: <database retrieval>) (Tax-benefits: <inherit from industry>) (High/low price: method1) (daily volume: method2) (industry-strength: <inherit from industry>) (number-shares-outstanding: <database retrieval>) (shares-sold-by-insiders-recently: <database retrieval>) (relative-strength: method3) (gross-margin-on-sales: <database retrieval>) (<Methods> :-(method1: update-daily-price) (method2: update-daily-volume) (method3: calculate-average-strength) )} In the object-oriented database, company objects and industry objects are organized in a hierarchy where industry objects are at higher levels and related company objects are considered subclasses. Each object represents either an industry sector or a company. Specific objects have descriptive attributes and methods that they can invoke to perform certain tasks. These attributes and methods are inherited from super classes to subclasses. Thus, the principles of inheritance, average up, and sum up will apply. For example, to obtain the total sales figure, the function Sum-up-sales-from-companies would be invoked to calculate the total sales from all companies indexed by the industry object. On the other hand, all the indexed company objects would inherit the parent object's attributes, such as industry-strength, tax-benefits, and sensitivity-to-interest-rate which are applicable to every company within the same industry sector.

Case base and case-based reasoning
The process of developing an effective trading system must take into consideration the current situation and past data. History often repeats itself. Similar behaviors may occur again despite not being in the same domain or industry. Lessons learned in the past can provide useful guidance in terms of a stock price changes over time. The difference between a recent business school graduate and a seasoned securities analyst is that the former has learned everything from textbooks and knows the rules of securities analysis and trading, while the latter knows all this but in addition, has experienced up markets as well down markets. Therefore, the seasoned analyst has witnessed thousands of trading episodes which supply a rich context for recognizing and analyzing new problems. TradeExpert employing case-based reasoning(CBR) provides a contrast to traditional expert systems and is analogous to comparing an experienced analyst to a new MBA. Being a cognitive model of human securities analysts, TradeExpert is capable of recalling similar cases seen in the past, retrieving and modifying the results of those cases and then deducing the reasoning behind those results (Kolodner 1983). If no solution is found, TradeExpert does not give up like a traditional expert system, instead it employs a heuristic approach in which reasoning can be guided, past experiences can be recalled, and solutions to new and similar problems can be constructed. A case in the case base can be described as follows: A case C i represented by an object consists of a set of attributes A i , a recommendation R i made by a security analyst, a performance figure P i that measures the security's performance after the recommendation, and a list of methods that perform related computation. The attributes vector A i represents financial data and characteristics of the security under consideration. The performance value P i measures the performance of the security after recommendation in terms of the price change percentage. A methods M i is implemented by a function that provides means to access databases or updates the data of the case. The justification J i lists reasons and explanations on how and why the analyst arrived at the recommendation. Analogical problem solving is one of the most complex techniques in human cognition. Yet, people have no difficulties in recalling similar episodes as new problems occur and applying them where appropriate. The design of similarity evaluation in TradeExpert is psychologically motivated and experimentally tested. The similarity evaluator, as shown in the system architecture diagram, consists of two parts: an external impact evaluator and a feature evaluator. The external impact evaluator is concerned with the impact of external forces on the performance of stocks and is not directly related to the fundamentals of companies, such as political pressures from the federal government, international events, or economical conditions. An example of the cases in the case base is presented below: In 1962, President John Kennedy declared war on steel companies blaming the higher labor cost and management. The sudden change of federal policy caused the steel stock prices to drop more than 50% in a very short period of time and remained low for months to come. This case remembers the consequences of an unfavorable drastic change in federal policy toward a particular industrial sector, and the dramatic price decline in the months ahead. In 1992, President Bill Clinton proposed a reform to national healthcare widely seen as criticism of pharmaceutical industry's practice and pricing. Consider the following pairs: presidents(John Kennedy, Bill Clinton) federal policies(against the steel industry, against the pharmaceutical industry), one could easily see the consequence of political pressure on the price of affected stocks. When given a drug manufacturer's stock, TradeExpert is able to draw inferences from its past experience and to make a SELL recommendation based on the historical lessons learned. The days that follow show the significant price decline of all pharmaceutical stocks in the next 12 to 18 months. Without the case-based reasoning mechanism, a decision support system would not be able to make such a predication since these two industry sectors are very different in terms of basic attributes, such as industrysector, R/D spending, price-competition and long-term growth rate. In addition to the external impact evaluator, TradeExpert also employs a feature matching process. The similarity score is determined by a combination of features in common and the relative importance, expressed by weights, of these features (Simpson, 1985). Formally, the feature evaluator can be described as follows.
Thus, a similarity score, S(N,O), of a new case N with respect to an old case O is given as: where  i is a weight assigned to the i th feature of a case. With the case-based reasoning mechanism built in, TradeExpert is able to accumulate vast and specialized expertise in the domain of stock analysis and trading, and to apply it to new situations. A case in point is the similar price movements of casino stocks in the early 90's and internet stocks from the period of 1997-2000. Both sectors have many attributes in common, such as expected high growth rates, high P/E, daily volumes far exceeding average trading volumes, a record of better-than-average earnings, and investors' favorable sentiments. By employing the feature similarity evaluator, TradeExpert is able to identify the upward price movements of internet-related stocks, while ignoring unbelievably high P/Es associated with them. As hot stocks in different periods of 90's, many stocks in these two sectors generated 3-digit returns in a matter of 12 months. Another example of analogical reasoning can be found in the banking sectors both in Great Depression of 30's and in Great Recession of 2007-2010. During these years, the stocks of all banks went down and stayed low for a long period of time. With regard to particular stocks, let us consider the examples of Google (GOOG) and Baidu (BIDU), a Chinese search engine. Having observed an impressive run by GOOG, it can be predicated with confidence that an IPO of BIDU would do very well considering the dominant market presence and the customer base. Indeed, Bidu actually went from $12(split adjusted) in 2005 to a high of $118 in 2011. In general, given a stock, TradeExpert searches for similar cases in the case base, establishes correspondence between past experience and the stock currently under consideration, and then transforms related experience to a recommendation for the stock.

Fuzzy reasoning and inference
Many decision-making tasks of investors are too complex to be understood quantitatively. However, humans succeed by using knowledge that is imprecise rather than precise. Fuzzy logic refers to a logic system which represents knowledge and reasons in an imprecise or fuzzy manner for reasoning under uncertainty (Baldwin, 1981). Unlike classical logic which requires a deep understanding of a system, exact equations, and precise numeric values, fuzzy logic incorporates an alternative way of thinking, which allows modeling complex systems using a higher level of abstraction originating from our knowledge and experience. Fuzzy systems, including fuzzy logic and fuzzy set theory, provide a rich and meaningful addition to standard logic (Zadeh,1963). The applications which may be generated from or adapted to fuzzy logic are wide-ranging, and provide the opportunity for modeling of conditions which are inherently imprecisely defined. TradeExpert with fuzzy reasoning capabilities allows expressing this knowledge through subjective concepts such as very expensive and a significant below the market average which are mapped into exact numeric ranges. Since knowledge can be expressed more naturally by using fuzzy sets, many decision making problems can be greatly simplified. Fuzzy logic provides an inference morphology that enables approximate human reasoning capabilities to be applied to knowledge-based systems. The theory of fuzzy logic provides mathematical strength to capture the uncertainties associated with human cognitive processes, such as thinking and reasoning. The conventional approaches to knowledge representation lack the means for representing the meaning of fuzzy concepts. As a consequence, approaches based on first order logic do not provide an appropriate conceptual framework for dealing with the representation of commonsense knowledge, since such knowledge is by its nature both lexically imprecise and non categorical. The development of fuzzy logic was motivated in large measure by the need for a conceptual framework which can address the issue of lexical imprecision. Decision support systems have been the most obvious recipients of the benefits of fuzzy logic, since their domain is often inherently fuzzy. To summarize, in fuzzy logic:  exact reasoning is viewed as a limiting case of approximate reasoning.  everything is a matter of degree.  knowledge is interpreted a collection of elastic or, equivalently, fuzzy constraint on a collection of variables.  Inference is viewed as a process of propagation of elastic constraints.  Any logical system can be fuzzified.

Fuzzy logic and degree of truth
English abounds with vague and imprecise concepts, such as "The p/e(ratio of price and earning per share) of this stock is low" or "The outstanding share of this company is small." Such statements are difficult to translate into more precise language without losing some of their semantic value: for example, the statement "p/e is 6.9." does not explicitly state that the stock is traded at a cheap price. It is fraught with difficulties. Let us assume the average p/e of all public traded stocks is 20. The p/e of 5 is considered low and the p/e of 40 is high. How would a stock with the p/e of 16 be ranked? What about a stock with the p/e of 25?
The use of fuzzy logic allows for more gradual changes between categories and allows for a representation of certainty in the rule consequence through the ability to fire rules with varying strength dependent on the antecedents. One of the major tasks in the design of TradeExpert is to codify the investor's decision-making process. Exact reasoning strategies that make use of standard probability theory. A common approach is the certainty factor(CF) in rule-based systems. CF has a value between -1 and +1, representing 100% false and 100% true respectively. Degrees of truth are often confused with probabilities. However, they are conceptually distinct; fuzzy truth represents membership in vaguely defined sets, not the likelihood of some event or condition. Approximate reasoning is needed when the assumptions necessary to apply a probability based approach cannot be met. Fuzzy reasoning uses a collection of fuzzy membership functions and rules (instead of Boolean logic) to reason about data.
There is an important distinction between fuzzy logic and probability. Both operate over the same numeric range, and at first glance both have similar values: 0.0 representing False (or non-membership), and 1.0 representing True (or membership). However, there is a distinction to be made between the two statements: The probabilistic approach yields the natural-language statement, "There is an 80% chance that the stock looks attractive" while the fuzzy terminology corresponds to "The stock's degree of membership within the set of attractiveness is 0.80." The semantic difference is significant: the first view supposes that the stock is attractive or not; it is just that we only have an 80% chance of knowing it. By contrast, fuzzy terminology supposes that the stock is "more or less" attractive, or some other term corresponding to the value of 0.80. Further distinctions arising out of the operations will be noted below. For independent events, the probabilistic operation for AND is multiplication, which (it can be argued) is counterintuitive for fuzzy systems. For example, let us presume that x is a company, S is the fuzzy set of high_p/e companies, and T is the fuzzy set of investorpreferred companies. Then, if S(x) = 0.90 and T(x) = 0.90, the probabilistic result would be: whereas the fuzzy result would be: The probabilistic calculation yields a result that is lower than either of the two initial values, which when viewed as "the chance of knowing" makes good sense. However, in fuzzy terms the two membership functions would read something like "x is a high-growth company" and "x is an investor-preferred company." If we presume for the sake of argument that "very" is a stronger term than "fairly," and that we would correlate "fairly" with the value 0.81, then the semantic difference becomes obvious. The probabilistic calculation would yield the statement If x is a high-growth company and x is an investor-preferred company, then x is a fairly highgrowth, investor-preferred company.
The fuzzy calculation, however, would yield If x is a high-growth company and x is an investor-preferred company, then x is a very high-growth, investor-preferred company.
Another problem arises as we incorporate more factors into our equations (such as the fuzzy set of actively-traded companies, etc.). We find that the ultimate result of a series of AND's approaches 0.0, even if all factors are initially high. Fuzzy theorists argue that this is wrong: that five factors of the value 0.90 (let us say, "very") AND'ed together, should yield a value of 0.90 (again, "very"), not 0.59 (perhaps equivalent to "somewhat"). Similarly, the probabilistic version of A OR B is (A+B -A*B), which approaches 1.0 as additional factors are considered. Fuzzy theorists argue that a sting of low membership grades should not produce a high membership grade. Instead, the limit of the resultant membership grade should be the strongest membership value in the collection. Another important feature of fuzzy systems is the ability to define "hedges," or modifier of fuzzy values (Radecki, 1982). These operations are provided in an effort to maintain close ties to natural language, and to allow for the generation of fuzzy statements through mathematical calculations. As such, the initial definition of hedges and operations upon them will be a subjective process and may vary from one statement to another. Nonetheless, the system ultimately derived operates with the same formality as classic logic. For example, let us assume x is a company. To transform the statement "x is an expensive company in terms of its p/e" to the statement "x is a very expensive company in terms of its p/e. The hedge "very" can be defined as follows: Thus, if Expensive(x) = 0.8, then Very_Expensive(x) = 0.64. Similarly, the word "more or less" can be defined as Sqrt(Expensive(x)). Other common hedges such as "somewhat," "rather," and "sort of," can be done in a similar way. Again, their definition is entirely subjective, but their operation is consistent: they serve to transform membership/truth values in a systematic manner according to standard mathematical functions. From the above discussion, it is clear that fuzzy logic can describe the investor's decision making process in a more natural and accurate way than the probability theory.

Fuzzy linguistic variables and membership
Fuzzy logic allows for set membership values to range (inclusively) between 0 and 1, and anything in between representing linguistic and imprecise terms like "slightly", "quite" and "very". Specifically, it allows partial membership in a set. It is related to fuzzy sets and possibility theory. Fuzzy logic is a form of multi-valued logic derived from The memberships of the above formulas can be shown below: Fuzzy logic is a form of mathematics that let computers deal with shades of gray. It handles the concept of partial truth -truth values between completely true and completely false. As an example, consider a p/e of 17, it yields the following fuzzy values: PE low (17) = 0.3 and PE avg (17) = 0.7 A p/e of 17 is considered 30% in the low range and 70% in the middle range. It shows a linguistic term can simultaneously belong to more than one category while exhibiting different degrees. By converting linguistic terms into numerical values, it permits TradeExpert to conduct reasoning and inference quantitatively, and to allow conflicting rules to be fired jointly.
Fuzzy set theory provides a host of attractive aggregation connectives for integrating membership values representing uncertain information. These connectives can be categorized into the following three classes union, intersection and complement connectives. Union produces a high output whenever any one of the input values representing degrees of satisfaction of different features or criteria is high. Intersection connectives produce a high output only when all of the inputs have high values. Complement connectives are defined as 1 minus the fuzzy value of its argument. More formally, these three basic fuzzy operators are defined below: Some of these operators provide compensation that has the property in which a higher degree of satisfaction of one criterion can compensate for a lower degree of satisfaction of another criterion to a certain extent. In that sense, union connectives provide full compensation and intersection connectives provide no compensation. In a decision process the idea of trade-offs corresponds to viewing the global evaluation of an action as lying between the worst and the best local ratings. This occurs in the presence of conflicting goals when compensation between the corresponding compatibilities is allowed. More operators known as Contain, Empty and Equal are listed below: With these fuzzy operators, a decision support system can provide structured ways of handling uncertainties, ambiguities, and contradictions.

Fuzzy rule reasoning and deduction
TradeExpert is a rule-based decision support system that uses a collection of fuzzy sets and rules for the reasoning of data. Fuzzy logic in TradeExpert allows conclusion(s) to be reached from premise(s) with a gradation of truth. The rule's premises describe to what degree the rule applies while the conclusion assigns a membership function to each of one or more output variables. Compared to standard rule-bases systems, it allows multiple rules to be fired jointly as long as they exceed the predetermined threshold. When TradeExpert is used to solve real problems, the following steps are generally followed: First, one needs to provide investment parameters, such as objectives, assumption, investment horizon and etc in a linguistic or mathematical form.  Under FUZZIFICATION, Convert numeric data to literate words using fuzzy membership functions, and determine the degree of truth for the word. It calculates the degree to which the input data match the condition of the fuzzy rules.  Under INFERENCE, the truth value for the condition of each rule is computed using AND, NOT or OR, and applied to the conclusion part of each rule. The result is one fuzzy subset to be assigned to the output variable for each rule. The output of each rule is scaled by the rule condition's computed degree of truth.  Under COMPOSITION, all of the fuzzy subsets assigned to the output variable are combined together to form a single fuzzy. The operation SUM takes the point wise sum over all of the fuzzy subsets.  DEFUZZIFICATION: convert the fuzzy output set to a numeric value. TradeExpert uses the MAXIMUM method. It selects the maximum value of the fuzzy sets as the crisp value for the output variable. Unlike most rule-based systems, threshold values define the minimum required membership of the premises an investor would expect for that particular rule to be fired. The minimum requirements are generally defined by subjective criteria. With fuzzy functions, it is possible that several rules may be fired concurrently with different certainty factors. The following diagram shows how the fuzzy reasoning component works in TradeExpert: To illustrate this process, let us consider the following simplified rules stored in the fundamental knowledge base and the fuzzy functions PE(x) as described before and Yield(x) which is defined below:  TradeExpert believes that the yield of the given stock is considered 20% in the average range and 80% in the high range compared to all publicly traded stocks. Its P/E is ranked 70% in the low range and 30% in the average range. By matching these words to the rules listed above and applying the operator AND, the non-zero truth value of each rule is listed below: Rule 1 has the truth value of 0.7 and Rule 3 has a truth value of 0.3. In other words, TradeExpert would issue a Strong Buy recommendation with a 70% certainty based on the experts' opinions and expertise stored in the fundamental knowledge base. Rule 3 was fired too but its conclusion had not been accepted due to a predetermined minimal threshold of 55%.

Conclusion
The development of TradeExpert demonstrates the effectiveness and value of using analogy in an intelligent decision support system, particularly in situations of imprecision, dynamics, or lack of perfectly-matched knowledge. TradeExpert shows its ability to manipulate two kinds of knowledge over time: episodic information and evolving experience. The system becomes "wiser" as more cases are added to the case base. With a research area as new as case-based reasoning in intelligent decision support systems, it often raises more questions than answers. Future research includes but is not limited to the following topics: how to dynamically adjust the weights associated with the features of cases, how to automatically index and store cases to facilitate efficient retrievals and searches, and how to modify the rules in knowledge bases with minimal intervention from human experts. In conclusion, the work reported in this paper discussed several important issues in the design of intelligent decision support systems, proposed and implemented solutions to these problems, and demonstrated the usefulness and feasibility of these solutions through the design of TradeExpert.