Pricing Continuous Barrier Options
Introduction
In this post we are going to take a look at continuous barrier options. These are options which are activated or deactivated when crossing a predetermined price barrier. We will explain the InOutparity and compute the expected payoff.
Definitions
A continuous barrier option is an option on an underlying that pays out (or does not pay out) depending on if the underlying has crossed a price barrier. Once crossing that barrier and being activated (deactivated), the option does not deactivate (activate) again. The payouts can be european style, american style, bermudan style, or some other stuff.
In particular there are four flavors of continuous barrier options:

Upandout: Here the price of the underlying starts below the barrier level and becomes invalid (knocked out, in trader geekspeak) if it crosses that level.

Downandout: Here the price of the underlying starts above the barrier level and is knocked out when falling below that threshold.

Upandin: The price of the underlying starts below the barrier level and becomes activated (knocked in) when crossing that level.

Downandin: As one would expect, here spot price starts above the barrier level. When it crosses the barrier it is knocked in.
Advantages
Why should you trade that stuff? Isn’t this some wallstreet gambler
tool?
It depends. You can of course use it as a gambler tool if you don’t
blame me when you lose.
Normally, one considers buying continuous barrier options in the same
situation where one considers buying vanilla options, namely when
using them to hedge a portfolio. In case they get knocked in, they
work like a vanilla option, so they can be used as an insurance
against price bumps.
Continuous barrier options have the advantage that they are cheaper than their vanilla counterparts. As you can see, they will pay at most the value of their vanilla counterpart, so their price is at most the price of the vanilla option (in an arbitragefree world).
Inoutparity
With european options we saw that there is a parity between the put and the call which helped us to reduce the price of the call to the price of the put, so we only needed to compute one of them.
It turns out, that with continuous barrier options there is a similar parity, called the InOutparity. Assume we are holding two continuous barrier options with the same barrier level. For the argument it does not matter if these are puts or calls. One of these options is an Xandinoption the other is an Xandoutoption . Now two things can happen:

If we are below the barrier at expiry time, then one of the options is valid and pays according to the corresponding vanilla option , whereas the other barrier option is invalid and pays nothing.

In contrast, if we are above the barrier level at expiry time, the reverse happens. The option which paid out before now pays out nothing, and the other option pays according to the vanilla option .
So, in both cases we get
In plain language this means, that if you hold a knock in option and the corresponding knock out option, then both together are knockless, which is perhaps a word i made up.
Again as with european options the parity makes life easier.
If we know the price of the upandout option and of the
vanilla option we can compute the price of the upandin option
.
This also works the other way: if we know the price of the
upandin option and the vanilla option and want to
know the price of .
It also works analogously for downandX options.
Pricing
How do we price these monsters? As with other options, we can take the BlackScholes differential equation and solve for the boundary condition of the payoff of a continuous barrier option. Another possibility is the martingale pricing approach.
What we will do in the following is the easiest and slowest approach, namely Montecarlo pricing. We will simulate many runs of the underlying asset assuming their spot price follows a geometric brownian motion.
To make life easier, we will only compute european continuous barrier call options. W.l.o.g. we are concentrating on an upandout option. Note that the price of the upandin option can be computed with the InOutparity.
Before showing the image, let us discuss what we expect.
We have an upandout call option with barrier of and strike price . We compute the expected payoff for all spots of the underlying between and . On the xaxis we get the spots and on the yaxis the expected payoffs.
First, somewhere left of , the expected payoff should be zero, since the call option there is zero and the asset will not move with high probability enough to the right, such that the call option pays out.
Right of the expected payoff is zero, since we have crossed the barrier and thus the continuous barrier option is knocked out.
In between, we see the expected payoff of the call option and the more to the left we go, the smaller will be the influence of the barrier.
To get the price of the barrier option, we have to discount the interest rate. This is left as a small exercise.
Practical problems
In practice there often is a problem with determining if the price of the underlying has crossed the barrier level. Concretely, which price do we take? The bid or the ask? The midpoint? What happens when the spot price crosses the barrier level, but is not traded at this price?
Because of these problems in practice one often does not have continuous barrier options but rather discrete barrier options, which take the prices of the close at the end of the day for determining if they have crossed the barrier.