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

Re: Fixed Ratio Function



PureBytes Links

Trading Reference Links

Scott,

This is what you want.  It solves directly for N, or in this code example 
it I call it NumCars.
The input MMS is just a switch so you can test the system with the money 
management on MMS = 1 or off MMS=0.


************* Beginning of Money Management Code ***************

Inputs: MMS(1), Delta(5000);
var: numcars(0);

{  Entry without Money Managment }
If MMS = 0 then begin
Your Entry Code
end;

{  Entry with Ryan Jones Money Management }
If MMS = 1 then begin
If Netprofit>0 then
NumCars=IntPortion(SquareRoot(2*NetProfit/Delta+0.25)+0.5)  {This line is 
the one you want}
else
NumCars=1;
if your entry condition is true then Buy NumCars Contracts at Market;
end;

************  End Money Management Code ***************


At 09:57 PM 12/23/01 -0700, you wrote:
>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