library("finance")
proc(v) = SpecialOPT(s0)
maxcall = 1.4*(s0[1]-40)
next = 0.95*(s0[2]-60)
if(next>maxcall)
maxcall = next
endif
next = 2.1*(s0[4]-27)
if(next>maxcall)
maxcall = next
endif
next = 0.16*(s0[5]-340)
if(next>maxcall)
maxcall = next
endif
next =(s0[6]-57.5)
if(next>maxcall)
maxcall = next
endif
maxput =(55-s0[3])
if((maxput+maxcall)>0)
v = maxput+maxcall
else
v = 0
endif
endp
s0 = #(40.14,59.4,56.57,26.79,335.3,58.65)
r = 0.058
div = 0.01
dt = 1
vola = #(0.1744942,0.0570134,0.0305491,0.0123347,0.0250993,0.0225357)
vola = vola|#(0.0570134,0.1024468,0.0456498,0.0212167,0.0207358,0.0278711)
vola = vola|#(0.0305491,0.0456498,0.0924536,0.0150578,0.0139953,0.0179354)
vola = vola|#(0.0123347,0.0212167,0.0150578,0.0776464,0.0037853,0.0078510)
vola = vola|#(0.0250993,0.0207358,0.0139953,0.0037853,0.0975046,0.0439312)
vola = vola|#(0.0225357,0.0278711,0.0179354,0.0078510,0.0439312,0.1670526)
BlackScholesPathIndependentMDDivQMC(s0,r,div,vola,dt,"SpecialOPT",100000,3)