【BjerkStensCall】
[code]inputs:
AssetPr( numericsimple ),
StrikePr( numericsimple ),
YearsLeft( numericsimple ),
Rate( numericsimple ),
Carry( numericsimple ),
Volty( numericsimple ) ;
variables:
var0( 0 ),
var1( 0 ),
var2( 0 ),
var3( 0 ),
var4( 0 ),
var5( 0 ),
var6( 0 ) ;
if Carry < Rate then
begin
var0 = Square( Volty ) ;
var1 = .5 - Carry / var0 + SquareRoot( Square( Carry / var0 - .5 )
+ 2 * Rate / var0 ) ;
var2 = ( var1 / ( var1 - 1 ) ) * StrikePr ;
var3 = MaxList( StrikePr, ( Rate / ( Rate - Carry ) ) * StrikePr ) ;
var4 = -( Carry * YearsLeft + 2 * Volty * Square( YearsLeft ) ) * var3
/ ( var2 - var3 ) ;
var5 = var3 + ( var2 - var3 ) * ( 1 - ExpValue( var4 ) ) ;
var6 = ( var5 - StrikePr ) * Power( var5, - var1 ) ;
if AssetPr >= var5 then
BjerkStensCall = AssetPr - StrikePr
else
BjerkStensCall = var6 * Power( AssetPr, var1 )- var6
* BjerkStensPhi(
AssetPr, YearsLeft, var1, var5, var5, Rate, Carry, Volty )
+ BjerkStensPhi(
AssetPr, YearsLeft, 1, var5, var5, Rate, Carry, Volty )
- BjerkStensPhi(
AssetPr, YearsLeft, 1, StrikePr, var5, Rate, Carry, Volty )- StrikePr
* BjerkStensPhi(
AssetPr, YearsLeft, 0, var5, var5, Rate, Carry, Volty ) + StrikePr
* BjerkStensPhi(
AssetPr, YearsLeft, 0, StrikePr, var5, Rate, Carry, Volty ) ;
end
else
BjerkStensCall = 0 ;
[/code]
页:
[1]