Click here to Skip to main content
15,921,113 members
Articles / Programming Languages / C++

Pricing Barrier Options with Lattices - Part I - Constant Barriers

Rate me:
Please Sign up or sign in to vote.
5.00/5 (5 votes)
11 Dec 2008CDDL9 min read 44.5K   645   18   6
Part I in a series on pricing barrier options.


This is Part I in a series of four articles on pricing exotic options using lattice-based methods. In this installment, we will treat the very simple case of an option with a constant barrier. It should be noted that the method presented can easily be extended to accommodate options with multiple constant barriers. Once we have studied this simple case, we will increase the complexity and move on to more complicated options with time-varying barriers. The article on time-varying barriers will cover a wide range of possible barriers, including (but not limited to) single and multiple linear time-varying barriers and exponential barriers. In Part III of this series, we will consider the pricing of Bermuda options on a trinomial lattice, and present some intuitive solutions to the problems that Bermuda options pose. Finally, in Part IV of this series, we will look at a completely different technique: the Adaptive Mesh Model (AMM). This is an alternative method to the one we will explore in Parts I-III. In writing this series, I hope to shed some light on the inherent difficulties of computing option prices as well as to place some option pricing code in the public domain. To begin, I will concentrate this article on a single barrier, but if there is expressed interest, I would be willing to expand the scope of the article to cover a variety of constant barriers (i.e., knock-in, knock-out).


Analytic option pricing formulas like Black-Scholes command much attention in the asset pricing literature. In practice, however, lattice-based pricing methods remain the technique of choice to price exotics like Barrier and Bermuda options. But, if the story stopped there, I wouldn't be writing this series of articles. For complex option types like these, it is well known that standard lattice methods struggle to produce price approximations; particularly when the initial underlying price is close to the barrier. In some instances, these numerical techniques break down completely, and it becomes impossible to calculate an option price. To combat this problem, an array of specialized lattice techniques has been devised for pricing barrier options. However, some of these methods are easily defeated by multiple, non-linear, and discontinuous barriers. A generalized, multi-purpose algorithm is badly needed.

The algorithm presented in this article is designed with such an agenda in mind. It is based on a very general (but simple) method that not only permits pricing when the underlying price is arbitrarily close to the barrier, but also produces accurate price approximations for all types of barrier options, including those with Bermuda style exercise. That being said, the code accompanying this article is strictly for a down-and-out call option. The code for more complex options will be discussed in future articles of this series. For simplicity, I will frame the discussion in terms of a binomial lattice; however, it is trivial to extend the method to a trinomial tree. Indeed, the supplied code is implemented for a trinomial lattice. Finally, if there is enough demand, I will consider adding additional code for both knock-in and knock-out style options with constant barriers.

The Problem

A barrier option is a path-dependent option. Its payoff is determined by whether the price of the underlying asset reaches some pre-determined price level negotiated at the time of the contract purchase. In the case of a down-and-out barrier option, the option payoff is set to zero when the underlying price falls below the barrier. This type of option can be priced using the same trinomial tree method used to price plain-vanilla options; however, without some form of modification, the trinomial tree will converge at an extremely slow rate to the "true" price of the option. One possible solution is to reposition the nodes of the lattice to increase convergence, but this becomes difficult (if not impossible) for curved barriers. A simpler and more intuitive method involves correcting the lattice probabilities with a suitable adjustment. The basic methodology has been used previously to increase the convergence rates of Monte Carlo option pricing algorithms.

Figure 1

Figure 1. Lattice configuration for a barrier option with a constant barrier, L.

Figure 1 shows the construction of a three-period binomial lattice with a constant barrier, L. Due to the discretized path along which the asset price evolves, it is possible for the underlying asset price to breach the option barrier without being detected by a Monte Carlo simulation. One way to alleviate this problem is to use the supremum of a Brownian bridge to calculate the probability that the underlying asset price touches the barrier for any given step of the simulation. However, this method is not without its limitations. This technique cannot be effectively used to price multiple barrier and time-varying barrier options without a series of approximations for the exit probability of a Brownian bridge. Applying these probability corrections to the lattice probabilities of a trinomial tree allows us to price options with single and multiple constant barriers on a trinomial lattice. Recent developments in the pricing literature [1] provide a source for these exit probability approximations. We are now in a position to apply these approximations to a practical pricing problem.

