[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Fixed Ratio Function



PureBytes Links

Trading Reference Links

Been experimenting with my favorite trading topic, money management.
Specifically I've been playing around with Fixed Ratio (See "Trading Game by
Ryan Jones).

Given N (Number of contracts) and Delta, required profits to trade N
contracts is

Equity_Level = ((N*(N-1)) / 2) * Delta

More useful would be a formula that solves for N given current Equity_Level
and Delta. I came up with a quick and dirty brute force VB function that
does the trick which I'm sharing with the list at the risk of ridicule by
you math geniuses and/or VB experts who I am sure could come up with a more
eloquent and beautiful solution.

SH

Function Fixed_Ratio_N(Equity_Level As Double, Delta As Double) As Integer
Dim N_High As Integer
Dim Level_High As Double

  N_High = Int(Sqr((Equity_Level / Delta) * 2)) + 1
  Level_High = ((N_High * (N_High - 1)) / 2) * Delta

  If Level_High <= Equity_Level Then
    Fixed_Ratio_N = N_High
  Else
    Fixed_Ratio_N = N_High - 1
  End If

End Function