MDoubleBarrier





http://www.QuantTools.com
CapeTools Exotic Analysis function list

Welcome | Documentation format | QuantTools Groups | QuantTools Categories | Licence

Key TAGs | Excel Index | API Index



A double barrier option is knocked in or out if the underlying price touches a lower boundary L or upper boundary U prior to expiration.

CO=Call up-and-out-down-and-out, PO=Put up-and-out-down-and-out, CI=Call up-and-in-down-and-in, PI=Put up-and-in-down-and-in. Alpha1 and Alpha2 determine the curvature of the lower L and Upper U absorbing boundaries.

When both are equal to 0, we have two flat boundaries.

Where Alpha1 is less than 0 and Alpha2 is greater than 0 we have a lower boundary exponentially growing as time elapses, while the upper boundary will be exponentially decaying.

An Alpha1 greater than 0 and Alpha2 less than 0 corresponds to a convex downward lower boundary and a convex upward upper boundary.

This function utilizes an analytical (closed-form) algorithm.

Note that the risk (greek) numbers produced are the mathematically defined equivalent of a derivative (instantaneous change).

You can convert the risk number to your own definition of risk by multiplying by the shift you require.

For example, for a typical definition of VANNA, (change in underlying and volatility), where one defines the change in the underlying as a single unit of change (1.0) and the change in volatility as a one percent change (0.01), simply multiply the VANNA result calculated by (1.0*0.01).

For VEGA, change in volatility of one percent (0.01), simply multiply the VEGA result by 0.01. Within option contracts THETA is negative, however the mathematically defined equivalent of THETA (instantaneous FORWARD change in time) is positive.

Internally we have negated this value for you.

To express THETA as THETA per day, simply multiply the THETA result by 1/365 or 1/252 (depending on whether you require calendar days or business days).

This function prices a portfolio of equity, commodities, futures or FX option deals from raw inputs.

All memory is discarded once the computation is finished.

You can request for all first and second order risk statistics simply by filling in the greek field with the name of the parameter.

The name of the parameter must be proceeded with the character 'd'. Thus if 'Stock', 'Time' and 'Vol' are the names of three parameters which represent underlying price, Option Maturity and option volatility respectively, you can request DELTA as 'dStock', GAMMA as 'dStockdStock' (dStock twice), VEGA as 'dVol', THETA as 'dTime', VOLGA as 'dVoldVol' (dVol twice) and VANNA (cross-derivative) as 'dStockdVol' or 'dVoldStock'. You can also, if you wish request 'dTimedVol' (second derivative with respect to Time and Vol).

If you wish to view all the second order derivatives within a matrix, please refer to the CapeTools Derivative Matrix category of functions.

This logic can be applied to any parameter which is of a double-valued type (decimal value).

The risk statistics are the partial derivatives with respect to the option price, thus you can scale the results by multiplying by a factor.

For example, to compute the VEGA for a one percent change in volatility (0.01), simply multiply the VEGA result by 0.01. To compute THETA for a one day change (1/365), multiply the THETA result by 1/365. To compute the DELTA for a one-unit change (1), multiply the delta by 1 which is, of course the same result as the original delta.

For second order risks, simply multiply by the product of the changes.



Note: Within Excel, the function is named - CT.MDoubleBarrier




High level graphic of MDoubleBarrier() function with parameters. Blue square node is the actual function with the parameters ordered.



