I have made several attempts, this is the latest iteration. It shouldn't produce meaningful output until the minimum periods have been looped thru (volstperiod = 10).
--PctChg1() is an array which holds percent change data from i=2 to i = 2541... declared as variant
--volstperiod = 10 ...declared as integer
--i is a counter ...declared as integer
--VolST1() is an empty array which I hope to populate with annualized volatilities for a rolling x day period ...declared as variant
--Option Base 1 and Option Explicit are on
For i = 2 To 2541
If IsNumeric(i) And i <> 0 Then
VolST1(i, 1) = Application.WorksheetFunction.stdev(Range(PctChg1(i, 1).Offset(-volstperiod, 0), PctChg1(i, 0)))
Else
VolST1(i, 1) = 0
End If
Next i
Any guidance would be immensely appreciated. Thanks!
--PctChg1() is an array which holds percent change data from i=2 to i = 2541... declared as variant
--volstperiod = 10 ...declared as integer
--i is a counter ...declared as integer
--VolST1() is an empty array which I hope to populate with annualized volatilities for a rolling x day period ...declared as variant
--Option Base 1 and Option Explicit are on
For i = 2 To 2541
If IsNumeric(i) And i <> 0 Then
VolST1(i, 1) = Application.WorksheetFunction.stdev(Range(PctChg1(i, 1).Offset(-volstperiod, 0), PctChg1(i, 0)))
Else
VolST1(i, 1) = 0
End If
Next i
Any guidance would be immensely appreciated. Thanks!