Page 1 of 1

Synthetic Stock Data: how to "correctly" simulate

Posted: Thu Jun 27, 2013 9:33 am
by AFJ Garner
Synthetic Stock Data: how to "correctly" simulate volatility
Now take a look at a chart of the volatility of daily returns for the same rolling periods on a synthetic data series created using GBM and (in the GBM calculations) a fixed, static figure for volatility. Take a look also at the chart of the closing prices from which the volatility was calculated. Neither the volatility chart nor the stock price chart look much like those derived from real prices. Too static, not enough jumps and changes as volatility flows with market conditions.

See below:
randomClosefixedstddev
fixedstddev

The next two charts show volatility and closing prices for another synthetic data series, this time using randomly altered figures for target volatility. Note how both bear a much greater similarity to the volatility charts for real price series shown in the above posts, reflecting day to day “normalityâ€

Re: Synthetic Stock Data: how to "correctly" simul

Posted: Thu Jun 27, 2013 11:10 am
by mojojojo
AFJ Garner wrote: Note how both bear a much greater similarity to the volatility charts for real price series shown in the above posts
I'm not sure of the above posts that your referring too.

With that said, your solution does a much better job at capturing the volatility clustering that actually occurs in the market, compared to the static method.

Very nice.

Posted: Thu Jun 27, 2013 1:35 pm
by AFJ Garner
Sorry for the confusion (the result of clumsy copy and pasting). The "other" post can be seen here: http://tradersplace.net/forum/thread/15 ... s-markets/

It gives some charts of rolling period volatility on various real data series.

Posted: Thu Jul 11, 2013 8:45 am
by AFJ Garner
Below you will find a screenshot of the latest version of my random data generator. At some stage I will explain the GUI in greater detail - but it is probably pretty obvious. I have randomised pretty well every element except for “driftâ€

Posted: Wed Jul 31, 2013 3:35 am
by stopsareforwimps
[quote="AFJ Garner"]Below you will find a screenshot of the latest version of my random data generator.

...

What does that mean in practical terms? It means that with an assumption of zero drift, you can expect the price series to be mean reverting in the long term.

...

The trends are of course meaningless and unpredictable: but that does NOT mean they are “unfollowableâ€

Posted: Fri Aug 02, 2013 10:44 am
by AFJ Garner
stopsareforwimps wrote:
Anthony as I understand it random fluctuations (eg coin flips) do not mean revert. The expected average *absolute* deviation from zero is proportional to the square root of the time. This, even though the expected value at any time is 0.

Actually they do revert in that you can show that the value passes through zero an infinite number of times eventually. But in between the diverge further and further away.

From memory Einstein showed this in the context of Brownian motion.

On the second point I cannot fathom how trends that are unpredictable and meaningless can be followed (profitably). Can you give us some hints as to how this can be?

Tim
Tim

I believe I am right in saying that the distribution of outcomes in a coin flip is uniform whereas with geometric Brownian motion it is normal? I am using the latter but of course both "mean revert" in the sense I used the term. They cross and recross the starting point. Again, both distributions are symmetrical.

If you take a big enough collection of data series calculated in such a way, the mean reversion and symmetrical distribution become more immediately apparent and obvious: on a buy and hold basis they will sum up to a return of zero (however long an individual series may take to revert to its starting point).

Since trend following is about "following" and not prediction, it seems to me that the lack of predictability does not matter. The apparent "trends" in random data are meaningless in that they are not caused by any agency other than computer code and random chance: in real markets you may be able to ascribe a "meaning" to the trend: scarcity of oil in an environment of rising Crude price for instance. But an algorithm does not care what causes a "trend" (meaningless or otherwise): it can still follow it while it lasts.

Using pure geometric Brownian motion to create many thousands of price series, I find that any sort of trend following is a zero sum game before costs. However it is interesting to note that the win loss ratio is remarkably similar to that that typically applies on profitable trading of real markets: around 30% of trades are profitable. Although of course you can play around with different systems and get the win loss ratio far higher if you so choose. So, it IS possible to follow "trends" in random data created by GBM. The difference is that such trends are not strong, frequent or long enough for the 30% winners to outweigh the 70% of losers in terms of profitability.

But, is data any less "random" if we introduce random drift? I think probably not. If positive or negative drift lasts for long enough in a single direction at any one time suddenly, BINGO, it becomes possible to trade profitably using a trend following algorithm on random data. Drift elongates and strengthens trends.

Why does any of this matter to real trading and the real world? Well, the huge benefit for me has been to appreciate very much more clearly what market conditions are necessary for TF to work. Will it make me any more profitable? No but it has made me a great deal more comfortable with what I am doing.

If there are frequent and strong enough real world trends I will profit; if not I won't.

The creation of random, synthetic data is a very useful playground.