# Barrier Option under Jump Diffusion

I am trying to price a Barrier Option under a model with jumps. I am using a brownian bridge approach but struggle with the jumps around these bridges and don't know how to handle this.

My main problem is that I guess I would need to define $S(t)_{before}$ and $S(t)_{after}$ in addition to my normal grid points. However, how would that influence my "barrier has not been hit probability" since there is basically no $dt$ in between "before" and "after" jump and the change is not driven by the brownian motion but the jump.

Can anyone point me in the right direction? :)

Best regards, Alex

My Naive Code:

if S0 <= B
P0 = 0;
time = toc;
epsilon = 0;
elseif S0 > B

dt = T/NumberOfSteps;
KBar = exp(Mu+0.5*Delta^2)-1;

S = zeros(NumberOfSimulations, NumberOfSteps);
S(:,1) = S0;

prob = ones(NumberOfSimulations,1);

Z = randn(NumberOfSimulations,NumberOfSteps);

if Lambda ~= 0
Nt = poissrnd(Lambda*dt,[NumberOfSimulations,NumberOfSteps]);
end

for i = 1:NumberOfSimulations
for t=1:NumberOfSteps

LnJ = 0;
if Lambda ~= 0
if Nt(i,t) > 0
LnJ = sum(normrnd(Mu,Delta,[Nt(i,t),1]));
end
end

S(i,t+1) = S(i,t).exp((r - q - LambdaKBar-0.5*Sigma^2)dt + Sigmasqrt(dt).Z(i,t));
prob(i) = prob(i).(1 - exp(-2*max(S(i,t+1)-B,0).*max(S(i,t)-B,0)./(Sigma^2*dt*S(i,t).^2)));

%Jump
if S(i,t+1)*exp(LnJ) <= B
prob(i) = prob(i)*0;
elseif S(i,t+1)*exp(LnJ) > B
prob(i) = prob(i)*1;
end

S(i,t+1) = S(i,t+1)*exp(LnJ);
end
end

ST = S(:,end);

if strcmp(OptionType,'Call')
Payoff = prob.exp(-rT).*max(ST - K,0);
elseif strcmp(OptionType,'Put')
Payoff = prob.exp(-rT).*max(K - ST,0);
end


The correct way is to first simulate the time points of the jumps and then the values of the process $$S(t)_{before}$$ and $$S(t)_{after}$$ by a Brownian increment. The latter then depends on the time between the jumps. This way you can have also only one interval (if no jump occurred) with one Brownian increment or many in your time horizon.