Skip to main content
PLOS One logoLink to PLOS One
. 2012 Apr 27;7(4):e33960. doi: 10.1371/journal.pone.0033960

Fractal Profit Landscape of the Stock Market

Andreas Grönlund 1, Il Gu Yi 2, Beom Jun Kim 2,*
Editor: Guido Germano3
PMCID: PMC3338730  PMID: 22558079

Abstract

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][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 (Inline graphic), which existed for 21 years between 1983 and 2004. The stock price Inline graphic is given for the i -th stock at time Inline graphic, 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 fb fraction of cash. Likewise, if ‘sell’ decision is made, fs 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, Inline graphic. 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):

  • The trade decision at time t depends only on the stock prices at two distinct times t and Inline graphic. More specifically, the log return Inline graphic is used for the trade decision.

  • If Inline graphic, one judges that the stock price went up much and thus decides to sell.

  • If Inline graphic, 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:

  • If Inline graphic, one expects that the stock price will go up later and decides to buy.

  • If Inline graphic, 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-on-fall”, whereas the inverse strategy S 2 as “sell-on-fall/buy-on-rise”. Similarly, the trend-opposing (i.e., contrarian) and the trend-following 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 non-negative cash constraint (Inline graphic) [9] and the non-negative stock constraint (Inline graphic). 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 Inline graphic with Inline graphic (Inline graphic). For given values of Inline graphic, Inline graphic, 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 Inline graphic. (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 Inline graphic. For each stock trading, we also assume that we pay small trading fee Inline graphic. 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 Inline graphic of historic stock data for the i-th company, in the two-dimensional parameter space Inline graphic defined on unit square Inline graphic. For convenience, we discretize the parameter space into an Inline graphic square grid and compute N 2 values of Inline graphic at the center of each small square of the size Inline graphic. Once those values are computed, one can easily find the global maximum of the profit Inline graphic for the given resolution N, and call those optimal values as Inline graphic. 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 Inline graphic (Inline graphic) grid points for Inline graphic and then use the obtained optimal value Inline graphic to construct Fig. 1, where we also denote time instants when the buy and the sell decisions are made.

Figure 1. Price time series and strategy-dependent trading decisions.

Figure 1

The time series of the stock price for a company is plotted as a function of time (full line), and the time instants when buy and sell decisions are made for given strategies are marked as star and square symbols, respectively. For the resolution Inline graphic (Inline graphic) in the parameter space of Inline graphic, we compute the profit Inline graphic at Inline graphic points to find the global profit maximum at Inline graphic. The used strategies are (A) Inline graphic, (B) Inline graphic, and (C) Inline graphic. For all cases, we used Inline graphic. Depending on the strategy used, the instants when buy and sell decisions are made are very different from each other, and the resulting profit values are also quite different: 10.5, 22.4, and 12.1 in (A), (B), and (C), respectively.

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 Inline graphic all cash is spent to buy stocks and the profit is evaluated at Inline graphic, given by Inline graphic. The value of Inline graphic 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, Inline graphic, 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.

Table 1. Strategy set. For S 1,2, the buy/sell decisions are made according to the log-returns of the stock price with the time difference d.

strategy description
S 0 buy-and-hold
S 1 sell-on-rise and buy-on-fall
S 2 buy-on-rise and sell-on-fall

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 Inline graphic 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 Inline graphic, that is Inline graphic. 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 Inline graphic for both strategies. Although not reported here, we find that the behavior Inline graphic with Inline graphic for broad range of parameter values of Inline graphic, and d, both for S 1 and S 2. The same value of a is found when extended range Inline graphic 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 Inline graphic (to be reported elsewhere). These observations clearly indicate that the pattern of how local maxima are scattered in the two-dimensional parameter space is described by a fractal structure.

Figure 2. Scaling of the number of local maxima in the profit landscape.

Figure 2

(A) The number M of local maxima of the profit landscape [Inline graphic] is computed as a function of the number N of grid points in the two-dimensional parameter space. The local maxima of the profit are distributed like a geometric fractal, manifested by Inline graphic with Inline graphic. For comparison, we also display the curve for Inline graphic, which clearly deviates from the actual result. (B) M versus N calculated from the GBM time series (see text). For GBM, Inline graphic fits better to the result than Inline graphic.

We next compare our findings to the standard model of stock price, i.e., geometric Brownian motion (GBM) [12]:

graphic file with name pone.0033960.e066.jpg (1)

where Inline graphic is the Brownian random variable and Inline graphic is the Wiener process. The parameters Inline graphic and Inline graphic 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 Inline graphic 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][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][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 Inline graphic and Inline graphic, 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 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 Inline graphic. The question is how to find the optimal strategy, since we need to estimate Inline graphic and Inline graphic 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 Inline graphic and Inline graphic for each company Inline graphic, and use the average values Inline graphic and Inline graphic to compute the profit by the strategy Inline graphic applied for each company Inline graphic, which gives us the average profit Inline graphic. Second, we compare how the profit changes in different time periods as follows: We use the first half period (Inline graphic) for optimization of the strategy, and then use the obtained values Inline graphic and Inline graphic to compute the profit for the second half period (Inline graphic). These two ways to test the stability of the optimized strategy can be phrased as the tests for spatial stability (across stocks Inline graphic) 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., Inline graphic. Since each stock has different time evolution behavior, the optimized values Inline graphic and Inline graphic are different for different companies. In this regard, it makes some sense to use Inline graphic and Inline graphic for all the companies, expecting that these values could have somehow better performance, although not as good as Inline graphic. The third box denoted as Inline graphic in Fig. 3 clearly shows that the use of the average values Inline graphic and Inline graphic 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 Inline graphic. 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 Inline graphic and Inline graphic at each Inline graphic-th interval (Inline graphic). We then use Inline graphic and Inline graphic to compute Inline graphic at later time interval Inline graphic (Inline graphic). Even the largest value of the profit [Inline graphic] 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.

Figure 3. Performances of different strategies.

Figure 3

Inline graphic is the profit from the strategy Inline graphic (see Table 1), and Inline graphic is the average over all companies. See text for details.

The results from the stability tests can be summarized as follows: Even though fluctuations, theoretically, may be exploited in our basic trading scheme, the Inline graphic-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) Inline graphic and (B) Inline graphic for one stock (Inline graphic), and (C) Inline graphic for other stock (Inline graphic). 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.

