PureBytes Links
Trading Reference Links
|
Geoff,
Yes you can set this in code. You should have a look at the SetOption
command for all the things you can set. Try at least the following for
your problem. You will want to set MaxOpenPositions to 10 and position
size to -5. No wait, that won't work since it will invest up to 5% of
equity per symbol and up to 10 symbols. You will either have to get
tricky with code OR you can set your InitialEquity to $5000 (5% of
100,000), equity to -100, MaxOpenPositions to 10 (to get the effect of
0.5% of your original equity of 100,000 since 5000/10 = 500 per trade or
0.5% of 100,000).
The only problem I see is you won't get correct stats for MaxSystemDD
this way, but it could be estimated fairly easy since I think it will be
about 1/20 whatever it shows.
Maybe someone else has a more elegant solution (possibly a custom
backtest routine).
SetOption("MaxOpenPositions", Param("Max Open Positions",1,1,10,1));
PositionSize = Param("Position Size - see notes in
SetOptions.afl",-100,-100,1000000,1);
/* How to use PositionSize...
Positive Values invest that amount of money in each trade.
Negative values invest a percentage of your portfolio value
in each trade. So, to invest $25,000 in each trade enter 25000,
profits will accumulate (hopefully). To invest half of all your
Equity in each trade enter -50, profits compound.
The "normal" mode is to invest all your money in each trade AND
let it compound. Enter -100 to do this.*/
SetOption("InitialEquity", Param("Initial
Equity",10000,10000,1000000,5000));
--
Terry
-----Original Message-----
From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On
Behalf Of Geoff Mulhall
Sent: Tuesday, January 03, 2006 17:21
To: amibroker@xxxxxxxxxxxxxxx
Subject: [amibroker] BackTest Question
Hi,
Wonder if this is possible and if there is an example of the AFL code.
Is it possible to set the number of open positions in backtest
according to a total percentage risk amount as follows.
I have starting trading capital of $100,000. I only ever want to have
a total dollars at risk of say 5% of that capital - however as my
equity increases I also want to have a total at risk 5% of that
increasing equity on each new trade.
I only want to risk say 0.5% of capital per trade where the number of
shares to buy is Risk Amount / (entry price - stop price) - BUT the
number of trades is set such that the total at risk is 5% of total
equity.
As each share increases in price the trailing stop rises, the at risk
amount decreases for that trade and more positions can be entered.
Also more positions can be entered if the trailing stop is hit on a
particular trade and that trade is closed out.
Thanks,
Geoff
Please note that this group is for discussion between users only.
To get support from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com
For other support material please check also:
http://www.amibroker.com/support.html
Yahoo! Groups Links
------------------------ Yahoo! Groups Sponsor --------------------~-->
Try Online Currency Trading with GFT. Free 50K Demo. Trade
24 Hours. Commission-Free.
http://us.click.yahoo.com/RvFikB/9M2KAA/U1CZAA/GHeqlB/TM
--------------------------------------------------------------------~->
Please note that this group is for discussion between users only.
To get support from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com
For other support material please check also:
http://www.amibroker.com/support.html
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/amibroker/
<*> To unsubscribe from this group, send an email to:
amibroker-unsubscribe@xxxxxxxxxxxxxxx
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
|