Answers - Other


Strategy to hedge interest rate risk
buy corporate bonds
sell equivalent amount of treasury bonds


Public Function BuySellHoldStrategy(ByVal rgePrices As Range, _ 
                                    ByVal rgeClosingPrice As Range, _
                                    ByVal iInterval As Integer) As String
   Dim lrowno As Long
   Dim inumber As Integer
   Dim dbtotal As Double
   
   Application.Volatile (True)
   ReDim arresult(rgePrices.Rows.Count - 1)
   For lrowno = 1 To (iInterval - 1)
      arresult(lrowno - 1) = 0
   Next lrowno
   For lrowno = 1 To (rgePrices.Rows.Count - iInterval + 1)
      dbtotal = 0
      For inumber = 1 To iInterval
         dbtotal = dbtotal + rgePrices(lrowno, 1).Offset(inumber - 1, 0).Value
      Next inumber

      If (dbtotal / iInterval) > rgeClosingPrice.Value Then
         BuySellHoldStrategy = "Buy 50"
         Exit Function
      End If
   Next lrowno
   
   If Application.WorksheetFunction.StDev(rgePrices) + 2 > rgeClosingPrice.Value Then
      BuySellHoldStrategy = "Sell 40"
      Exit Function
   End If
   
   BuySellHoldStrategy = "Hold"
End Function


© 2021 Better Solutions Limited. All Rights Reserved. © 2021 Better Solutions Limited TopPrevNext