# Watch volatility in action - a geometric brownian motion simulator

One of the simplest models of stock prices is geometric brownian motion (GBM). This model gives rise to the idea of characterising a stock's performance by its mean annual return and volatility - which most of us are very familiar with.

But do we have a good grasp of what different values for volatility feel like? How much volatility are we comfortable with in a stock?

From the model you can derive several *theoretical *results about things like the expected drawdowns and likely daily movements, etc.

However, sometimes it helps to just *see *the effects of different values for these parameters in *reality*.

So here is a simple simulator of GBM which can be run in Excel/OpenOffice/LibreOffice. I can't post attachments so it is in the form of a table which you should be able to copy and paste into a spreadsheet starting at cell A1. You will then need to make a couple of quick modifications and the simulator is ready to go. The instructions are at the end of this article.

If you do it right it should look like this:

Each time you press **F9 **the simulator creates a year's worth of stock prices based on the values you supply for **mean annual return**,** annual volatility** and **df**. We'll come to **df** later.

If you set the volatility to zero you will see that the prices simply rise smoothly to achieve the desired final return. In fact I have included a "drift" column which plots this result as well as the stock price as a guide to the "underlying" behaviour.

Now change the volatility to (say) 12 (for 12% annual volatility). This is similar to the volatility of a 20-stock diversified portfolio such as NAPS. You will see that the stock price follows the drift reasonably closely. Every time you press F9 the simulator creates a new set of random numbers and a different solution - but they all follow the drift reasonably closely.

*Low Volatility example*

Now try a value for volatility of 50. This is similar to **Fevertree Drinks ** (LON:FEVR) or **Burford Capital ** (LON:BUR) . The price will swing wildly away from the drift.…

### Unlock this article instantly by logging into your account

Don’t have an account? Register for**free**and we’ll get out your way

Disclaimer:

As per our Terms of Use, Stockopedia is a financial news & data site, discussion forum and content aggregator. Our site should be used for educational & informational purposes only. We do not provide investment advice, recommendations or views as to whether an investment or strategy is suited to the investment needs of a specific individual. You should make your own decisions and seek independent professional advice before doing so. The author may own shares in any companies discussed, all opinions are his/her own & are general/impersonal. Remember: Shares can go down as well as up. Past performance is not a guide to future performance & investors may not get back the amount invested.

## 3 Posts on this Thread show/hide all

As an assumption can't this be reversed to also identify good buy points when a price diverges far below its drift, and sell points when above, as in the long term one expects oscillation around the drift line? However, the assumption is surely that both drift and volatility are stable for long enough to act upon. Drift is potentially reset every announcement, when people assess the difference between where the price is now and where they think it should be. The price change then takes place over time. Volatility is a measure of consensus and how fast that exchange of opinion between buyers and sellers takes place, constrained by their resources. Hmmm, beginning to sound like TA ... However, the more boring the company the less divergence of opinion is likely to be.

The lesson that portfolios are less volatile than their individual components is very important. What would be nice is a selection tool, that given an existing portfolio and a list of potential additions, can rank the additions in order of 'best reduction in volatility' and/or suggest swaps.

Going slightly off topic (again), is lower volatility associated with high quality rank? How persistent is high quality rank? If the answers to both are 'yes' and 'very', then there is a subset of shares that this can be pertinent to. Both

Games Workshop(LON:GAW) andTracsis(LON:TRCS) are in the 90's for quality and there would seem to be a small basket of potential candidates https://www.stockopedia.com/sc...You are right. Modern Portfolio Theory assumes that drift and volatility are constant over the period being considered. This of course is not true in general. Stochastic Portfolio Theory provides a model where drift and volatility change over time. It is quite heavy going though.

Yes - it basically is TA! It is just based on price history with no fundamentals. Most "pop" TA seems to concentrate on periods of about 30 days or less though. But you won't get much sense out of mean-variance models unless you use at least a year's worth of data.

Indeed. But in practice you have to maximise the expression drift/volatility rather than minimise volatility - otherwise it makes very dubious choices. This is called

mean-variance optimization (MVO)if you want to google for more info.I went back to look for a reply I gave previously about this and discovered it was in reply to a question you asked me! So I have extended the example I posted then. Here is a simple script in R which shows how to optimise a portfolio of FTSE100 stocks to maximise the Sharpe Ratio:

https://gist.github.com/njcray...

Once you have the mean returns vector and the covariance matrix for all stocks in your universe you can easily compute the volatility and mean return of any portfolio you choose to build from that universe or run an optimization to find the portfolio with the highest Sharpe Ratio. (See comments in script.) So you could for example report the new volatility (and estimated mean return) for a portfolio constructed from your current portfolio plus any selected new stock (or stocks).

Short answer: yes it is! (NB: not true for Value Rank, where low volatility is associated with middling value of Value Rank.)

Thanks. I've been spending increased amounts of time using R during the past year, so I'll add this to my personal projects to pursue. I really appreciate your contributions here and learn a lot whenever you post. Thanks again.