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

RE: [amibroker] BackTest Question



PureBytes Links

Trading Reference Links

correction
numshares = 0.05 * capital/(entry - stop)
 

Paul



From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On Behalf Of Paul Ho
Sent: Wednesday, 4 January 2006 10:34 PM
To: amibroker@xxxxxxxxxxxxxxx
Subject: RE: [amibroker] BackTest Question

a bit  of algebra
max 5% means you can have only 10 open positions
use setoption ("maxopenpositions", 10);
risk per trade = (entry - stop) * numshares = 0.05 * capital
ie numshares = (entry - stop)/(0.05 * capital);
setpositionsize (numshares, spsshares);
that should do the trick
 

Paul



From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On Behalf Of Geoff Mulhall
Sent: Wednesday, 4 January 2006 11:21 AM
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





SPONSORED LINKS
Investment management software Real estate investment software Investment property software
Software support Real estate investment analysis software Investment software


YAHOO! GROUPS LINKS