My aim is to predict 1 year ahead and daily, the price of a stock under certain scenario. These scenarios are the ones that this year the stock will have a similar year, in terms of standard deviation and return, to the 2008 and to the 2017.

So what I did is to compute the mean of the DAILY returns and the mean of the daily standard deviation.

However, even though in the 2008 the return were of -40% in a year (mean of daily returns: -0.003074428479940944, mean of daily std: 0.028883647401261883) and for 2017 the return were of +30% (mean of daily returns: 0.0010560777183462407, mean of daily std: 0.011807274319995538), by plugging into the model the parameters, the MC simulation is giving me really similar results, with the VaR that is suggesting me very small possible losses (400$ from the starting price of 8200) which is roughly the 5%, but in a year in which the stock made -40%!

Can someone explain me where I made a mistake? Is it wrong how did I define "sigma" or the dt, which maybe should be 1 and not 1/252 ?

def mc_asset(S0, r, sigma, T, Nsteps, Nrep):
    SPATH = np.zeros((Nrep, 1 + Nsteps))
    SPATH[:, 0] = S0
    dt = T / Nsteps
    nudt = (r - 0.5 * sigma **2) *dt
    sidt = sigma * np.sqrt(dt)
    for i in range(0,Nrep):
        for j in range(0,Nsteps):
            SPATH[i,j+1] = SPATH[i,j] * np.exp(nudt + sidt * np.random.normal())
    return SPATH
S0 = datiRame['Copper Cash'].iloc[-1]
Nsteps = 252
T = 1
Nrep = 2000
SPATH = mc_asset(S0, r, sigma, T, Nsteps, Nrep)

plt.figure(figsize = (10,8))
for i in range(len(SPATH)):
plt.xlabel('Numbers of steps')
plt.ylabel('Stock price')
plt.title('Monte Carlo Simulation for Stock Price')
print(S0,sigma_selected_year, mu_selected_year)

# Define VaR and CVaR functions
def mcVaR(returns, alpha = 5):
    return np.percentile(returns, alpha)

def mcCVaR(returns, alpha = 5): #Return CVaR or ES
    belowVaR = returns <= mcVaR(returns, alpha=alpha)
    return returns[belowVaR].mean()

# Compute VaR and CVaR
VaR = S0 - mcVaR(final_prices[:-1],alpha =5)
CVaR = S0 - mcCVaR(final_prices[:-1],alpha =5)
  • 1
    $\begingroup$ Perhaps add some comments in your code so it is easier to read? $\endgroup$
    – KaiSqDist
    Feb 6 at 18:00

2 Answers 2


Your sigma seems to be incorrect, the sigma used should be annualized. Therefore, if you use your mean of standard deviation, you need to multiply it with $\sqrt{252}$.

I do not think there is anything wrong with your T, if you are simulating for a year ahead. Each day $dt$ should be $1/252$.

Can you update me with the results using these amended parameters?

  • $\begingroup$ My forecast horizon is 1 year, but the steps are daily. So I try to predict 252 steps, which mean that from today price, I try to predict tomorrow prices and then the day after tormorrow up to one year, so should be correct to use the mean of the daily mean sigma and the daily mean of the returns. Moreover, since my steps are by 1, the dt should be 1. That's what I thought. $\endgroup$
    – Ricter
    Feb 7 at 17:17
  • $\begingroup$ It's more common to use annualized volatility and dt = 1/252 in simulation. All the parameters should be annualized. $\endgroup$
    – KaiSqDist
    Feb 7 at 17:33

Even with 2000 simulations, you may not get the expected return and volatility as your estimated parameters.

Try running your monte carlo with more simulation paths and this should close the difference between your estimated parameters and your simulated parameters.

Also, you may try some variance reduction techniques such as antithetic sampling to get your expected results with fewer simulations.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.