Code
Public Sub TFE()
Const C_R_S = 13
'Now,we will iterate to draw the FE
bMax = False
i = 2
j = C_R_S
Do While ( Not ( IsEmpty ( Cells ( i , j ) ) ) And bMax = False )
'we set the desired return
Cells ( 98 , 5 ) .Value = Cells ( i , j )
'we optimize the variance accordingly
Call OptimiseVolPF
'we recover the return
Cells ( i , j +1 ) .Value = Cells ( 97 , 3 )
'we get the annual variance
Cells ( i , j + 2 ) .Value = Cells ( 100 , 3 )
i = i + 1
'if we have not managed to improve, then we stop
If i > 3 And Cells ( i - 2 , j + 1 ) .Value = Cells ( i + 2 , j + 1 ) .Value Then bMax = True
Loop
End sub
Display More
[Blocked Image: https://www.ozgrid.com/forum/core/images/smilies/emojione/1f62b.png]