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

Re: [amibroker] Re: Problem with "Standard Normal Distribution Function"



PureBytes Links

Trading Reference Links

check out the image file , I have also attached the New Option Pricing
model, load into the Automatic analysis and hit explore. It is returning
the values as in the sample, but it needs to be checked with other
samples in which you know what the fair value should be , for accuracy.

Send some Examples, and I will check. Let me Know.

Best Wishes,
Anthony

artast@xxxx wrote:

> Anthony,
>
> Thank you for a quick reply. Please is it possible to check and
> correct Standard Normal Distribution Function (N) and Call formula
> (Call = S*dd1 -E*exp(-r*time)*dd2) by you? dd1 formula is correct
> (1.17) and Call FV should be 15.28 in this example.
> Thanks in advance.
>
> Regards,
> artast
>
> --- In amibroker@xxxx, Anthony Faragasso <ajf1111@xxxx> wrote:
> > Hello Artast;
> >
> > I tried your formula in Automatic analysis, and hit explore , it
> seems
> > to be using the( apply to and range ) options in the Automatic
> > analysis window.
> >
> > Anthony
> >
> > artast@xxxx wrote:
> >
> > > Hello Everybody,
> > >
> > > I'd like to use Black_Schole Option Formula for my research in AB.
>
> > > But I have a problem to define the "Standard Normal Distribution
> > > Function". It is really a long time I am out of school.
> > > Please can anybody help me?
> > > Thanks in advance.
> > >
> > > Regards,
> > > artast
> > >
> > > /*The Formula: I entered exact values from the example to check
> Call
> > > Fair Value. It should be 15.28. Source
> > > www.geocities.com/WallStreet/2529/bsopm.htm */
> > >
> > > S = 100; //Stock Price for testing
> > > time = 0.5; //Time to expiry (days to expir/253 or days to exp/365
>
> > > E = 90; //Strike
> > > r = 0.1; //prevailing interest rate
> > > Q = 0.2; //Volatility
> > > dd1 = (ln(S/E) + (r + Q*Q/2)*time)/(Q*sqrt(time));
> > > dd2 = dd1 - Q*sqrt(time);
> > > A = 0.33267; //koeficient
> > > bb1 = 0.4361836; //koef
> > > bb2 = -0.1201676; //koef
> > > bb3 = 0.937298; //koef
> > > k = 1/(1+ A*dd1);
> > > pi = 3.141592654;
> > >
> > > N = IIf(dd1>0, 1-(1/sqrt(2*pi))*exp((-dd1*dd1)/2) * ((bb1*k)+
> > > (bb2*k*k) + (bb3*k*k*k)), IIf(dd1<0, dd2, 0.5)); //Standard Normal
>
> > > Distribution Function
> > >
> > > Call = S*dd1 -E*exp(-r*time)*dd2; // B&S Formula for Call Option
> FV
> > >
> > > Filter = 1;
> > > AddColumn(C,"C",1.2);
> > > AddColumn(Call,"CallFV",1.2);
> > > AddColumn(N,"N",1.2);
> > > AddColumn(dd1,"dd1",1.2);
> > > AddColumn(dd2,"dd2",1.2);
> > >
> > >
> > > Yahoo! Groups Sponsor
> > ADVERTISEMENT
> >
> >
> > >
> > > Your use of Yahoo! Groups is subject to the Yahoo! Terms of
> Service.
>
>
> Yahoo! Groups Sponsor
ADVERTISEMENT


>
> Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.


S = 100; //Stock Price for testing 
time = 0.5; //Time to expiry (days to expir/253 or days to exp/365
E = 90; //Strike
r = 0.1; //prevailing interest rate 
V = 0.2; //Volatility
/*************************************************/
// Solves for ( X )

x = (ln(S/E) + (r + V*V/2)*time)/(V*sqrt(time)); 
/*************************************************/

A1 = 0.33267; //koeficient
bb1 = 0.4361836; //koef
bb2 = -0.1201676; //koef
bb3 = 0.937298; //koef
pi = 3.141592654; // PI

t1 = 1/((1+ A1)*x);

A2 = 1/sqrt(2)*pi;
A3 = exp(-(X^2)/2);
A4 = exp(-r*tIME);
/************************************************************/
//Standard Normal Distribution Function

N = IIf(x > 0,1- A2* A3 * bb1*t1+bb2*(t1^2) + bb3*(t1^3), IIf(x<0, 1-(-x),IIf(x==0,0.5,0)));

/************************************************************/

X1=N-V*sqrt(TIME);
N0=exp(-(X1^2)/2);
T2=1/(1+ (A1*X1));

/************************************************************/
/* Standard Normal Distribution Function OF ( x1 )*/
/***********************************************************/
N2= 1-(A2 * X1) * bb1*(t2)+bb2*(T2^2) + bb3*(t2^3)+.0258;


Call = S*N-E*A4*N2;// B&S Formula for Call Option FV

Filter = 1;
AddColumn(s,"AssetP",2.2);
AddColumn(E,"StrikeP",1.2);
AddColumn(time,"Expires",1.1);
AddColumn(Call,"CallFV",1.2);
/************************************/
/* test columns */
AddColumn(x,"X",1.3);
AddColumn(A3,"A3",1.2);
AddColumn(A2,"a2",1.2);
AddColumn(A4,"A4",1.2);

Attachment: Description: "AddColumn(N2,"n2",1.3);"