我一直在sigma2d行的定義中收到無效的過程調用或參數錯誤。 任何想法如何避免此代碼錯誤?算術亞洲期權定價
Private Sub CommandButton4_Click()
Application.Range("E19").value = ""
Application.Range("F19").value = ""
S0 = Application.Range("C5").value 'arithmetic average of underlying 1
K = Application.Range("C6").value 'strike
T = Application.Range("C10").value 'maturity
sigma = Application.Range("C8").value 'volatility
r = Application.Range("C8").value 'risk free rate
nsteps = Application.Range("C12").value 'no of timesteps
nsimulations = Application.Range("C13").value ' no of mc simulations
div = Application.Range("C9").value 'dividends
Randomize
Dim M1 As Double, M2 As Double, sigma2d As Double
Dim d1 As Double, d2 As Double, Nd1 As Double, Nd2 As Double
M1 = (Exp((r - div) * T) - 1)/(r - div) * T
v = (2 * Exp((2 * r) - (2 * div) + (sigma * sigma) * T)) * S0 * S0
w = (r - div + (sigma * sigma)) * (2 * r - 2 * q + (sigma * sigma)) * T * T
Z = 2 * S0 * S0/((r - div) * T * T)
y = (1/2 * (r - div) + sigma * sigma)
h = Exp((r - div) * T)/(r - div + (sigma * sigma))
M2 = (v/w) + Z * (y - h)
M3 = M1 * M1
sigma2d = Log(M2/M3)
d1 = (Log(M1/K) + (sigma2d * T)/2)/sigma * Sqr(T)
d2 = d1 - sigma * Sqr(T)
callArith = Exp(-r * T) * (M1 * Nd1 - K * Nd2)
Application.Range("E19").value = Application.Max(ExactCall, 0)
這可能是答案。 – Bathsheba
讓我知道,如果你得到它的工作,並可以接受我的答案或不! – Sam