The Correction

As an introductory example, consider the three-period underlying asset binomial tree for a down-and-out call option illustrated in Figure 1. In the figure, L is the (lower) barrier of the option, and the indexed values of S represents the node prices for the various time periods indexed by the time division:

Equation 1

T is the option maturity and n the number of divisions of the tree. To price the option, we construct the binomial trees for the underlying asset and the option in the usual fashion, with one difference: we modify the transition probability of the binomial tree if we detect a potential barrier crossing between the nodes in the current time period and the following time period. In Figure 1, such a situation would arise in the transition from S(T0) to S(T0+d). Thus, we need to adjust the related transition probability. To perform the adjustment, we multiply the relevant transition probability by the appropriate exit probability; in this case, that given by [1] for a down-and-out call:

Equation 2

Consequently, with this probability adjustment, the probability adjusted price of the option can be written like so:

Equation 3

where CDAO is the price of the down-and-out call option, and C(ST0+dt) is the price of the call option at node S(T0+dt). Our probability adjustment is equivalent to changing the binomial tree into a trinomial tree in the neighborhood of the barrier. The third branch reflects the probability that the barrier is reached at an intermediate time. The option is then cancelled. Therefore, the third branch does not contribute to the option value and it can be omitted. Iterating through the lattice in this manner allows us to produce an approximation to the "true" option price.

Using the Code

The code for the constant barrier case is contained in a class called AdjustedBarrier. This is implemented in the file AdjustedBarrier.h. It is based on an optimized trinomial tree algorithm. We simply apply the probability correction as we traverse the lattice. The main loop for the down-and-out call option is:

// Work backwards through the tree  
// using the "Creeping Trinomial" algorithm
for (int i = (nlevels-1); i >= 0; i--) 
    index = outerindex;
    for (int j = 0; j <= (2*i); j++) 
        _tree[j].option = (dUp * _tree[j+2].option +
                      dMid * _tree[j+1].option +
                    dDown * _tree[j].option) * discount;
     // transition probability adjustment
    if (_tree[index].spot > dbarrier) 
        pUpAdj = ProbAdjust(_tree[index].spot, _tree[index+1].spot, dvol, dt, dbarrier);
         pMidAdj = ProbAdjust(_tree[index].spot, _tree[index].spot, dvol, dt, dbarrier);
        pDownAdj = ProbAdjust(_tree[index].spot, _tree[index-1].spot, dvol, dt, dbarrier);
        _tree[j].option = (dUp * (1.0 - pUpAdj) * _tree[j+2].option +
                           dMid * (1.0 - pMidAdj) * _tree[j+1].option +
                   dDown * (1.0 - pDownAdj) * _tree[j].option) * discount;
        _tree[j].option = 0.0;

The use of the class is very straightforward. Simply pass the required option parameters, as in the following example:

// just some test values
int levels = 800;
double spot = 100; 
double strike = 100; 
double volatility = 25;
double rate = 10; 
double maturity = 1; 
double barrier = 95;
// Price a down-out call option
double DownOutOption = AdjustedBarrier::PriceBarrierOption(levels, spot, strike,
    volatility, rate, maturity, barrier);

The output is sent to the console, and contains the price along with the calculation time required for both the underlying and the option trees:

Final option price from ADJUSTED PROBABILITY method is: 7.087516
 (requiring 0.000000 microseconds or 0.000000 seconds for the underlying tree
  and 1071541.000000 microseconds or 1.071541 seconds for the option tree)

Total calculation time: 1071541.000000 microseconds (1.071541 seconds)

Option price from HAUG FORMULA is: 7.049658

Press any key to continue . . .

Speed and Convergence

To test the code, we compare the convergence of our method to that of the Cox-Ross-Rubinstein (CRR) trinomial model. The results for the convergence of the two methods are displayed in Figure 2, along with the "true" (or analytic) option value:


