This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materials including this page, select Japan from the country navigator on the bottom of this page.


Price barrier options using standard trinomial tree


[Price,PriceTree] = barrierbystt(STTTree,OptSpec,Strike,Settle,ExerciseDates,AmericanOpt,BarrierSpec,Barrier)
[Price,PriceTree] = barrierbystt(___,Name,Value)



[Price,PriceTree] = barrierbystt(STTTree,OptSpec,Strike,Settle,ExerciseDates,AmericanOpt,BarrierSpec,Barrier) prices barrier options using a standard trinomial (STT) tree.


[Price,PriceTree] = barrierbystt(___,Name,Value) prices barrier options using a standard trinomial (STT) tree with an optional name-value pair argument for Rebate and Options.


collapse all

Create a RateSpec.

StartDates = 'Jan-1-2009'; 
EndDates = 'Jan-1-2013'; 
Rates = 0.035; 
Basis = 1; 
Compounding = -1;
RateSpec = intenvset('ValuationDate', StartDates, 'StartDates', StartDates,...
'EndDates', EndDates, 'Rates', Rates,'Compounding', Compounding, 'Basis', Basis)
RateSpec = struct with fields:
           FinObj: 'RateSpec'
      Compounding: -1
             Disc: 0.8694
            Rates: 0.0350
         EndTimes: 4
       StartTimes: 0
         EndDates: 735235
       StartDates: 733774
    ValuationDate: 733774
            Basis: 1
     EndMonthRule: 1

Create a StockSpec.

AssetPrice = 85; 
Sigma = 0.15; 
StockSpec = stockspec(Sigma, AssetPrice)
StockSpec = struct with fields:
             FinObj: 'StockSpec'
              Sigma: 0.1500
         AssetPrice: 85
       DividendType: []
    DividendAmounts: 0
    ExDividendDates: []

Create an STTTree.

NumPeriods = 4;
TimeSpec = stttimespec(StartDates, EndDates, 4);
STTTree = stttree(StockSpec, RateSpec, TimeSpec)
STTTree = struct with fields:
       FinObj: 'STStockTree'
    StockSpec: [1x1 struct]
     TimeSpec: [1x1 struct]
     RateSpec: [1x1 struct]
         tObs: [0 1 2 3 4]
         dObs: [733774 734139 734504 734869 735235]
        STree: {1x5 cell}
        Probs: {[3x1 double]  [3x3 double]  [3x5 double]  [3x7 double]}

Define the barrier option and compute the price.

Settle = '1/1/09';
ExerciseDates = '1/1/12';
OptSpec =  'call';
Strike = 105;
AmericanOpt = 1;
BarrierSpec = 'UI';
Barrier = 115;

Price= barrierbystt(STTTree, OptSpec, Strike, Settle, ExerciseDates,...
AmericanOpt, BarrierSpec, Barrier)
Price = 3.7977

Input Arguments

collapse all

Stock tree structure for a standard trinomial tree, specified by using stttree.

Data Types: struct

Definition of option, specified as 'call' or 'put' using a character vector or a NINST-by-1 cell array of character vectors for 'call' or 'put'.

Data Types: char | cell

European or American option strike price value, specified with a nonnegative integer using a NINST-by-1 matrix of strike price values. Each row is the schedule for one option. To compute the value of a floating-strike barrier option, Strike should be specified as NaN. Floating-strike barrier options are also known as average strike options.

Data Types: double

Settlement date or trade date for the barrier option, specified as a NINST-by-1 matrix of settlement or trade dates using serial date numbers or date character vectors.


The Settle date for every barrier option is set to the ValuationDate of the stock tree. The barrier argument, Settle, is ignored.

Data Types: double | char

Option exercise dates, specified as a serial date number or date character vector:

  • For a European option, use aNINST-by-1 matrix of exercise dates. Each row is the schedule for one option. For a European option, there is only one ExerciseDates on the option expiry date.

  • For an American option, use a NINST-by-2 vector of exercise date boundaries. The option can be exercised on any tree date between or including the pair of dates on that row. If only one non-NaN date is listed, or if ExerciseDates is a NINST-by-1 vector of serial date numbers or cell array of character vectors, the option can be exercised between ValuationDate of the stock tree and the single listed ExerciseDates.

Data Types: double | char

Option type, specified as NINST-by-1 positive integer scalar flags with values:

  • 0 — European

  • 1 — American

Data Types: single | double

Barrier option type, specified as a character vector or cell array of character vectors with the following values:

  • 'UI' — Up Knock In

  • 'UO' — Up Knock Out

  • 'DI' — Down Knock In

  • 'DO' — Down Knock Up

Data Types: char | cell

Barrier levels, specified as a NINST-by-1 matrix.

Data Types: single | double

Name-Value Pair Arguments

Specify optional comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside single quotes (' '). You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.

Example: Price = barrierbystt(STTTree,OptSpec,Strike,Settle,ExerciseDates,1,'UI',115,'Rebate',25)

collapse all

Rebate values, specified as NINST-by-1 matrix of rebate values. For Knock In options, the rebate is paid at expiry. For Knock Out options, the rebate is paid when the barrier is reached.

Data Types: single | double

Derivatives pricing options, specified as structure that is created with derivset.

Data Types: struct

Output Arguments

collapse all

Expected prices for barrier options at time 0, returned as a NINST-by-1 matrix.

Structure with a vector of barrier option prices at each node, returned as a tree structure.

PriceTree is a MATLAB® structure of trees containing vectors of instrument prices and a vector of observation times for each node.

PriceTree.PTree contains the prices.

PriceTree.tObs contains the observation times.

PriceTree.dObs contains the observation dates.


[1] Derman, E., I. Kani, D. Ergener and I. Bardhan. “Enhanced Numerical Methods for Options with Barriers.” Financial Analysts Journal. (Nov.-Dec.), 1995, pp. 65–74.

Introduced in R2015b

Was this topic helpful?