# Getting the next price of a GBM (Geometric Brownian Motion)

I am writing a program that creates realizations of a GBM.

Starting from an initial price, I get the following price with this formula:

NewPrice = PreviousPrice * Exp(Volatility * N10 * Sqrt(DaysElapsed) + Drift * DaysElapsed)


Where:

• Volatility is the annual percentage volatility / 100 / sqrt(250)
• Drift the annual percentage Drift / 100 / 250
• N01 is a standard normal realization
• DaysElapsed are the days elapsed from previous price (this is a small fraction in my case)

I am not sure that I am doing this right. Is the above line correct ? Please, suggest the right code expression or other possible corrections. Thank you!

-
Attenation: volatility scale with the square-root of time, so your first transformation should be volatility/100/$\sqrt{365}$. – Richard Jul 4 '14 at 6:50
Thank you Richard!! I fix that. And how about the drift ? Is there SQRT too or just 250 is fine ? – Pam Jul 11 '14 at 11:54
There $250$ is fine. – Richard Jul 11 '14 at 13:28
Thank you Richard! I never fully understood that. If we say that the annual drift is -50%, would that mean that the expected price decrease after one year is of 50% of the "initial price" (first in the simulation), or what is the correct interpretation of that parameter ? – Pam Jul 11 '14 at 16:22

GBM is defined as $$S_t = S_{t-1}\exp\left( \left(\mu - \frac{\sigma^2}{2} \right)dt + \sigma dW_t\right)$$

So, in your notation, assuming your daily parameters:

$$S_{new} = S_{previous}\cdot\exp\left( \left({drift} - \frac{{volatility}^2}{2} \right)days + volatility \,\sqrt{days}\,N(0,1)\right)$$

So your formula was incorrect. The youtube you quote is only true for 1-year timesteps (while you have $days$ steps).

-
I have hard time converting your notation into my program symbols. The formula generates paths that looks fine, I am just unsure about the drift. Should it be multiplied for the Normal ? Could you make your proposal using my symbols, so I can understand it better and plug it in my program ? My unit of time is the day: fractions are used because this is millisecond tickdata. – Pam Jul 3 '14 at 18:27
Cf: youtube.com/watch?v=e79OtCamxD0 where the same is used – Pam Jul 3 '14 at 18:34
@Pam I added it – emcor Jul 3 '14 at 18:44
Ok thank you. One doubt before trying it on the pc. Assume It is specified a drift of 40% per year. The number I need to plug in the above formula is Drift% / 100 / 365 or what else ? And by volatility do you mean the daily volatility ? – Pam Jul 3 '14 at 18:48
Usually one uses "trading days per year", which is 250. So if drift 40% per year, then 40/100/250 per day (same for volatility) – emcor Jul 3 '14 at 19:20