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

Re: Optimal f code for Tradestation



PureBytes Links

Trading Reference Links

> That seems like the fallacy of optimal f to me. It gives entirely
> too much weight to a single losing trade ... 

Agreed...

> and doesn't account for the possibility of stringing several losers
> together in the future. 

Not really true.  If you string losers together, you'll continue to 
scale down your size as your account dwindles.  Of course, if you get 
*enough* losers in a row you'll go bust, but that's true for ANY 
position sizing algorithm.

The real danger is if you ever hit a loss significantly bigger than 
the biggest loss (MaxLoss) in your historical test period.  A loss 
larger than MaxLoss / f will bankrupt you.

Why?  Using opt f, you calculate your bet size as
  PositionSize = AccountSize / (MaxLoss / f)

So any loss you take costs you
  LossAmount = NewLoss * AccountSize / (MaxLoss / f), or
  LossAmount = AccountSize * (NewLoss / MaxLoss) * f

If you hit a loss as big as your MaxLoss, then your account will be 
reduced by a factor of f.  If you have $100k, trade at an f value of 
.60, and take a MaxLoss loss, you'll knock your account down to $40k.

If you take a loss (a SINGLE loss, not a series of losses) that is 
MaxLoss / f or greater, then (NewLoss/MaxLoss)*f is > 1, and your 
account is history.

The "optimal" value of f is chosen as the one with the largest 
return, which means it's the one with the most aggressive leverage 
that *didn't quite* go bust.  Any higher value of leverage caused the 
account to go bust, or at least took it down so low that it couldn't 
recover as well as the optimal value.  So bottom line, the optimal f 
is the level where the largest historical loss "almost but not quite" 
killed the account.  

So if you trade at optf, a loss more than 1/optf larger than your 
MaxLoss kills you.  You can give yourself more breathing room by 
trading at a lower value of f; for example, trading at 1/2 optf means 
you can take a loss up to 2/optf.  But if you take a sufficiently 
large loss -- where "sufficiently large" is MaxLoss / f, whatever f 
you trade at -- you are toast.

> So, everybody ends up trading at some smaller f to be safe but the
> method doesn't give any guidance about how much smaller the f
> should be and you are back to guessing. 

Yes and no.  If you're confident you'll ""never"" see a loss more 
than 2/f bigger than the biggest loss in your historic test period, 
then trading at 1/2 opt f should be safe.  (But see Michael S's 
comment about 12-sigma moves!!!)

Gary