¿ªÔÆÌåÓý

ctrl + shift + ? for shortcuts
© 2025 Groups.io

Normal Distribution in Vbasic


 

This is not specifically about the TWS API, but you guys are the most
knowledgeable guys on this subject. I've already tried everywhere
else.

How do I get the cumulative standard normal distribution in VB? in
Excel it would be "=normsdist(Z)". I can't find any reference to it
in any documentation any where.

I appreciate any hope y'all might be able to give.

Thanks.

-D


cyberbri_2000
 

Does this help?



The computation of the area under the normal curve requires a
numerical solution of the error function and can represent hundreds
of lines of computer code. To facilitate the computation of this area
for probability determinations when a computer or tabulated values
are not available, the following approximation can be used with very
good results to calculate the area from a z-score of zero to the
absolute value of the desired z-score z:

Area = K * sqrt[1 - e^(-(z^2)/2)]

where

K = 0.5 + [1/sqrt(Pi) - 0.5] * [e^(-(z^2)/sqrt(2*Pi))]

This is not specifically about the TWS API, but you guys are the
most knowledgeable guys on this subject. I've already tried
everywhere else.

How do I get the cumulative standard normal distribution in VB? in
Excel it would be "=normsdist(Z)". I can't find any reference to
it in any documentation any where.


 

That's a step in the right direction, but is there no built in
function in VB? It seems ridiculous that it would be left out.

Unfortunately, looking at this document it seems that the magnitude
of error is inversely correlated to the distance from the mean.
Which is the exact opposite of the error in Black Scholes (my
intended purpose) which means the two errors would be enormous when
put together.

Does anyone else know? Has anyone ever built an option calculator
in VB before?

Thanks.


--- In twsapi@y..., cyberbri_2000 <no_reply@y...> wrote:
Does this help?



The computation of the area under the normal curve requires a
numerical solution of the error function and can represent hundreds
of lines of computer code. To facilitate the computation of this
area
for probability determinations when a computer or tabulated values
are not available, the following approximation can be used with
very
good results to calculate the area from a z-score of zero to the
absolute value of the desired z-score z:

Area = K * sqrt[1 - e^(-(z^2)/2)]

where

K = 0.5 + [1/sqrt(Pi) - 0.5] * [e^(-(z^2)/sqrt(2*Pi))]