Witam,
Jestem bardzo świeży w programowaniu i utknąłem na pewnym problemie a mianowicie mam napisane dwie funkcje do wyliczania greckich wskaźników dla opcji. Chciałbym aby wyniki z tych funkcji pojawiały się w dwóch komórkach po wybraniu ctrl shift enter. Wiem, że służy do tego Array, ale mimo prób nie udaje mi się tego zrobić. Czy ktoś mógłby mi pomóc?
Function BSDelta(Spot As Double, Strike As Double, Maturity As Double, Vol As Double, Rf As Double, Dividend As Double) As Double
Dim D1 As Double
D1 = (Application.WorksheetFunction.Ln(Spot / Strike) + (Rf - Dividend + 0.5 * Vol * Vol) * Maturity) / (Vol * sqr(Maturity))
BSDelta = Application.WorksheetFunction.NormSDist(D1) * Exp(-Dividend * Maturity)
End Function
Function BSVega(Spot As Double, Strike As Double, Maturity As Double, Vol As Double, Rf As Double, Dividend As Double) As Double
Dim D1 As Double
D1 = (Application.WorksheetFunction.Ln(Spot / Strike) + (Rf - Dividend + 0.5 * Vol * vol) * Maturity) / (Vol * sqr(Maturity))
BSVega = Spot * Exp(-Dividend * Maturity) * Sqr(Maturity) * Exp(-(D1 2) / 2) / (2 * Application.WorksheetFunction.Pi()) 0.5
End Function