简体   繁体   中英

VBA BS Option function syntax error

I am trying to write a BS option call value function using VBA:

Function BSCallValue(S, K, r, q, tyr, Sigma)
' returns black-scholes call value (allowing for q=div yld)
Dim ert, qrt
Dim DOne, DTwo, NDOne, NDTwo
ert = Exp(-r * tyr)
qrt = Exp(-q * tyr)

DOne = (Log(S / K) + (r - q + 0.5 * Sigma^2) * tyr) / (Sigma * Sqr(tyr))
DTwo = (Log(S / K) + (r - q - 0.5 * Sigma^2) * tyr) / (Sigma * Sqr(tyr))
NDOne = Application.Norm_S_Dist(DOne)
NDTwo = Application.Norm_S_Dist(DTwo)

BSCallValue = (S * qrt * NDOne - K * ert * NDTwo)


End Function

However the DOne and DTwo line keep giving me 'syntax error'.

Whats is wrong with this?

Norm_S_Dist expects two parameters. Use,

NDOne = Application.Norm_S_Dist(DOne, true)
NDTwo = Application.Norm_S_Dist(DTwo, false)

NORM.S.DIST(z,cumulative)

The NORM.S.DIST function syntax has the following arguments:

Z (Required) The value for which you want the distribution.
Cumulative (Required) Cumulative is a logical value that determines the form of the function. If cumulative is TRUE, NORMS.DIST returns the cumulative distribution function; if FALSE, it returns the probability mass function.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM