Checking assumptions: Random price chart generator

Discussion in 'Strategy Building' started by NorskTrader, Apr 29, 2003.

  1. Chasinfla, MondoTrader and others in a separate thread touched on the value -- albeit admittedly limited -- of a coin toss chart.

    I, too, recognize its limitations, but I still think it's instructive to see how closely a random chart can mimic a genuine price chart.

    I've created an Excel spreadsheet for you to play with that shows 10,000, 1000, and 100 "day" candlestick charts. These correspond, roughly, to 40 years, four years, and five months of trading. I shared it with my friend Brandon from Trading from Main Street, and he suggested I offer it to you.

    Using a starting index value of 100, you can have the spreadsheet show you random outcome after random outcome, hundreds or thousands of times if you like.

    I've also built it with adjustable parameters for the following variables:

    (1) Assumed secular growth rate (annual percentage)
    (2) Assumed standard deviation of net % change at the morning open from the prior night's close
    (3) Assumed standard deviation of net % change at the close from that morning's open
    (4) Assumed ordinary maximum length of the upper and lower candlestick tails

    By the way, this file is best viewed on three side-by-side monitors set to 1600x1200 resolution.

    Since the max file size I can attach here is 100k, while this file is 1 MB zipped, I can't attach it here. But send me an E-mail at if you're interested.

    In order to give you a sample of a single static result, here's a picture of the 1000-day version.


  2. That's great work. BTW, your assumed annual growth rate is obviously what's causing the trend in the data.

    This makes these numbers rather un-random and really a normal distribution around a trend.

    Thanks so much for sharing.
  3. Fair point. But you can toggle this trend rate to 0% if you like.
  4. Here's a 100-day version generated by the aforementioned Excel sheet. It's a bit larger to show more candlestick detail.
  5. And the conclusion is???

  6. To create another spreadsheet that assigns probabilities to the length of the 'streaks' or consecutive runs of up or down days in the data. I started with a random data spreadsheet and worked forward from there. See my article in the April 2002 issue of Futures and download the spreadsheet here:


  7. I can't b/c I don't have your spreadsheet. (I know you offered a copy, but I'm pretty careful about downloading stuff--but I'll probably ask you for one anyway :) .)

    I feel that people use the term random number rather loosely. A normal distribution is decidedly unrandom. Look at people's weights for instance. Let's say the average male weighs 160 lbs. As you move from that mean you get males who weigh more or less, but the perponderance is around 160 lbs. How is that random? It's not.

    A random distribution would create a fairly even scattering of weights from minimum to maximum possible weight. But that's not how people's weights are distributed because people's weights aren't random.

    By using standard deviation, you are assuming a normal distribution, so a non random outcome seems guaranteed.

    It's very impressive work, and I'd love to look at more of your stuff. But these not truly random prices.

    Now could you have used a more truly random way to get the daily price change (which would have been easier anyway) and still gotten "trends", etc.. Yes. It could look very similar to a price chart.

    But looking similar to a price chart does not mean it's the same. The thing aobut random numbers that makes them unique is that they are not predicatable. You can have two idtentical charts, one random and the other decidedly not random. The one that's not random would be deemed such if the path of the prices was accurately predicted while the chart was unfolding.

    So because there are people who do beat the market trading, these people are predicting price, one way or another. Even delta neutral options players are predicting price b/c they are prediciting volatility which is the movement of price. So while I think these charts are very interesting and useful, they do not prove the markets are random, or even normally distributed with a conisitent or random squew.
  8. BobbyMercerFan, you make some excellent points, and I appreciate how much careful thinking you've already done about this.

    For the record, let me mention that the spreadsheet I built was preceded by an earlier version in which the element of the normal distribution wasn't present. In that case I began with a starting "price" of 100, and then allowed up to 1 point price change from open to close, and 1/2 point from close to open, and there the values were indeed randomly drawn.

    But I created the second version to see whether adding the assumption of a normal distribution would materially affect the visual results. And, if I recall correctly, it did.

    I readily acknowledge, though, as you have pointed out, that prices are indeed observably not normally distributed. Nevertheless, given the two choices of (a) purely random changes within certain boundaries vs. (b) random pulls from a normal distribution, I thought the second would be _closer_ to reality.

    Either approach serves my heuristic purpose, which initially at least was to acquaint myself with images of artificial and essentially random results, and then, hopefully, train myself to better appreciate in a genuine price chart how much of what I'm seeing might be attributable to randomness, and how much, by contrast, might not.

    Since playing with the spreadsheet, though, I'm now wondering whether any of the multivariate quantitative analysis training I've received might usefully be brought to bear on this question, or whether I should start learning some other mathematics.

  9. A fairly even scattering of weights from minimum to maximum possible is called a uniform random distribution and is exemplified by the distribution of about 10% for each of the balls numbered '0 to 9' in the Pick 3 or Pick 4 lottery games. According to Bernstein, writing in Against the Gods, page 127, ..."de Moivre demonstrated how a set of random drawings, as in Jacob Bernoulli's jar experiment, would distribute themselves around their average value."

    I would argue that the distribution of weights is a random event as long as the sample which is being measured is representative of the population at large. See especially Bernstein in the work cited above, Chapter 9. The end of that chapter goes to some length to explain 'Reversion to the Mean', which is how weight is distributed from generation to generation.

    As to whether the charts you are wondering about are random I cannot say. However the coin flip test is sufficient to prove randomness; if the price series on the charts is divided about 50/50 over a large number, say at least 5,000, of prices then the price series is considered, statistically, to be random. No matter if the prices have a constrained range due to variables that can be adjusted to explore different regions of the price curve.


  10. Also, BobbyMercerFan, I should also mention that I share your view that real price changes can be probabilistically forecast. Indeed, my main work is systems design, which of course is usually if not always predicated on the assumption of some patterns in price behavior.

    I must confess, though, that in what may either be extremely muddled thinking or vanity, I am wondering whether profitable systems could be designed that would thrive in long runs of random data. But I won't try solving that one tonight. :)
    #10     Apr 29, 2003