Figure 2: Convergence comparison and analysis.

Figure 2 shows the rapid convergence of the probability adjustment model compared to the standard trinomial lattice with no correction. The gains in accuracy are quite evident, and the convergence to the analytic value (shown in red) is quite rapid in comparison to the CRR model. However, some fluctuation in the price approximation remains after 500 divisions of the lattice. This arises because, even though we are correcting the lattice probabilities, the discretization of the lattice still results in some inaccuracy. We are, therefore, left with a tradeoff between a highly generalized algorithm at the expense of some accuracy. To increase accuracy, we can select a large number of lattice divisions, but we pay for this with increased execution time.

Figure 3

Figure 3

Figure 3 shows a table that presents the results for the behaviour of the down-and-out call option price when the stock price is close to the barrier. The last column contains the price of the down-and-out call option using an analytical solution. Prices in brackets are those given by a standard model. Prices indicated by “-” were unable to be computed using the standard node repositioning method - that is the number of partitions used were insufficient to produce an approximation to the analytical price.

Figure 3 shows a comparison between the probability adjustment model and a standard lattice model. Entries given by a "-" indicate a breakdown of the standard model. That is, the traditional lattice model fails to produce a price approximation. Note that the model presented in this article always produces an option price approximation.

Figure 3

Figure 4

Figure 4 shows the execution times for both the underlying asset and the option lattices (the left hand axis is in seconds, the right hand axis is in microseconds). The left-hand axis is for the option tree (solid line) while the right-hand axis is for the underlying tree (dashed line).

Figure 4 shows the execution times for the algorithm. After 3,000 lattice divisions, the calculation time increases rapidly. At 10,000 divisions, we are closing in on the 1-minute mark. All computations were performed on a 1.83 GHz CPU with 2 GB of RAM. A typical calculation for 1,000 lattice divisions and a constant barrier requires approximately 3 seconds.


We have described a simple method (presented in more detail in [2]) for squeezing more life out of existing trinomial and binomial trees. With the probability adjustment, we are able to achieve significant gains in accuracy and convergence in comparison to existing lattice-based methods for barrier options. However, some inaccuracy in the price approximation remains as a result of lattice discretization error, and most likely cannot be eliminated completely. Nonetheless, this method permits us to price options with parameters that cause other methods to fail. Additionally, this method requires only a simple modification of existing lattice algorithms, which makes the implementation swift and easy.


The code only handles down-and-out call options. Depending on the level of interest, I am willing to update the existing code with other barrier types.


  1. Baldi, P., and L. Caramellino, and M.G. Iovino. "Pricing General Barrier Options: A Numerical Approach Using Sharp Large Deviations" Mathematical Finance, 9 (1999), pp. 293–322.
  2. Barone-Adesi, G., and Fusari, N., and Theal, J. "Barrier Option Pricing Using Adjusted Transition Probabilities" The Journal of Derivatives, Winter 2008.


This article, along with any associated source code and files, is licensed under The Common Development and Distribution License (CDDL)

Written By
Anonymous Proxy Anonymous Proxy
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

QuestionAdjusted probabilities do not sum up to 1? Pin
zhanghz23-Jul-09 6:13
zhanghz23-Jul-09 6:13 
GeneralRequest Pin
samir4118027-Jan-09 3:19
samir4118027-Jan-09 3:19 
GeneralRe: Request Pin
73Zeppelin1-Feb-09 22:06
73Zeppelin1-Feb-09 22:06 
QuestionFigure 3 - did you use a probability adjusted binomial or trinomial tree? Pin
codetest12314-Jan-09 23:59
codetest12314-Jan-09 23:59 
AnswerRe: Figure 3 - did you use a probability adjusted binomial or trinomial tree? Pin
73Zeppelin18-Jan-09 0:40
73Zeppelin18-Jan-09 0:40 
GeneralRe: Figure 3 - did you use a probability adjusted binomial or trinomial tree? Pin
codetest12328-Jan-09 4:59
codetest12328-Jan-09 4:59 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.