# 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)$$

$$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).