麻烦高手帮忙看看
Function DOC(S0, K, r, sigma, T, B, N, M)
Dim i As Integer
Dim j As Integer
Dim intermM, intermP, intermS As Double
epsilon = T / M
intermP = 0
For i = 1 To N
intermS = S0
intermM = S0
For j = 1 To M
intermS = intermS * (Exp(r - (1 / 2) * sigma ^ 2) * (epsilon) + sigma * (Sqr(epsilon)) * Gaussrand())
intermM = Application.WorksheetFunction.Min(intermM, intermS)
Next j
If internM > b Then
intermP = intermP + Application.WorksheetFunction.Max(intermS - K, 0)
Else
intemP = intemP
End If
Next i
DOC = intermP * Exp(-r * T) / N
Range("B1").Value = DOC