# How to match simulated local vol european prices with closed formula

Say an implied volatility is given by $$\sigma_{imp}(T, log(F_T/K))$$ and we note the Dupire local volatilty $$\sigma_{loc}(T, log(F_T/K))$$ with $$F_t$$ the forward rate and $$K$$ the strike.

The price of a European call is given by the Black formula : $$Black(\sigma_{imp}(T, log(F_T/K)))$$

To get the price for the European call using Monte Carlo with the corresponding Dupire local volatility model:

price = 0
For i = 1 to NumberSimulations
S_u = S_0
for t = dt to T
u = t - dt
$$F_u = S_0 * e^{ru}$$
$$\sigma= \sigma_{loc}(u, log(F_u/S_u))$$
$$S_u = S_u * e^{(r-0.5\sigma^2)dt+\sigma dW_t}$$

price = price + e^{-rT} * (S_u-K)^{+} / NumberSimulations


Implementing this my Monte Carlo price does not match the Black formula price. I am doing something wrong in the simulation?