# Finite difference: move forwards or backwards?

In finite differences for the black scholes method, you move backwards in time, since of course you know the prices at time $$t = T$$, and then you iterate until you get to time $$t = 0$$.

However, why then in this code does the time move forwards? Here, cur_t is current time, and as you can see, he iterates and each time moves cut_r forwards by dt.

Entire code can be found here: https://www.quantstart.com/articles/C-Explicit-Euler-Finite-Difference-Method-for-Black-Scholes

Is this a mistake in the code?

They have written the equation to be solved as $$-\frac{\partial C}{\partial t} + r S \frac{\partial C}{\partial S} + ... = 0$$ instead of the more usual $$\frac{\partial C}{\partial t} + r S \frac{\partial C}{\partial S} + ... = 0$$ This means that in their setup $$t$$ represents the time to maturity, that is $$t = T - \text{time}$$. So they start from $$t = 0$$ where the option value is equal to its payoff, and they move forward in time to maturity until reaching $$t = T$$ which corresponds to $$\text{time} = 0$$ .