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

[amibroker] Re: BackTest Question



PureBytes Links

Trading Reference Links

Hi Geoff,

You'll need to use the Advanced Portfolio Backtester for that.
And you'll need to recalculate within it the value of the trailing
stop for each stock you have in the portfolio, because otherwise the
Backtester won't know that.

This is the way to go, but it's very high-level AFL programming, way
over my head. 

Regards,

Quentin


--- In amibroker@xxxxxxxxxxxxxxx, "Geoff Mulhall" <geoffmulhall@xxxx>
wrote:
>
> Hi,
> 
> Thanks for replying - but I don't seem to have explained this 
> properly I expect. 
> 
> As soon as a position has its trailing stop above the buy price there 
> is no more risk with that position - so another position can be 
> opened with the risk still being kept to 5% of capital.
> 
> Limiting open positions to a fixed number is the problem that I want 
> to get around. 
> 
> I could have 1000 open positions and as long as the trailing stop for 
> each is above their buy price there is no risk. I can open another 10 
> positions with risk 0.5% of total equity and keep by risk to 5% of 
> capital.
> 
> Note I now have a lot more capital as I have 100 open positions in 
> profit and I now want to risk .5% per trade of that equity on the new 
> 10 positions.
> 
> Geoff 
> 
> 
> 
> --- In amibroker@xxxxxxxxxxxxxxx, "Paul Ho" <paultsho@xxxx> wrote:
> >
> > 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
> > <http://groups.yahoo.com/gads?
> t=ms&k=Investment+management+software&w1=Inves
> > 
> tment+management+software&w2=Real+estate+investment+software&w3=Invest
> ment+p
> > 
> roperty+software&w4=Software+support&w5=Real+estate+investment+analysi
> s+soft
> > ware&w6=Investment+software&c=6&s=200&.sig=_XXUzbE9l5lGlZNcMu4KNQ>
> > management software 	Real
> > <http://groups.yahoo.com/gads?
> t=ms&k=Real+estate+investment+software&w1=Inve
> > 
> stment+management+software&w2=Real+estate+investment+software&w3=Inves
> tment+
> > 
> property+software&w4=Software+support&w5=Real+estate+investment+analys
> is+sof
> > tware&w6=Investment+software&c=6&s=200&.sig=5_sgDczz3ArKGMtJ9tFSJA> 
> estate
> > investment software 	Investment
> > <http://groups.yahoo.com/gads?
> t=ms&k=Investment+property+software&w1=Investm
> > 
> ent+management+software&w2=Real+estate+investment+software&w3=Investme
> nt+pro
> > 
> perty+software&w4=Software+support&w5=Real+estate+investment+analysis+
> softwa
> > re&w6=Investment+software&c=6&s=200&.sig=_N6zcwefgp4eg5n6oX5WZw> 
> property
> > software 	
> > Software
> > <http://groups.yahoo.com/gads?
> t=ms&k=Software+support&w1=Investment+manageme
> > 
> nt+software&w2=Real+estate+investment+software&w3=Investment+property+
> softwa
> > 
> re&w4=Software+support&w5=Real+estate+investment+analysis+software&w6=
> Invest
> > ment+software&c=6&s=200&.sig=MJ2jP31F3n64RDZkDadU8w> support 	Real
> > <http://groups.yahoo.com/gads?
> t=ms&k=Real+estate+investment+analysis+softwar
> > 
> e&w1=Investment+management+software&w2=Real+estate+investment+software
> &w3=In
> > 
> vestment+property+software&w4=Software+support&w5=Real+estate+investme
> nt+ana
> > 
> lysis+software&w6=Investment+software&c=6&s=200&.sig=GmF8PlAJASx0wrSaX
> 5-Zlw>
> > estate investment analysis software 	Investment
> > <http://groups.yahoo.com/gads?
> t=ms&k=Investment+software&w1=Investment+manag
> > 
> ement+software&w2=Real+estate+investment+software&w3=Investment+proper
> ty+sof
> > 
> tware&w4=Software+support&w5=Real+estate+investment+analysis+software&
> w6=Inv
> > estment+software&c=6&s=200&.sig=aMgGsKT4w29dMAYUzQUKzg> software 
> 	
> > 
> >   _____  
> > 
> > YAHOO! GROUPS LINKS 
> > 
> > 
> > 	
> > *	 Visit your group "amibroker
> > <http://groups.yahoo.com/group/amibroker> " on the web.
> >   
> > 
> > *	 To unsubscribe from this group, send an email to:
> >  amibroker-unsubscribe@xxxxxxxxxxxxxxx
> > <mailto:amibroker-unsubscribe@xxxxxxxxxxxxxxx?subject=Unsubscribe> 
> >   
> > 
> > *	 Your use of Yahoo! Groups is subject to the Yahoo! Terms of 
> Service
> > <http://docs.yahoo.com/info/terms/> . 
> > 
> > 
> >   _____
> >
>





------------------------ 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/