Stanislav Prikhodko
May 20th, 2015
Monte Carlo methods are a broad class of computational algorithms that rely on repeated random sampling to obtain numerical results. They are often used in physical and mathematical problems and are most useful when it is difficult or impossible to use other mathematical methods. In this research we will apply it for somilating stock price over time with given volatility.
On high level, many simulations performed in order to see what would be most likely the worst case scenario and the best case scenario.
The following formula defines general idea: \[ dS_{t} = \mu S_{t} d_{t} + \sigma S_{t} dW_{t} \]
This is the actual formula used in the code (the formula is simplified in sake of example): \[ Price_{t} = Price_{t-1}(1 + \frac{drift}{N} + \frac{(Random-\frac{1}{2}) * Volatility}{\sqrt{N}}) \]
where N is the total number of days in the given period. In the application I use N=255 since there are 255 working days in a year.
By using this formula we indeed have chaotic enough movements of stock price around the median values determined by constant steady growth defined by drift rate.
The application is published on R-Studio Shiny server: https://stas.shinyapps.io/MonteCarloSimulation/ The full code is not enclosed here, but you can see extremely simplified example of chaotic movements of a price over time below:
prices <- rep(200,255)
for (i in 2:255){prices[i] <- prices[i-1]+(runif(1)-0.5)*5}
plot(prices, type="l")