Attribute VB_Name = "OptCalc" ' spot - price of underlying ' struck - strike price ' sigm - volatility, annualized ' r - free risk rate, , annualized ' t - time to expiry, years ' Underlying - futures Function max(ByVal a As Double, ByVal b As Double) ' Maximum of a & b If a > b Then max = a Else max = b End Function Function NDD(ByVal x As Double) As Double ' Denisty normal distribution ' for OpenOffice.net ' Under Construction ' for MS Excel NDD = Application.WorksheetFunction.NormDist(x, 0, 1, 0) End Function Function NDA(ByVal x As Double) As Double ' Normal distribution aproach ' for OpenOffice.net Dim ax, t, D, p As Double If x > 10 Then N = 1 ElseIf x < -10 Then N = 0 Else ax = Sqr(x * x) t = 1 / (1 + 0.2316419 * ax) D = 0.3989423 * Exp(-0.5 * x * x) p = D * t * ((((1.330274 * t - 1.821256) * _ t + 1.781478) * t - 0.3565638) * t + 0.3193815) 'NDA = p If x > 0 Then NDA = 1 - p Else NDA = p End If ' for MS Excel NDA = Application.WorksheetFunction.NormDist(x, 0, 1, 1) End Function Function EFC(ByVal spot As Double, ByVal struck As Double, _ ByVal sigm As Double, ByVal r As Double, _ ByVal t As Double) ' European Vanilla Call Price Black-Scholes (Underlying - FUTURES) If t < 0 Then EFC = 0 Else If t = 0 Then EFC = max(0, spot - struck) Else D = (Log(spot / struck) + (sigm * sigm / 2) * t) / (sigm * Sqr(t)) EFC = Exp(-r * t) * (spot * (NDA(D)) - struck * (NDA(D - sigm * Sqr(t)))) End If End If End Function