Fractal Profit Landscape of the Stock Market

We investigate the structure of the profit landscape obtained from the most basic, fluctuation based, trading strategy applied for the daily stock price data. The strategy is parameterized by only two variables, p and q Stocks are sold and bought if the log return is bigger than p and less than –q, respectively. Repetition of this simple strategy for a long time gives the profit defined in the underlying two-dimensional parameter space of p and q. It is revealed that the local maxima in the profit landscape are spread in the form of a fractal structure. The fractal structure implies that successful strategies are not localized to any region of the profit landscape and are neither spaced evenly throughout the profit landscape, which makes the optimization notoriously hard and hypersensitive for partial or limited information. The concrete implication of this property is demonstrated by showing that optimization of one stock for future values or other stocks renders worse profit than a strategy that ignores fluctuations, i.e., a long-term buy-and-hold strategy.


Introduction
Everyone wants to be rich, who doesn't? As a way of investment, stock market provides not only a chance to become a millionaire, but also a direct shortcut to pennilessness. In the present paper we focus on two important properties of the stock trading industry. First, it is shown that individual households pay a tremendous performance penalty for active trading [1]. Even professional fund managers cannot outperform the market indices in long term [2]. Second, many stock traders can be characterized as chartists, in principle using stock charts solely to make trading decisions [3,4]. Inspired by the above two observations, we will try to make some conclusions regarding the chances of actually beating the market trend by exploiting temporal variations in the stock market. We will not try to perform a complete modeling of interacting traders, nor will we model all possible trading strategies, but rather learn from a very simple strategy that exploits the fluctuations of stock prices and see whether it can shed any light to the observed difficulties in beating the market trend.
We admit that the trading strategies used in reality could be much more complicated and sophisticated than the naive strategy in this work. Various technical trading strategies based on moving averages, price momentum, channel breaking, and relative stock index have been being used [5][6][7]. In technical trading, suitably defined signals of buying and selling are produced from the past stock price movements, and trading strategies can typically be grouped into two different categories: trend-following and contrarian. The stock trading strategy in this work is parameterized by only two parameters that will be used for quantifying how fluctuations propagate to the long-term profit of the strategy. It should be noted that we are not aiming at proposing a profitable trading strategy, but we hope to understand the structure of the profit landscape yielded from a very basic trading strategy of buying and selling. However, by composing a very simple strategy from elementary buying and selling signals, more complex strategies can be composed from combinations of such signals, and robust features of our strategy, revealed by the profit landscape, should hold also for such, more complex, strategies.

