141x Filetype PDF File size 0.62 MB Source: www.csse.uwa.edu.au
A Game-Theoretical Approach for Designing Market Trading Strategies Garrison W. Greenwood and Richard Tymerski Abstract—Investors are always looking for good stock market Computational intelligence (CI) offers a variety of useful trading strategies to maximize their profit. Under the technical techniques for constructing trading rules via technical ap- school of thought trading rules are developed by studying proaches. For example, Allen and Karjalainen [2] created historical market data to find trends that investors can exploit. trading rules using genetic programming. The goal was to These market trends tend to appear when certain features develop a function that returns either a ’buy’ or ’sell’ signal. (narrow range, DOJI, etc.) appear in the historical data. Unfortunately, these features often appear only in partial form, (Decisions to ’hold’ a stock were not implemented.) The which makes trend analysis challenging. difference between an excess return1 and a simple buy-and- In the paper we co-evolve fuzzy trading rules from market hold strategy2 over a finite training period measures the trend features. We show how fuzzy membership functions fitness of a rule. The authors claim their evolved rules had naturally handle partial form features in historical data. The co- reduced trading volatility, but their rules do not lead to higher evolutionary process is formulated as a zero-sum, competitive absolute returns than a buy-and-hold strategy. Not to be game to match how trading strategies are evaluated by broker- age firms. Our experimental results indicate the co-evolutionary deterred, the authors claim some investors may still find their process creates trading rule-bases that produce positive returns rule-base worthwhile. when evaluated using actual stock market data. Potvin et. al [3] also tried genetic programming to evolve I. INTRODUCTION investment rules. Their method was computationally ex- The recent emergence of online trading has made the pensive and tended to converge prematurely (no reported stock market accessible to small investors. Brokerage firms improvements after 50 generations). They too showed poorer work on behalf of investors to purchase quantities of a performance than a buy-and-hold approach, especially in a single stock. (Investors pay a small fee for every transaction.) rising market. The authors claim their trading rules were Somediscountbrokeragefirmsprovidelittleornoinvestment “generally beneficial”, but only when the market is stable advice, which means it is up to the small investor to come or falling. up with their own investment strategies. Other brokerage Dourra and Siy [4] used fuzzy logic to create a trading firms do advise investors when to buy or sell stock, but strategy. The system inputs were momentum indicators, such the underlying strategy is proprietary and for that reason is as the rate of change of stock prices over a defined period. not disclosed to outsiders. Strategies are continually refined Gaussian membership functions and a fuzzy rule-base, hand- because markets can be volatile and good strategies that pro- crafted from expert’s knowledge completed the system. A duce high returns tend to attract more investment dollars— Mamdani fuzzy implication method output a single value and higher commissions for the brokers! between 0 (strong sell) and 100 (strong buy). Their fuzzy There are two schools of thought on developing investment system was evaluated on 3 years of stock prices from strategies. In the fundamental approach decisions about several different companies. The investment returns, based buying, selling or holding a company’s stock arise from a on buy or sell recommendations from the fuzzy system, careful analysis of the the company’s books. On the other were exceptionally high—some yielding over 250% returns! hand, in the technical approach studying a company’s past However, those returns should come as no real surprise since trading activity can help predict future stock prices. In this the membership functions were deterministically adjusted to paper we focus on the technical approach. fit the training data. Consequently, the membership functions For decades people have proposed various technical trad- used for the Intel Corporation stock were different from ing rules but the majority of this literature has found that, for those used for the General Motors stock. Moreover, the rule the most part, the investment rules just don’t work. Indeed, antecedents were very sophisticated—some involved both one researcher [1] even went so far as to dismiss technical conjunctions and disjunctions of fuzzy variables—but the investment rule methods entirely! But the advent of more authors did not say how those rules were derived. powerful and inexpensive computers has promoted new and Lam [5] also constructed a fuzzy trading rule-base, but powerful data mining methods that can search high frequency the rule-base was evolved with a genetic algorithm that market data for trading activity patterns. The reported demise selected a subset of rules from a set of 36 pre-defined fuzzy of the technical school of thought was clearly premature. 1A risk-free return is the return of an asset, such as T-bills, with no risk whatsoever. An excess return is the return received over and above a G. Greenwood and R. Tymerski are both with the Electrical & Computer risk-free return. Engineering Department at Portland State University, Portland, OR 97207– 2In this strategy the investor buys a stock and then holds it for a long 0751 USA (email: greenwood,tymerski@ece.pdx.edu) time period, hoping to outlast any market fluctuations. 978-1-4244-2974-5/08/$25.00 ©2008 IEEE 316 rules. The antecedent of each rule was a conjunction of even give a false picture of how good a strategy actually is. several moving average trends such as daily moving average, An example will help illustrate the problem. weighted moving average and exponential moving average. Suppose two brokerage firms independently evolve a set Other fuzzy rules had antecedents with momentum terms of investment strategies. Assume the best performing strategy such as relative strength index, rate-of-change and fast and from the first brokerage firm consistently yields a 4% return slow stochastic. The output (consequent) of each rule was over a 90-day trading period. If fitness is proportional to a buy, sell or hold order using the Sugeno method of fuzzy returns, then this strategy, by definition, has the highest inference. The system outperformed a buy-and-hold strategy, fitness. But does a 4% return really qualify as high fitness? but it is not clear how the system is trained. The author claims The only way to know for certain is to compare that 4% the system was trained for m days and then applied to trade return against what the other brokerage firm can offer. If the for n more days before re-training(?) It was never stated how best strategy from the second firm only has a 1.5% return, the fitness for the m training days relates to the fitness for the then 4% is pretty good and should signify high fitness. On the n trading days. The paper is useful only from the standpoint other hand if the second firm can offer a 7% return strategy, it shows the potential of evolving fuzzy trading rule-bases. then a 4% return does not qualify as high fitness. In this paper we describe some preliminary work using a It is important to differentiate between the relative fitness coevolutionary algorithm to evolve a family of fuzzy trading and the true fitness of an investment strategy. Relative fitness rule-bases, each of which serves as a unique trading strategy. compares returns from strategies within a single brokerage Researchers in the past have evolved just a single popu- firm whereas true fitness contrasts returns from strategies lation of strategies. What differentiates our work from all between independent firms. Investors compare the returns previous evolved rule-base work is we coevolve independent achieved by various brokerage firms before deciding where to populations of strategies under a game-theoretical environ- invest their money. Hence, true fitness measures the ability to ment. This approach seems quite natural because of the attract investor dollars. Survival, therefore, should depend on close relationship between competitive coevolution and game true fitness rather than relative fitness. The point here is there theory. Indeed, evolutionary game theory can help explain the is no way to say whether or not a given return constitutes underlying dynamics of coevolutionary algorithms [6]. From high fitness unless it is compared against the returns from a practical standpoint coevolution makes perfect sense since competing brokerage firms. Consequently, strategies should it closely matches how investment firms develop their own arise from competitive coevolution [7]. internal strategies. This aspect is discussed further in the next Stock market investment is naturally expressed as a game. section. Experimental results are included to demonstrate our The players are brokerage firms, which independently de- proposed method. velop investment strategies. Strategies compete against each other in the marketplace and receive payoffs in the form of greater or fewer investor dollars depending on how well II. WHY USE GAME THEORY TO DEVELOP TRADING they perform. (Poor strategies lose investments as investors STRATEGIES? switch to better performing strategies.) Hence, stock market Investment counselors, working for brokerage firms, de- investment is essentially a zero-sum game with the strategies velop trading strategies for stock market investments. Good formed through competitive coevolution. trading strategies attract more investor dollars while poor NOTE: In some games players make decisions strategies discourage further investments. Each firm inter- based on historical data, which is common knowl- nally develops not just one, but a set of investment strategies edge. One of the best examples is the widely to deal with market volatility. For example, the firm will need studied minority game [8]. The stock market game one strategy to deal with investments in a bull market, where formulated here belongs to this same family of stock prices generally rise, and another strategy for bear games. markets, where stock prices generally fall. Investment coun- selors adapt their individual trading strategies based on how III. PROBLEM FORMULATION well those strategies perform. The collective strategies from The objective is to design a strategy for trading shares of a all of the investment counselors comprises the investment single stock. Stock price data, recorded over a large number services a brokerage firm offers to a potential investor. This of consecutive trading days, is available to help develop the process can be envisioned as an evolving set of strategies strategy. The strategies are based on finding conditions in where fitness is measured by the returns derived by using market historical data that predicts subsequent up-trend days3 the strategy to make investment decisions. Appropriate investments (or positions) are taken only on the But how does a brokerage firm know if an evolved set of open of a predicted trend day and are exited at its close. strategies is any good? That question illustrates the problem Four data items were recorded each day: the open share with evolving a single population of trading rules. Intuitively price (O), the high (H) and low (L) for the day and the strategies that provide the greatest returns are the most appealing and would be assigned high fitness. But defining 3In this work we did not attempt to find down-trend days, which would fitness proportional to returns is overly simplistic and may require a different set of strategies. 2008 IEEE Symposium on Computational Intelligence and Games (CIG'08) 317 closing share price (C). Two types of trading days are of O[−1] > H[0] + δ. In both cases 0 ≤ δ ≤ 10 is user interest: selectable. Definition: (up-trend day) IV. FUZZY SYSTEM DESIGN O≤L+0.1(H−L) (1) Given stock market historical data, it is always possible C≥H−0.2(H−L) to (deterministically) analyze it and mark where any of the features described in the previous section are present. But a Definition: (down-trend day) more subtle and challenging problem must be dealt with. The rule-base contains a set of fuzzy rules that predict whether O≥H−0.1(H−L) (2) the next trading day is likely to be a trend day. Investment C≤L+0.2(H−L) decisions—i.e., whether to buy, sell or hold—are made based Qualitatively, this simply means for an up day the opening on these predictions. Fuzzy rules are used because crisp rules price is close to the day’s low and the closing price is close to are too restrictive. An example will help fix ideas. the day’s high. Similarly, for a down-trend day the opening The crisp rule “if NR7 then ...” is true if and only if is at or near the high and the close is near or at the low for the range during the current day R[0] is less than the range the day. An interesting property of trend days—which keen during any of the previous six days R[1],R[2]...R[6]. The investors can exploit—is the high-low differential tends to rule won’t be true if even one of the previous ranges is less be relatively large. than R[0]. But suppose the inequality is satisfied for say five Studies have identified several trading data features that out of the six days, which makes the antecedent almost true? often proceed up or down-trend days. These features, de- As another example, Nison [9] asked scribed below, are defined in terms of O,C,H and L. Today “How do you decide whether a near-DOJI day is indexed with i = 0 and previous days are indexed i = 1,2, (that is, where the open and close are very close, and so on. O(−1) denotes the next trading day opening price. but not exact) should be considered a DOJI? This • NRk is subjective and there are no rigid rules....” With H[i] and L[i] denoting the high and low for the Fuzzy reasoning can effectively deal with such uncertain- i-th day, the range is defined as R[i] = H[i] − L[i]. ties. Crisp rules, which must give either a ’yes’ or a ’no’ NRk exists if today’s range is less than the ranges for answer, cannot handle these situations but fuzzy rules can the previous k − 1 days. That is, because they can also provide fuzzy answers somewhere in between a ’yes’ or ’no’. R[0] < min(R[1],...,R[k −1]) (3) In our approach stock market data is analyzed to determine how closely it matches the formal definitions of the features NRk days represent volatility contraction, which often- described in the previous section. Membership functions times leads to volatility expansion in the form of wide return a value between 0 and 1 indicating to what degree range days. The greater the number of narrow range features are present. The resultant fuzzy variables are then days, the greater the counter reaction in wide ranging collected into fuzzy if-then rules, which constitutes the trad- days. ing rulebase. The outputs of active rules—i.e., rules whose • DOJI antecedent are satisfied—are combined into a fuzzy output DOJI indicates that the open and close for the trading variable. This variable is defuzzified to produce a crisp value day are within some small percentage (x) of each other. on the unit interval, which the desirability of buying stock A DOJI means the market reflects temporary price on the next trading day. indecision and often signals a major reversal in the A. Membership Functions market. DOJI is a predicate function—i.e., it returns 1 Fuzzification is the process that maps days (D) onto (TRUE) or 0 (FALSE). It is defined as the unit interval via a membership function µ(D). More 1 |O−C|≤x·(H−L) precisely, D represents the number of previous days that DOJI(x) = 0 otherwise (4) a particular feature is satisfied. For instance, for the NR7 feature D ∈ {0,1,...,6}. Then µ(0) = 0 means the NR7 • Hook day definition was not satisfied during any of the six previous A hook day occurs when the price opens outside the days, µ(6) = 1 means the definition was satisfied during previous day’s range and then proceeds to reverse di- all six previous days (i.e., NR7 is definitely present) and rection, generally indicating a reaction to temporarily 0 < µ(D) < 1 means NR7 was satisfied for some D < 6 overbought or oversold market conditions. days. Trapezoidal membership functions are most appropriate There are two versions of a hook day. For the up hook for the most of the features (see Figure 1). day O[−1] < L[0] − δ and for the down hook day • NRk 318 2008 IEEE Symposium on Computational Intelligence and Games (CIG'08) For this feature the equation is slightly different for each value of k. Let µk(x) denote the membership function for NRk. Then 0 x<υ min µk(x) = c(x−υmin) υmin ≤x<υmax (5) 1 x≥υmax with parameter values as shown in Table I. k c υmin υmax 4 1/2 2 4 6 1/3 3 6 7 1/3 4 7 TABLE I PARAMETER VALUES FOR NARROW RANGE FEATURES Fig. 2. DOJI membership function with ρ = 0.1. In the above equation x = D + η where D ≤ k is ˜ the number of days where (3) holds and, with R = where x = L[0] − δ − O[−1] for an up hook day and max1≤j≤kR[j], x=O[−1]−δ−H[0] for a down hook day. ˜ η = R−R[0] ˜ R Notice that η increases the membership value for smaller previous day ranges. Fig. 3. Hook day membership function Fig. 1. Membership functions for the features. B. The Fuzzy Rule-Base Unfortunately, just detecting the presence or absence of • DOJI a single feature is not a very good trend day predictor. The For this feature the membership function equation is problem is to find combinations of features that make a good trend day predictor4. x If there are N total features, then there are N total rules 1− / 0 ≤ x ≤ ρ µ(x) = ρ (6) in the rule-base5. Consider the rule 0 otherwise where typically ρ ∈ [0.05,0.30). x represents the if x is NR4 then output is up-trend day percent difference between O and C and ρ represents The semantics of this rule is as follows. The term “x the threshold percentage. is NR4” means ranges for the current and the previous • Hook Day three days are computed. x represents how many of those days meet the NR4 definition. This crisp data value is the The formula for this membership function is argument for the NR4 membership functions which returns 0 x<−1 4Certain real parameter values must also be chosen. For example, the 1 2 percentage threshold input value is needed for the DOJI feature. µ(x) = 2(x+0.5) −2 ≤x<0 (7) 5There would be 2N total rules if both up-trend and down-trend days are 1 x≥0 predicted. 2008 IEEE Symposium on Computational Intelligence and Games (CIG'08) 319
no reviews yet
Please Login to review.