This question is based on MATLAB functions.

Suppose there is a stock S following the process


r - risk-free rate, q - dividend yield, W - Weiner process

The Local Volatility Surface has been given


Option Price $V(S,t)$ being given as

$\frac{\delta V}{\delta t}+\frac{1}{2}\frac{\delta^{2}V}{\delta S^{2}}\sigma(S,t)^{2}S^{2}+(r-q)S\frac{\delta V}{\delta S}-rV=0$

We are supposed to use Explicit, Implicit and Crank-Nicholson Finite Difference schemes respectively to solve for the option price. However, as you can see, this is a barrier call option.

The barrier being B = £130.

$S_0=$ £ 100, $K=$ £ 100, $r=$ 3% i.e the risk-free-rate

$q=$ 5% the dividend yield, time to maturity $T=$ 0.5, $\alpha$ in the local volatility function = 0.35

The pay-off function is given as

$h_{up-and-out{call}}(S_T)= max(S_T-K,0),\; if \;max_{0\leq{t}\leq{T}}S_t<B$.

{0 in other cases}

My attempt

I present my thought process here. I already have the Matlab code related to solving European Call option using the above three iteration methods described. In summary, I am unable to code the barrier option. I provide a picture below what I am aiming for.

A sample Barrier Option with £ 75 being the maximum barrier, you can see how the option price cease to exist once the barrier is crossed

  1. The stock price is a random variable varying with time, the maturity date for options is 0.5; i.e $t\in[0,0.5]$
  2. It is easier to solve when the $\sigma$ is a fixed value, here being a r.v. has made it difficult.
  3. I have tried adding the if-else condition to a usual European Call pricing code, however it is giving me back error.
  4. We need to modify the boundary condition to fit to that of barrier option (maybe)

I tried adding the following piece of code to the script below in link.

if S<=B 
    Vold = max(S-K,0) 
    Vold = 0 

I am uploading a sample code for pricing european call.
Click here to access the code

Since the question is bigger than what can be explained here, I would like to discuss it with the community first and then move forward with discussion.

Thank You


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.