Methods
In this work, we use 95 US company stocks (i~1,2, Á Á Á ,95), which existed for 21 years between 1983 and 2004. The stock price x i (t) is given for the i -th stock at time t(t~1,2, Á Á Á ,T~5301), which is the consecutive integer increasing by one at every trading date. What we mean by a strategy S in this paper is the way of determining (i) whether or not to trade (buy or sell), and if it is decided to trade (ii) how many units of stocks are to be traded. Only for simplicity, we assume that if 'buy' decision is made in (i), we buy number of stocks by spending the f b fraction of cash. Likewise, if 'sell' decision is made, f s fraction of stocks in possession are sold. Accordingly, our imaginary simple portfolio (we trade stocks for only one company, i.e., i fixed) is composed of only two accounts; cash m(t) and number n(t) of stocks, and the estimated value of the portfolio is given as the sum of the cash and stocks, m(t)zn(t)x(t). In reality, the amount of cash alone can increase in time by trading the risk-free asset, which is not taken into account in the present study only for the sake of simplicity. In other words, we assume that the risk-free interest rate is zero. In the same spirit, we also neglect the increase of cash via dividends provided by companies. We note that our expression for the value of the portfolio is the same as that of the wealth in Ref. [8]. In order to quantify a strategy with a small set of parameters, we propose the following simple strategy (we call it S 1 ): N The trade decision at time t depends only on the stock prices at two distinct times t and t'(vt). More specifically, the log return R(t,t'): ln½x(t)=x(t') is used for the trade decision.
N If R(t,t')wp, one judges that the stock price went up much and thus decides to sell.
N If R(t,t')v{q, the decreased stock price makes the stock attractive to buy, and thus one decides to buy.
We also consider the inverse strategy called S 2 : N If R(t,t')wp, one expects that the stock price will go up later and decides to buy.
N If R(t,t')v{q, one is afraid of further price falling, and thus decides to sell.
In words, the strategy S 1 can be termed as ''sell-on-rise/buy-onfall'', whereas the inverse strategy S 2 as ''sell-on-fall/buy-on-rise''. Similarly, the trend-opposing (i.e., contrarian) and the trendfollowing strategies have been used in Ref. [9], although the meaningfulness of the concept of ''trend'' in real markets is questionable [2]. For the sake of simplicity, we impose the nonnegative cash constraint (m(t) §0) [9] and the non-negative stock constraint (n(t) §0). In other words, you can neither buy stocks if you do not have enough cash, nor you can sell stocks which you do not have (short selling is not allowed). We also assume that the stock price is given exogenously and that the transaction price of the stock trading equals the daily closure price in the data file.
In general, the strategy in the present setup can be written as For given values of f b , f s , and d, we investigate the performance of the investment strategy parameterized by the two variables p and q. The detailed algorithm of performing our investment game is as follows: (i) We pick a company i one by one. (ii) At the first trading date, we start from one million dollars m(0)~10 6 . (iii) For given values of p and q, we keep applying the strategy repeatedly till the last date T. (iv) We evaluate the performance of strategy by computing the profit defined by P(p,q):½m(T)zn(T)x(T){m(0)=m(0). For each stock trading, we also assume that we pay small trading fee 0:1%. In the real stock market, there often exits minimum number of stocks to be traded. We have compared 1, 10, and 100 as minimum trading volume, only to find insignificant change of results. Henceforth, our strategies allow the trade of a single unit of stocks (but you cannot sell or buy a fraction of a stock).

Results
We first compute the profit P i (p,q) of historic stock data for the i-th company, in the two-dimensional parameter space (p,q) defined on unit square ½0,1|½0,1. For convenience, we discretize the parameter space into an N|N square grid and compute N 2 values of P i (p,q) at the center of each small square of the size (1=N)|(1=N). Once those values are computed, one can easily find the global maximum of the profit max (p,q) P i (p,q) for the given resolution N, and call those optimal values as (p Ã i ,q Ã i ). We also calculate the number M of local maxima which satisfy the criterion that four neighboring points in square grid have smaller values of the profit than at the center. As an example, we run the simulations at N 2 (N~1024) grid points for f b~fs~1 =2 and then use the obtained optimal value (p Ã i ,q Ã i ) to construct Fig. 1, where we also denote time instants when the buy and the sell decisions are made.
Whether or not short term fluctuations in the stock market may be exploited is addressed by benchmarking our strategies with a ''buy-and-hold'' strategy S 0 (see Table 1): At t~1 all cash is spent to buy stocks and the profit is evaluated at t~T, given by P 0~½ x(T){x(1)=x (1). The value of P 0 changes from company to company, depending on the growth rate of each firm. The growth rate conditioned to the firm size has been known to have exponential distribution function [10], while the size of each firm is power-law distributed [11]. For a company shown in Fig. 1, P 0~8 :76, which is smaller than the maximum profit realizable by the strategies S 1 and S 2 . The actual profit of any strategy for historic data is however of marginal interest; more interesting issue to pursue is what we can learn from the profit landscape and see if it allows us to make money in the future.  We next study how the number M of local maxima of the profit landscape defined on the p-q plane changes as the resolution parameter N is increased. If the profit landscape has a simple structure that there are only a few number of peaks, M is expected to first increase with N, since the number of peaks found in the higher resolution (larger N) will be larger than that in the lower resolution (smaller N). In this case of a simple landscape, M will then soon saturate to an O(N 0 ) value, and will not increase any more even when N is increased further. If this is indeed the case, the optimization process we described above can be very efficient to locate the global maximum profit. If the maxima are uniformly distributed they will scale linearly with the number of boxes N|N, that is M*N 2 . In Fig. 2A we show how M (averaged over 95 USA stocks) changes as a function of N for different strategies. The scaling falls between the two extremes: Surprisingly, M increases with N following an algebraic form of M*N 1:6 for both strategies. Although not reported here, we find that the behavior M*N a with a&1:6 for broad range of parameter values of f b ,f s , and d, both for S 1 and S 2 . The same value of a is found when extended range (p,q)[½0,2|½0,2 is used, and when eight neighbors of square grid (instead of four nearest neighbors) are compared for the determination of local maxima. Furthermore, Korean stock price data also reveal the same behavior with a&1:6 (to be reported elsewhere). These observations clearly indicate that the pattern of how local maxima are scattered in the twodimensional parameter space is described by a fractal structure.
We next compare our findings to the standard model of stock price, i.e., geometric Brownian motion (GBM) [12]: where X t is the Brownian random variable and W t is the Wiener process. The parameters m and s are fitted to each of the stocks and a number of replicas are simulated over the same period of the real stock data. A striking difference to the real stock price data is that for the GBM local maxima are evenly distributed, seen by the scaling M*N 2 in Fig. 2B. A conclusion we can make from this is that the profit cannot be explained solely from the first and the second order statistical moments (the mean value and variance) but a more detailed description of stock price movement is needed. It is well known that GBM is not able to describe some stylized facts of real price movements such as high value of kurtosis, fat tails in the probability distributions of log-returns, and the stochastic volatility and its clustering behavior [13][14][15][16][17]. Beyond GBM various stochastic processes have been proposed with Lévy processes as the most prominent example. Various models as subclasses of Lévy processes and autoregressive models have been proposed [13][14][15]18]. The results from more sophisticated models of financial-time series are however not further corroborated here. Although all the strategies belonging to S 1 and S 2 have qualitatively the same fractal structure in their profit landscapes, the maximum profit realizable by a given strategy is very different from each other. In general, the average maximum profits of S 1 are found to be larger than those of S 2 . This can also be seen in Fig. 1B and C: In S 1 sell prices are often higher than the buy price, while the opposite is seen for S 2 . Similarly, contrarian strategies have been shown to yield higher profits than trend-following ones in [5].
We also observe that for given values of f b and f s , the average maximum profit does not significantly depend on the value of d. This is not a surprising observation since it is well known that the   Table 1), and S Á Á Á T is the average over all companies. See text for details. doi:10.1371/journal.pone.0033960.g003 autocorrelation of returns decays very fast (in several minutes) [19], and thus the time difference d larger than one day will not make much difference in the results.
We have seen that there exist fluctuation based strategies for which the maximum profits significantly exceed the profit from the long term buy-and-hold strategy S 0 . The question is how to find the optimal strategy, since we need to estimate p and q for future stock data by using past stock data. Even if we possibly cannot find the optimal strategy by optimizing for old data we would like to know whether we can be sure to find a good strategy from such an optimization process. The fractal profit landscape suggests that the optimization process is very sensitive to perturbations, such as missing data and the change of optimization period of time.
We study the stability of the optimized strategies in two different ways: First, we compare how the profit changes across different companies for given values of p and q. More specifically, we obtain the optimized values p Ã i and q Ã i for each company i, and use the average values Sp Ã T:(1=95) P 95 i~1 p Ã i and Sq Ã T:(1=95) P 95 i~1 q Ã i to compute the profit by the strategy S 1 (Sp Ã T,Sq Ã T; f b~fs~1 =2,d~1) applied for each company i, which gives us the average profit SP 1 (Sp Ã T,Sq Ã T)T. Second, we compare how the profit changes in different time periods as follows: We use the first half period (t~1, Á Á Á ,T=2) for optimization of the strategy, and then use the obtained values p Ã i and q Ã i to compute the profit for the second half period (t~T=2z1, Á Á Á ,T). These two ways to test the stability of the optimized strategy can be phrased as the tests for spatial stability (across stocks i) and for temporal stability (across the time t). Figure 3 summarizes the results from the stability tests of the optimized strategy. It is again shown that the optimized strategy for each individual company for the whole period yields better profit than that from the buy-and-hold strategy, i.e., SP 1 (p Ã ,q Ã )TwSP 0 T. Since each stock has different time evolution behavior, the optimized values p Ã i and q Ã i are different for different companies. In this regard, it makes some sense to use Sp Ã T and Sq Ã T for all the companies, expecting that these values could have somehow better performance, although not as good as The third box denoted as SP 1 (Sp Ã T,Sq Ã T)T in Fig. 3 clearly shows that the use of the average values Sp Ã T and Sq Ã T does not give us better profit than the buy-and-hold strategy. In Fig. 3, we also display the result from the temporal stability test, denoted as SP 1 (p Ã ,q Ã ; T=2)T. It shows that the use of the optimized strategy for later time periods dramatically reduces the profit value. The same conclusion is reached when we use finer time windows as follows: We divide the whole time period T into 20 time intervals and obtain the optimized value p Ã i (t) and q Ã i (t) at each t-th interval (t~1,2, Á Á Á ,20). We then use p Ã i (t) and q Ã i (t) to compute P 1 (t') at later time interval t' (t'wt). Even the largest value of the profit [max t'wt P 1 (t')] is found to be smaller than the profit from the buy-and-hold strategy at the same interval. This indicates that our conclusion of the temporal instability of the optimal strategy holds at least for sufficiently long time scales.
The results from the stability tests can be summarized as follows: Even though fluctuations, theoretically, may be exploited in our basic trading scheme, the p,q-parameters (i) cannot be estimated from historic data and (ii) nor can they be estimated from other stocks. In both cases the performance is significantly worse than the buy-and-hold strategy. Our results agree with other existing studies: It is now generally believed that stock market has become more efficient and most technical trading strategies based on daily price changes stopped being profitable in mature market [5], although developing markets can still be different [7].
We next investigate the actual shapes of the profit landscapes in terms of the observations made above. Figure 4 displays (A) P i 1 (p,q; t[½1,T=2) and (B) P i 1 (p,q; t[½T=2z1,T) for one stock (i), and (C) P j 1 (p,q; t[½1,T=2) for other stock (j). One can see that the shape of the landscape looks quite different from each other, supporting the above conclusion of the instability of optimal strategy. It is also seen that the profit landscape is quite rugged in accordance with the fractal-like distribution of the local maxima reported in the present study. For comparison, we also show in Fig. 4D the profit landscape for the GBM series. The difference of the fractal dimension for local maxima between real stock prices and GBM is not clearly seen in Fig. 4, however, the landscape for (D) GBM looks more rugged than the landscape for (A) an actual stock.

Discussion
In summary, we have investigated the profit landscape defined by a set of simple investment strategies. We have shown that the local maxima in the profit landscape are scattered like a fractal and that the global profit maximum increases very slowly as the search resolution in the parameter space is increased. These findings imply that a local search in a strategy space to get the highest profit is almost impossible. We believe that our conclusions of poor performances of fluctuation-based trading strategies and their fractal profit landscapes are related with the unavoidable lack of future information of a company. If one has full information of the stock price change for the future, that information can directly be used to optimize trading strategy. However, if the future information is not sufficiently accurate, it can be basically useless in increasing profit, as has already been shown in Ref. [20]. We plan to study the rugged profit landscape in the present work in comparison with the fitness landscapes in other research areas [21].