[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Cumulative Normal Distr Function in AB



PureBytes Links

Trading Reference Links

Anthony,

Thank you. I appreciate your answer with formulas very much. You 
resolved my problem. Sorry about your e-mail. I did not check my e-
mails recently. 

Best Regards,
artast



--- In amibroker@xxxx, Anthony Faragasso <ajf1111@xxxx> wrote:
> Hello, Artast
> 
> I do not know if you received the last email I sent to you, Here is 
an
> updated black shcoles option pricing formula, the results match 
excel
> exactly from about 15 points above stock price to any where below 
stock
> price. Gives call Fair Value and Put Fair value.
> 
> As I said in Previous email, above 15 points excel and Ab do not 
match,
> Ab seems to add a couple of points to the fair values, this is
> something I am looking into.
> 
> Maybe, only Tomasz could answer that question. we shall see.
> 
> As for Normal Density Function:
> 
> N=1-1/sqrt(2*pi)*exp(-(x^2)/2)*(b1*t) +( b2*t^2) +(b3*t^3) +
(b4*t^4) +
> (b5*t^5)
> 
> where t = 1/1+p*x
> 
> b1 = 0.31938153
> b2 = -0.3565638
> b3 = 1.78147794
> b4 = -1.821256
> b5 = 1.33027443
> P = 0.2316419
> 
> Hope this helps.
> Anthony
> 
> myartast wrote:
> 
> > Hello,
> >
> > Please is anybody who can write or send me by e-mail the exact
> > formula for Cumulative Normal Distr Function N(d) which I can use 
in
> > AB?
> > Thanks very much in advance.
> >
> > artast,
> > artast@xxxx
> >
> >
> > Yahoo! Groups Sponsor
> ADVERTISEMENT
> 
> 
> >
> > Your use of Yahoo! Groups is subject to the Yahoo! Terms of 
Service.
> 
> //BLACK SHCOLES OPTION PRICING FORMULA
> //Interpreted and coded by Anthony Faragasso
> 
> // Enter Variables
> 
> Vshort=0; // setting this variable, will use volatility of Market
> // ( ex. setting to 20,is a 20 period historical 
volatility
> StockPrice = 100; //Stock Price for testing( replace with 
Close ) 
> Timedays = 182; //Time to expiry ( days to exp/365 )
> StrikePrice = 120; //strike Price of Option to evaluate
> InterestRate= 0.1; //prevailing interest rate 
> V =0.2; //Setting Vshort to 0, you can insert Known 
volatility here. 
> V = IIf(vshort > 0,StDev(log(C/Ref(C,-1)),Vshort)*sqrt(365)
*100,V); 
> time=timedays/365;// days to expire conversion for formula
> 
> 
> 
> /*************************************************/
> // Solves for ( X )
> 
> x = (ln(stockPrice/strikePrice) + (interestrate + V*V/2)*time)/
(V*sqrt(time)); 
> /*************************************************/
> 
> P = 0.2316419; //0.33267; //koeficient 
> bb1 = 0.31938153; //0.4361836; //koef
> bb2 = -0.3565638; //-0.1201676; //koef
> bb3 = 1.78147794; //0.937298; //koef
> bb4 = -1.821256;
> bb5 = 1.33027443;
> 
> pi = 3.141592654; // PI
> 
> A2 = 1/sqrt(2*pi);
> A3 = exp(-(x^2)/2);
> y= a2*a3;
> A4 = exp(-interestrate*time);
> t1 = 1/(1+ P*x);
> A5=(bb1*t1)+(bb2*t1^2) +( bb3*t1^3)+(bb4*t1^4)+(bb5*t1^5);
> /************************************************************/
> //Standard Normal Distribution Function of ( x )
> 
> 
> N = 1- y *A5 ;
> 
> /************************************************************/
> // Solves for ( X1 )
> X1=x-V*sqrt(TIME);
> 
> y1=1/sqrt(2*pi);
> N0=exp(-(x1^2)/2);
> T2=1/(1+ P*X1);
> A6=(bb1*t2)+(bb2*t2^2) +( bb3*t2^3)+(bb4*t2^4)+(bb5*t2^5);
> A7=exp(-interestrate*time);
> y2=y1*n0;
> 
> /************************************************************/
> /* Standard Normal Distribution Function OF ( x1 )*/
> /***********************************************************/
> N2= 1-y2 * A6;
> 
> /************ CALL OPTION FAIR VALUE************/
> Call = stockPrice * N - strikePrice * A4 * N2 ;
> 
> /************ PUT OPTION FAIR VALUE*************/
> 
> Put = Call - stockprice + strikeprice*A7;
> 
> 
> Filter = 1;
> 
> AddColumn(stockPrice,"AssetP",2.2);
> AddColumn(strikeprice,"StrikeP",1.2);
> AddColumn(timedays,"DaysToExpire ",1);
> AddColumn(Call,"Call FV",1.2);
> AddColumn(put,"Put FV",1.2);
> 
> /************************************/
> /* test columns */
> AddColumn(x,"X",1.2);
> AddColumn(A3,"a3",1.2);
> AddColumn(n,"N",1.2);
> AddColumn(t1,"t1",1.2);