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

Re: simple compounding money management code



PureBytes Links

Trading Reference Links

here's something to work with

{*********************************************************************
Fixed Ratio MM with decrease twice as fast.   code written by Rich Estrem,
7/17/01.
this code calculates the next size to trade using the Fixed Ratio Money
Management method,
using a rate of decrease which is twice as fast as the increase rate. To use
this in a system,

paste this code into your system and specify "size" as the number of
contracts to trade in your buy/sell orders.
ex: "if ... then buy size contracts at market"
*********************************************************************}
input:MMdelta(numeric);
vars:size(1),pft(0),maxpft(0),maxsize(1),PLhi(0),PLlo(0),sz(1),half(0),decr(
0);

pft=netprofit;     {only use closed profits since a large MFE could cause
errors}

   {calc size if pft is increasing (normal rateof adjustment):}
if pft > maxpft then
  begin
   maxpft=pft;
   if pft >= MMdelta  then
    size = intportion(0.5+SquareRoot((2*pft/MMdelta)+0.25))
   else size=1;
   if size > maxsize then maxsize=size;
  end

else   {calc size if in a DrawDown (2x the normal rate of adjustment)}
  if maxsize > 1 then
  begin
   if pft < MMdelta then
    begin sz=1; end
   else
    begin
     sz= intportion(0.5+SquareRoot((2*pft/MMdelta)+0.25));
     if sz < maxsize then
     begin
      decr=(maxsize-sz)*2;
      PLhi=(MMdelta*(square(sz+1-0.5) - 0.25))/2 ;
      PLlo=(MMdelta*(square(sz-0.5) - 0.25))/2 ;
      half=(PLhi + PLlo) / 2;
      if pft >= half then decr = decr - 1;
      sz=maxsize-decr;
      if sz < 1 then sz=1;
     end;
    end;
  size=sz;
  end;


----- Original Message ----- 
From: "Bob Fulks" <bfulks@xxxxxxxxxxxx>
To: "James Mills" <jmills10@xxxxxxxxxxxxxxx>; <omega-list@xxxxxxxxxx>
Sent: Friday, August 20, 2004 07:27
Subject: Re: simple compounding money management code


> At 08:03 AM 8/20/2004, James Mills wrote:
>
> >Want to add EZ language code to a system that adds 1 extra contract per
each
> >$x in closed system profits.  Using TS4.
>
> If this is based upon closed system profits, I assume you are closing
positions to change the closed system profits.
>
> If so, why not simply figure the trade size prior to establishing the next
position?
>
>
> Bob Fulks
>
>