Figure 4. Profit landscape in two-dimensional parameter space.

Figure 4

(A) Inline graphic and (B) Inline graphic are for the same stock (Inline graphic) but for different time periods, and (C) Inline graphic is for other stock (Inline graphic). The three landscapes (A)–(C) look different, in agreement with the instability of optimal value of Inline graphic and Inline graphic over different stocks and different time periods. (D) Inline graphic for a GBM time series. For better visibility in the small values of p and q, we plot the landscapes in the plane of p and q in log scales. For (A)–(D), the strategy S 1 is used.

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].

Footnotes

Competing Interests: The authors have declared that no competing interests exist.

Funding: This work was supported by the National Research Foundation of Korea (NRF) grant funded by the Korea government (MEST) (2011-0015731). http://www.nrf.re.kr/html/en/. The funders had no role in study design, data collection and analysis, decision to publish, or preparation of the manuscript.

References

  • 1.Barber BM, Odean T. Trading is hazardous to your wealth: The common stock investment performance of individual investors. J Finance. 2000;55:773–806. [Google Scholar]
  • 2.Malkiel BG. New York: W.W. Norton & Company; 1999. A random walk down wall street. [Google Scholar]
  • 3.Lo AW, Mamaysky H, Wang J. Foundations of technical analysis: Computational algorithms, statistical inference, and empirical implementation. J Finance. 2000;55:1705–1765. [Google Scholar]
  • 4.Menkhoff L. The use of technical analysis by fund managers: International evidence. J Bank Finance. 2010;34:2573–2586. [Google Scholar]
  • 5.Schulmeister S. Profitability of technical stock trading: Has it moved from daily to intraday data? Rev Finan Econ. 2009;18:190–201. [Google Scholar]
  • 6.Sullivan R, Timmermann A, White H. Data-snooping, technical trading rule performance, and the bootstrap. J Finance. 1999;54:1647–1691. [Google Scholar]
  • 7.Park C-H, Irwin SH. AgMas Project Research Report No; 2004. The profitability of technical analysis: A review. pp. 2004–04. [Google Scholar]
  • 8.Yeung CH, Wong KYM, Zhang Y-C. Models of financial markets with extensive participation incentives. Phys Rev E. 2008;77:026107. doi: 10.1103/PhysRevE.77.026107. [DOI] [PubMed] [Google Scholar]
  • 9.Baek Y, Lee SH, Jeong H. Market behavior and performance of different strategy evaluation schemes. Phys Rev E. 2010;82:026109. doi: 10.1103/PhysRevE.82.026109. [DOI] [PubMed] [Google Scholar]
  • 10.Stanley MHR, Amaral LAN, Buldyrev SV, Havlin S, Leschhorn H, et al. Scaling behaviour in the growth of companies. Nature. 1996;379:804–806. [Google Scholar]
  • 11.Axtell RL. Zipf distribution of US firm sizes. Science. 2001;293:1818–1820. doi: 10.1126/science.1062081. [DOI] [PubMed] [Google Scholar]
  • 12.Black F, Scholes M. The Pricing of options and corporate liabilities. J Polit Econ. 1973;81:637–654. [Google Scholar]
  • 13.Mantegna RN, Stanley HE. England: Cambridge University Press; 2000. An introduction to econophysics. [Google Scholar]
  • 14.Schoutens W. England: John Wiley & Sons Ltd.; 2003. Lévy processes in Finance. [Google Scholar]
  • 15.Fusai G, Roncoroni A. New York: Springer-Verlag Berlin; 2008. Implementing models in quantitative finance: Methods and cases. [Google Scholar]
  • 16.Mandelbrot B. The variation of certain speculative prices. J Bus. 1963;36:394–419. [Google Scholar]
  • 17.Yamasaki K, Muchnik L, Havlin S, Bude A, Stanley HE. Scaling and memory in volatility return intervals in financial markets. Proc Natl Acad Sci U S A. 2005;102:9424–9428. doi: 10.1073/pnas.0502613102. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 18.Cowpertwait PSP, Metcalfe A. Introductory time series with R. New York: Springer. 2009.
  • 19.Gopikrishnan P, Plerou V, Amaral LAN, Meyer M, Stanley HE. Scaling of the distribution of fluctuations of financial market indices. Phys Rev E. 1999;60:5305–5316. doi: 10.1103/physreve.60.5305. [DOI] [PubMed] [Google Scholar]
  • 20.Tóth B, Scalas E, Huber J, Kirchler M. The value of information in a multi-agent market model - The luck of the uninformed. Eur Phys J B. 2007;55:115–120. [Google Scholar]
  • 21.Weinberger E. Correlated and uncorrelated fitness landscapes and how to tell the difference. Biol Cybern. 1990;63:325–336. [Google Scholar]

Articles from PLoS ONE are provided here courtesy of PLOS

RESOURCES