Presentation is loading. Please wait.

Presentation is loading. Please wait.

for i = 1 : NRepl Path = AssetPaths( S0,r,sigma,T,NStep,1); Path = AssetPaths( S0,r,sigma,T,NStep,1); if ud == 0 % up if ud == 0 % up tcross = min(find(Path.

Similar presentations


Presentation on theme: "for i = 1 : NRepl Path = AssetPaths( S0,r,sigma,T,NStep,1); Path = AssetPaths( S0,r,sigma,T,NStep,1); if ud == 0 % up if ud == 0 % up tcross = min(find(Path."— Presentation transcript:

1

2 for i = 1 : NRepl Path = AssetPaths( S0,r,sigma,T,NStep,1); Path = AssetPaths( S0,r,sigma,T,NStep,1); if ud == 0 % up if ud == 0 % up tcross = min(find(Path >= Sb)); tcross = min(find(Path >= Sb)); else % down else % down tcross = min(find(Path <= Sb)); tcross = min(find(Path <= Sb)); end end if not(isempty(tcross)) if not(isempty(tcross)) Ncross = Ncross + 1; Ncross = Ncross + 1; Times(Ncross) = (tcross-1) * dt; Times(Ncross) = (tcross-1) * dt; StockVals(Ncross) = Path(tcross); StockVals(Ncross) = Path(tcross); end endend

3

4

5

6 else else Payoffs(i) = 10; Payoffs(i) = 10; end endend [payoff, var, CI] = normfit(Payoffs); end

7 for i = N : -1 : 1 for i = N : -1 : 1 for j = 0 : i-1 for j = 0 : i-1 S(j+1) = max(10, exp(-r*deltaT) * ( S(j+1)*p + S(j+2)*(1-p) ) ); S(j+1) = max(10, exp(-r*deltaT) * ( S(j+1)*p + S(j+2)*(1-p) ) ); end end lattice(1:i,i) = S(1:i); lattice(1:i,i) = S(1:i); end end payoff = S(1); payoff = S(1);end

8

9

10

11


Download ppt "for i = 1 : NRepl Path = AssetPaths( S0,r,sigma,T,NStep,1); Path = AssetPaths( S0,r,sigma,T,NStep,1); if ud == 0 % up if ud == 0 % up tcross = min(find(Path."

Similar presentations


Ads by Google