Perhaps somebody has a straightforward way to solve the following, or 
point out the error in my interpretation of AFL/CBT:

My system keeps a constant number of 50 positions, based on a ranking 
(although I do not use rotational trading.) At the start the 
positions are equally weighted, i.e. PositionSize is defined as 2%. 
As time moves on, some do very well, and reach, say, a weight of 3% 
of equity. When the exit signal arrives, these positions are replaced 
by new ones, but now back to the 2% of equity as defined in 
PositionSize.

The resulting problem is that at times I find I have too much cash 
left. Now, I know that I can rebalance open positions (by scaling 
in/out, for example via TJ's code 
http://www.amibroker.com/kb/2006/03/06/re-balancing-open-positions/). 
However, apart from the extra costs involved, I have found that there 
is no way to determine/access the amount of cash BEFORE 
entering/rebalancing the new positions. In other words, bo.Cash gives 
you the amount of cash "at the end of the bar". You can, of course, 
use the amount of cash of the previous bar, but you keep lagging the 
actual trades.

In short, I would like to force the backtester to always make the 
system fully invested (except for round lots, etc.) It would be 
great, for example, if there would be an option to automatically 
assign the amount of cash which becomes available from the first 
exited trade to the first new trade, etc. In my system this is very 
applicable, as I always have other trades to replace the exited one.

Any thoughts/suggestions welcome. If none, I'll forward this to 
support.

Thx.

PS

Reply via email to