Parameter Description


  1. ValueDate parameter

    Valuation Date (typically equal to Today's date)
  2. dayCounter parameter

    For any input parameter within this function that represents a dividend rate, risk free rate, foreign rate or holding cost rate, these rates will be defined as annually compounded using the DayCounter defined within this parameter. Thus if 'actual365' is used for this 'dayCounter' parameter, then all input parameters that represent a dividend, risk free, foreign or holding cost rates will be defined as annually compounded Actual365 rates.
  3. Units parameter

    Number of option contracts you wish to trade in (positive value).
  4. Position parameter

    Whether you are long or short the option.
  5. Level parameter

    Whether you would like to view the PV for the entire structure/portfolio 'TOTAL'. Whether you would like to view the PV for each option 'CASHFLOW'. Or whether you would like to view the PV and extended information, 'ALL'. Thus valid values are - 'TOTAL', 'CASHFLOW' or 'ALL'.
  6. DblBarrier parameter

    Option Types CO, PO, CI, PI
  7. Underlying parameter

    Underlying price
  8. X parameter

    Strike price of the option
  9. L parameter

    Continuous Lower barrier level
  10. U parameter

    Continuous Upper barrier level
  11. AdjBarrFreqL parameter

    Monitoring frequency that you wish the continuous lower barrier level value entered to have. (Basically will convert the barrier from continuous to discrete. If you choose 'Continuously', the barrier will still be a Continuous barrier). Valid values are : Continuously, Hourly, Daily, Weekly or Monthly.
  12. AdjBarrFreqU parameter

    Monitoring frequency that you wish the continuous upper barrier level value entered to have. (Basically will convert the barrier from continuous to discrete. If you choose 'Continuously', the barrier will still be a Continuous barrier). Valid values are : Continuously, Hourly, Daily, Weekly or Monthly.
  13. Time parameter

    Time to option maturity.
  14. Rate parameter

    For the underlying (equity, futures, FX or commodity), this should be an annualised rate (risk free rate or foreign rate). If this is an option on a FX underlying, then if the underlying is quoted as domestic/foreign then this rate will be the domestic rate. If, however, the FX underlying is quoted as foreign/domestic then this will be the foreign rate.
  15. B parameter

    For the underlying (equity, futures, FX or commodity), this should be an annualised rate (dividend rate, risk free rate, foreign rate or holding cost rate respectively). If this is an option on a FX underlying, then if the underlying is quoted as domestic/foreign then this rate will be the foreign rate. If, however, the FX underlying is quoted as foreign/domestic then this will be the domestic rate.
  16. Vol parameter

    Volatility of the underlying.
  17. Delta1 parameter

    Controls the curvature of the Lower L and upper U barriers.
  18. Delta2 parameter

    Controls the curvature of the Lower L and upper U barriers.
  19. Greek parameter

    For the option premium specify 'PREMIUM'. For all first derivatives, you can specify one of the following : 'dUnderlying' (for the 'Underlying' parameter), 'dX' (for the 'X' parameter), 'dL' (for the 'L' parameter), 'dU' (for the 'U' parameter), 'dTime' (for the 'Time' parameter), 'dRate' (for the 'Rate' parameter), 'dB' (for the 'B' parameter), 'dVol' (for the 'Vol' parameter), 'dDelta1' (for the 'Delta1' parameter), 'dDelta2' (for the 'Delta2' parameter), For second order derivatives, you can specify combinations of the first order derivatives (i.e. - 'dUnderlyingdUnderlying', 'dVoldVol', 'dUnderlyingdVol'. )


Extended information

Function Syntax

VB Syntax


Variant CTExoticAnalysis.MDoubleBarrier( _
Long ValueDate, _
DayCountEnum dayCounter, _
Variant Units, _
Variant Position, _
String Level, _
Variant DblBarrier, _
Variant Underlying, _
Variant X, _
Variant L, _
Variant U, _
Variant AdjBarrFreqL, _
Variant AdjBarrFreqU, _
Variant Time, _
Variant Rate, _
Variant B, _
Variant Vol, _
Variant Delta1, _
Variant Delta2, _
String Greek)


Excel Spreadsheet Syntax


=CT.MDoubleBarrier(
Excel Numeric Cell ValueDate,
Excel String Cell dayCounter,
XLRange Units,
XLRange Position,
Excel String Cell Level,
XLRange DblBarrier,
XLRange Underlying,
XLRange X,
XLRange L,
XLRange U,
XLRange AdjBarrFreqL,
XLRange AdjBarrFreqU,
XLRange Time,
XLRange Rate,
XLRange B,
XLRange Vol,
XLRange Delta1,
XLRange Delta2,
Excel String Cell Greek)


C++ Syntax


static CTRangeDataCPP MDoubleBarrier(
long ValueDate,
DayCountEnum dayCounter,
CTRangeDataCPP Units,
CTRangeDataCPP Position,
std::string Level,
CTRangeDataCPP DblBarrier,
CTRangeDataCPP Underlying,
CTRangeDataCPP X,
CTRangeDataCPP L,
CTRangeDataCPP U,
CTRangeDataCPP AdjBarrFreqL,
CTRangeDataCPP AdjBarrFreqU,
CTRangeDataCPP Time,
CTRangeDataCPP Rate,
CTRangeDataCPP B,
CTRangeDataCPP Vol,
CTRangeDataCPP Delta1,
CTRangeDataCPP Delta2,
std::string Greek);


DotNET Syntax


CTRangeData CTExoticAnalysisSA.MDoubleBarrier(
System.Int32 ValueDate,
CTIEnums.DayCountEnum dayCounter,
CTRangeData Units,
CTRangeData Position,
System.String Level,
CTRangeData DblBarrier,
CTRangeData Underlying,
CTRangeData X,
CTRangeData L,
CTRangeData U,
CTRangeData AdjBarrFreqL,
CTRangeData AdjBarrFreqU,
CTRangeData Time,
CTRangeData Rate,
CTRangeData B,
CTRangeData Vol,
CTRangeData Delta1,
CTRangeData Delta2,
System.String Greek);

Parameter data types

ArgNameArgTypeIsKey
ValueDateLongFALSE
dayCounterDayCountEnumFALSE
UnitsRangeFALSE
PositionRangeFALSE
LevelStringFALSE
DblBarrierRangeFALSE
UnderlyingRangeFALSE
XRangeFALSE
LRangeFALSE
URangeFALSE
AdjBarrFreqLRangeFALSE
AdjBarrFreqURangeFALSE
TimeRangeFALSE
RateRangeFALSE
BRangeFALSE
VolRangeFALSE
Delta1RangeFALSE
Delta2RangeFALSE
GreekStringFALSE


Example Inputs

The first column represents the name of the parameters. The second column specifies whether the parameters are optional or not. Finally the last column provides some sample input data.
Function call input string-keys are always in the format : "NAME.EXTTAG.TICKER" The "EXTTAG.TICKER" part is determined from the output of other, capetools, object creation functions.


ArgNameIsOptional (Excel only)Example
ValueDateFALSE19/Jul/2005 (serial date type)
dayCounterFALSEACT365
UnitsFALSEMDoubleBarrier_Units_Range (creates a range object)
PositionFALSEMDoubleBarrier_Position_Range (creates a range object)
LevelFALSEALL
DblBarrierFALSEMDoubleBarrier_DblBarrier_Range (creates a range object)
UnderlyingFALSEMDoubleBarrier_Underlying_Range (creates a range object)
XFALSEMDoubleBarrier_X_Range (creates a range object)
LFALSEMDoubleBarrier_L_Range (creates a range object)
UFALSEMDoubleBarrier_U_Range (creates a range object)
AdjBarrFreqLFALSEMDoubleBarrier_AdjBarrFreqL_Range (creates a range object)
AdjBarrFreqUFALSEMDoubleBarrier_AdjBarrFreqU_Range (creates a range object)
TimeFALSEMDoubleBarrier_Time_Range (creates a range object)
RateFALSEMDoubleBarrier_Rate_Range (creates a range object)
BFALSEMDoubleBarrier_B_Range (creates a range object)
VolFALSEMDoubleBarrier_Vol_Range (creates a range object)
Delta1FALSEMDoubleBarrier_Delta1_Range (creates a range object)
Delta2FALSEMDoubleBarrier_Delta2_Range (creates a range object)
GreekFALSEPREMIUM


Example range for parameter : Units

Within Excel, a range such as this can be passed directly into the Units parameter.


Data is stored within the second column (Vector of data)..

Example C# API usage for setting the range data for parameter : Units



CTQL.CTRangeData MDoubleBarrier_Units;


int[] arrBMDoubleBarrier_Units = {
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1  //  Array Data

};

CTQL.IntVector arrMDoubleBarrier_Units =
new  CTQL.IntVector(arrBMDoubleBarrier_Units);

// Second parameter determines whether the array is a column array (false) or a row array (true)
MDoubleBarrier_Units = new  CTQL.CTRangeData(arrMDoubleBarrier_Units, false);


Example range for parameter : Position

Within Excel, a range such as this can be passed directly into the Position parameter.


Data is stored within the second column (Vector of data)..

Example C# API usage for setting the range data for parameter : Position



CTQL.CTRangeData MDoubleBarrier_Position;


string[] arrBMDoubleBarrier_Position = {
"LONG",
"LONG",
"LONG",
"LONG",
"LONG",
"LONG",
"LONG",
"LONG",
"LONG",
"LONG",
"LONG",
"LONG",
"LONG",
"LONG",
"LONG",
"LONG",
"LONG",
"LONG",
"LONG",
"LONG"  //  Array Data

};

CTQL.StringVector arrMDoubleBarrier_Position =
new  CTQL.StringVector(arrBMDoubleBarrier_Position);

// Second parameter determines whether the array is a column array (false) or a row array (true)
MDoubleBarrier_Position = new  CTQL.CTRangeData(arrMDoubleBarrier_Position, false);


Example range for parameter : DblBarrier

Within Excel, a range such as this can be passed directly into the DblBarrier parameter.


Data is stored within the second column (Vector of data)..

Example C# API usage for setting the range data for parameter : DblBarrier



CTQL.CTRangeData MDoubleBarrier_DblBarrier;


string[] arrBMDoubleBarrier_DblBarrier = {
"CO",
"CO",
"CO",
"CO",
"CO",
"CO",
"CO",
"CO",
"CO",
"CO",
"CO",
"CO",
"CO",
"CO",
"CO",
"CO",
"CO",
"CO",
"CO",
"CO"  //  Array Data

};

CTQL.StringVector arrMDoubleBarrier_DblBarrier =
new  CTQL.StringVector(arrBMDoubleBarrier_DblBarrier);

// Second parameter determines whether the array is a column array (false) or a row array (true)
MDoubleBarrier_DblBarrier = new  CTQL.CTRangeData(arrMDoubleBarrier_DblBarrier, false);


Example range for parameter : Underlying

Within Excel, a range such as this can be passed directly into the Underlying parameter.


Data is stored within the second column (Vector of data)..

Example C# API usage for setting the range data for parameter : Underlying



CTQL.CTRangeData MDoubleBarrier_Underlying;


int[] arrBMDoubleBarrier_Underlying = {
94,
94,
100,
108,
96,
109,
98,
108,
96,
95,
94,
95,
105,
107,
100,
106,
105,
93,
108,
100  //  Array Data

};

CTQL.IntVector arrMDoubleBarrier_Underlying =
new  CTQL.IntVector(arrBMDoubleBarrier_Underlying);

// Second parameter determines whether the array is a column array (false) or a row array (true)
MDoubleBarrier_Underlying = new  CTQL.CTRangeData(arrMDoubleBarrier_Underlying, false);


Example range for parameter : X

Within Excel, a range such as this can be passed directly into the X parameter.


Data is stored within the second column (Vector of data)..

Example C# API usage for setting the range data for parameter : X



CTQL.CTRangeData MDoubleBarrier_X;


int[] arrBMDoubleBarrier_X = {
95,
93,
103,
95,
96,
108,
104,
103,
109,
91,
94,
101,
95,
94,
90,
104,
96,
105,
96,
100  //  Array Data

};

CTQL.IntVector arrMDoubleBarrier_X =
new  CTQL.IntVector(arrBMDoubleBarrier_X);

// Second parameter determines whether the array is a column array (false) or a row array (true)
MDoubleBarrier_X = new  CTQL.CTRangeData(arrMDoubleBarrier_X, false);


Example range for parameter : L

Within Excel, a range such as this can be passed directly into the L parameter.


Data is stored within the second column (Vector of data)..

Example C# API usage for setting the range data for parameter : L



CTQL.CTRangeData MDoubleBarrier_L;


int[] arrBMDoubleBarrier_L = {
82,
81,
86,
97,
98,
86,
83,
97,
94,
93,
84,
87,
92,
91,
82,
84,
84,
87,
91,
90  //  Array Data

};

CTQL.IntVector arrMDoubleBarrier_L =
new  CTQL.IntVector(arrBMDoubleBarrier_L);

// Second parameter determines whether the array is a column array (false) or a row array (true)
MDoubleBarrier_L = new  CTQL.CTRangeData(arrMDoubleBarrier_L, false);


Example range for parameter : U

Within Excel, a range such as this can be passed directly into the U parameter.


Data is stored within the second column (Vector of data)..

Example C# API usage for setting the range data for parameter : U



CTQL.CTRangeData MDoubleBarrier_U;


int[] arrBMDoubleBarrier_U = {
111,
97,
106,
103,
102,
97,
95,
99,
106,
111,
109,
104,
98,
113,
102,
108,
100,
115,
106,
105  //  Array Data

};

CTQL.IntVector arrMDoubleBarrier_U =
new  CTQL.IntVector(arrBMDoubleBarrier_U);

// Second parameter determines whether the array is a column array (false) or a row array (true)
MDoubleBarrier_U = new  CTQL.CTRangeData(arrMDoubleBarrier_U, false);


Example range for parameter : AdjBarrFreqL

Within Excel, a range such as this can be passed directly into the AdjBarrFreqL parameter.


Data is stored within the second column (Vector of data)..

Example C# API usage for setting the range data for parameter : AdjBarrFreqL



CTQL.CTRangeData MDoubleBarrier_AdjBarrFreqL;


string[] arrBMDoubleBarrier_AdjBarrFreqL = {
"Daily",
"Daily",
"Daily",
"Daily",
"Daily",
"Daily",
"Daily",
"Daily",
"Daily",
"Daily",
"Daily",
"Daily",
"Daily",
"Daily",
"Daily",
"Daily",
"Daily",
"Daily",
"Daily",
"Daily"  //  Array Data

};

CTQL.StringVector arrMDoubleBarrier_AdjBarrFreqL =
new  CTQL.StringVector(arrBMDoubleBarrier_AdjBarrFreqL);

// Second parameter determines whether the array is a column array (false) or a row array (true)
MDoubleBarrier_AdjBarrFreqL = new  CTQL.CTRangeData(arrMDoubleBarrier_AdjBarrFreqL, false);


Example range for parameter : AdjBarrFreqU

Within Excel, a range such as this can be passed directly into the AdjBarrFreqU parameter.


Data is stored within the second column (Vector of data)..

Example C# API usage for setting the range data for parameter : AdjBarrFreqU



CTQL.CTRangeData MDoubleBarrier_AdjBarrFreqU;


string[] arrBMDoubleBarrier_AdjBarrFreqU = {
"Daily",
"Daily",
"Daily",
"Daily",
"Daily",
"Daily",
"Daily",
"Daily",
"Daily",
"Daily",
"Daily",
"Daily",
"Daily",
"Daily",
"Daily",
"Daily",
"Daily",
"Daily",
"Daily",
"Daily"  //  Array Data

};

CTQL.StringVector arrMDoubleBarrier_AdjBarrFreqU =
new  CTQL.StringVector(arrBMDoubleBarrier_AdjBarrFreqU);

// Second parameter determines whether the array is a column array (false) or a row array (true)
MDoubleBarrier_AdjBarrFreqU = new  CTQL.CTRangeData(arrMDoubleBarrier_AdjBarrFreqU, false);


Example range for parameter : Time

Within Excel, a range such as this can be passed directly into the Time parameter.


Data is stored within the second column (Vector of data)..

Example C# API usage for setting the range data for parameter : Time



CTQL.CTRangeData MDoubleBarrier_Time;


int[] arrBMDoubleBarrier_Time = {
CTQL.Date.serialNumber("18/10/2005", "dd/mm/yyyy"),
CTQL.Date.serialNumber("18/10/2005", "dd/mm/yyyy"),
CTQL.Date.serialNumber("18/10/2005", "dd/mm/yyyy"),
CTQL.Date.serialNumber("18/10/2005", "dd/mm/yyyy"),
CTQL.Date.serialNumber("18/10/2005", "dd/mm/yyyy"),
CTQL.Date.serialNumber("18/10/2005", "dd/mm/yyyy"),
CTQL.Date.serialNumber("18/10/2005", "dd/mm/yyyy"),
CTQL.Date.serialNumber("18/10/2005", "dd/mm/yyyy"),
CTQL.Date.serialNumber("18/10/2005", "dd/mm/yyyy"),
CTQL.Date.serialNumber("18/10/2005", "dd/mm/yyyy"),
CTQL.Date.serialNumber("18/10/2005", "dd/mm/yyyy"),
CTQL.Date.serialNumber("18/10/2005", "dd/mm/yyyy"),
CTQL.Date.serialNumber("18/10/2005", "dd/mm/yyyy"),
CTQL.Date.serialNumber("18/10/2005", "dd/mm/yyyy"),
CTQL.Date.serialNumber("18/10/2005", "dd/mm/yyyy"),
CTQL.Date.serialNumber("18/10/2005", "dd/mm/yyyy"),
CTQL.Date.serialNumber("18/10/2005", "dd/mm/yyyy"),
CTQL.Date.serialNumber("18/10/2005", "dd/mm/yyyy"),
CTQL.Date.serialNumber("18/10/2005", "dd/mm/yyyy"),
CTQL.Date.serialNumber("18/10/2005", "dd/mm/yyyy")  //  Array Data

};

CTQL.IntVector arrMDoubleBarrier_Time =
new  CTQL.IntVector(arrBMDoubleBarrier_Time);

// Second parameter determines whether the array is a column array (false) or a row array (true)
MDoubleBarrier_Time = new  CTQL.CTRangeData(arrMDoubleBarrier_Time, false);


Example range for parameter : Rate

Within Excel, a range such as this can be passed directly into the Rate parameter.


Data is stored within the second column (Vector of data)..

Example C# API usage for setting the range data for parameter : Rate



CTQL.CTRangeData MDoubleBarrier_Rate;


double[] arrBMDoubleBarrier_Rate = {
0.0978,
0.0927,
0.0928,
0.1015,
0.0967,
0.101,
0.0972,
0.1048,
0.1027,
0.1012,
0.1076,
0.1062,
0.1061,
0.0931,
0.0904,
0.1076,
0.0977,
0.0959,
0.0943,
0.1  //  Array Data

};

CTQL.DoubleVector arrMDoubleBarrier_Rate =
new  CTQL.DoubleVector(arrBMDoubleBarrier_Rate);

// Second parameter determines whether the array is a column array (false) or a row array (true)
MDoubleBarrier_Rate = new  CTQL.CTRangeData(arrMDoubleBarrier_Rate, false);


Example range for parameter : B

Within Excel, a range such as this can be passed directly into the B parameter.


Data is stored within the second column (Vector of data)..

Example C# API usage for setting the range data for parameter : B



CTQL.CTRangeData MDoubleBarrier_B = new CTQL.CTRangeData();

System.Text.StringBuilder MDoubleBarrier_B_builder =
new System.Text.StringBuilder(100);

MDoubleBarrier_B_builder.Append("{");
MDoubleBarrier_B_builder.Append("0 ;");
MDoubleBarrier_B_builder.Append("0 ;");
MDoubleBarrier_B_builder.Append("0 ;");
MDoubleBarrier_B_builder.Append("0 ;");
MDoubleBarrier_B_builder.Append("0 ;");
MDoubleBarrier_B_builder.Append("0 ;");
MDoubleBarrier_B_builder.Append("0 ;");
MDoubleBarrier_B_builder.Append("0 ;");
MDoubleBarrier_B_builder.Append("0 ;");
MDoubleBarrier_B_builder.Append("0 ;");
MDoubleBarrier_B_builder.Append("0 ;");
MDoubleBarrier_B_builder.Append("0 ;");
MDoubleBarrier_B_builder.Append("0 ;");
MDoubleBarrier_B_builder.Append("0 ;");
MDoubleBarrier_B_builder.Append("0 ;");
MDoubleBarrier_B_builder.Append("0 ;");
MDoubleBarrier_B_builder.Append("0 ;");
MDoubleBarrier_B_builder.Append("0 ;");
MDoubleBarrier_B_builder.Append("0 ;");
MDoubleBarrier_B_builder.Append("0.00");
MDoubleBarrier_B_builder.Append("}");

// Parse the string into the Range object.
MDoubleBarrier_B.RangeFromStr( MDoubleBarrier_B_builder.ToString() );


Example range for parameter : Vol

Within Excel, a range such as this can be passed directly into the Vol parameter.


Data is stored within the second column (Vector of data)..

Example C# API usage for setting the range data for parameter : Vol



CTQL.CTRangeData MDoubleBarrier_Vol;


double[] arrBMDoubleBarrier_Vol = {
0.2539,
0.2254,
0.2537,
0.2749,
0.2397,
0.269,
0.2322,
0.2742,
0.25,
0.226,
0.2596,
0.2588,
0.2578,
0.2307,
0.2739,
0.2433,
0.2347,
0.2713,
0.251,
0.25  //  Array Data

};

CTQL.DoubleVector arrMDoubleBarrier_Vol =
new  CTQL.DoubleVector(arrBMDoubleBarrier_Vol);

// Second parameter determines whether the array is a column array (false) or a row array (true)
MDoubleBarrier_Vol = new  CTQL.CTRangeData(arrMDoubleBarrier_Vol, false);


Example range for parameter : Delta1

Within Excel, a range such as this can be passed directly into the Delta1 parameter.


Data is stored within the second column (Vector of data)..

Example C# API usage for setting the range data for parameter : Delta1



CTQL.CTRangeData MDoubleBarrier_Delta1;


int[] arrBMDoubleBarrier_Delta1 = {
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0  //  Array Data

};

CTQL.IntVector arrMDoubleBarrier_Delta1 =
new  CTQL.IntVector(arrBMDoubleBarrier_Delta1);

// Second parameter determines whether the array is a column array (false) or a row array (true)
MDoubleBarrier_Delta1 = new  CTQL.CTRangeData(arrMDoubleBarrier_Delta1, false);


Example range for parameter : Delta2

Within Excel, a range such as this can be passed directly into the Delta2 parameter.


Data is stored within the second column (Vector of data)..

Example C# API usage for setting the range data for parameter : Delta2



CTQL.CTRangeData MDoubleBarrier_Delta2;


int[] arrBMDoubleBarrier_Delta2 = {
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0  //  Array Data

};

CTQL.IntVector arrMDoubleBarrier_Delta2 =
new  CTQL.IntVector(arrBMDoubleBarrier_Delta2);

// Second parameter determines whether the array is a column array (false) or a row array (true)
MDoubleBarrier_Delta2 = new  CTQL.CTRangeData(arrMDoubleBarrier_Delta2, false);



Example function usage


The C# example below contains all the sub-function calls leading up to this function call. As a result, the example can contain a lot of code.

The VB.NET, J#, C++.NET, Java, Excel VBA, Visual Basic 6 (via COM) and C++ examples below contain function code stubs for the calls leading up to this function call. However, the function call for this function is displayed.
You can easily reproduce the stub functions code from the C# example.


If you are accessing this functrion via the MiniXL libraries, this function is present within the CT.QL.Pricing20 MiniXL Excel Addin.

Within our Excel Example Addin Generator, we have used the following QuantTools sub-functions in order to prepare the arguments needed to call the MDoubleBarrier() function. If you are executing this function via the MiniXL libraries, the module addin name, (in brackets, to the right of the sub-functions listed below), indicates the MiniXL library in which the sub-function is held. You will need to load this library into your Excel session (along with any other libraries that the sub-function call within the addin requires (ie - CT.QT.Utils20 addin in almost all cases) in order for the example to compute successfully.


The following four examples demostrate calling this function within a Microsoft .NET environment

The following four examples demostrate calling this function within a non .NET environment

The following is a sample output from executing the MDoubleBarrier() function call


Example
NoOfUnitsPositionDblBarrierUnderlyingXLUAdjBarrFreqLAdjBarrFreqUTimeRateBVolDelta1Delta2PREMIUM
1LONGCO10810989108DailyDaily386430.098200.266800-1.#IND
1LONGCO909283112DailyDaily386430.09700.2387002.54971
1LONGCO9510596103DailyDaily386430.098600.273800-1.13703e-005
1LONGCO1069682102DailyDaily386430.098800.237600-0.0411072
1LONGCO1059097100DailyDaily386430.107100.272900-0.00880255
1LONGCO10110898114DailyDaily386430.104500.2334000.0557138
1LONGCO1059887107DailyDaily386430.099500.2623000.11076
1LONGCO949394111DailyDaily386430.091500.266400-1.#IND
1LONGCO919588101DailyDaily386430.107800.2666000.0253644
1LONGCO93969696DailyDaily386430.090700.2251000.00126781
1LONGCO1009982108DailyDaily386430.100700.2312000.440477
1LONGCO10310688106DailyDaily386430.093400.2398000.000118123
1LONGCO1059788100DailyDaily386430.090900.267700-0.000294037
1LONGCO1109187101DailyDaily386430.100500.269900-0.0446741
1LONGCO999394108DailyDaily386430.099100.2654000.252647
1LONGCO10310789104DailyDaily386430.100.244300-0.000869878
1LONGCO9910782110DailyDaily386430.090600.2457000.0263546
1LONGCO11010497106DailyDaily386430.107300.274800-1.48882e-005
1LONGCO9810993101DailyDaily386430.105400.246700-0.00114933
1LONGCO10010090105DailyDaily386430.100.25000.0372798



Copyright (c) 2003-2007 CapeTools - All Rights Reserved.