PureBytes Links
Trading Reference Links
|
--- In amibroker@xxxxxxxxxxxxxxx, "Tomasz Janeczko" <amibroker@xxxx>
wrote:
>
>
> Best regards,
> Tomasz Janeczko
> amibroker.com
> ----- Original Message -----
> From: "quanttrader714" <quanttrader714@xxxx>
> To: <amibroker@xxxxxxxxxxxxxxx>
> Sent: Thursday, June 17, 2004 9:15 PM
> Subject: [amibroker] Re: Example of buying top N stocks ranked by
some metric - no takers?
>
>
> > After reviewing the portfolio-level backtesting tutorial, I would
have
> > thought you could use a buy condition that's true for all stocks
and
> > then narrow the field to the 20 stocks with the highest stochd
with
> > MaxOpenPositions and PositionScore as in the following code. And
> > that the system tester would automatically link buys and sells,
> > where are the sells are based on your "custom AFL rule" (which I
> > arbitrarily made Sell=C<Ref(C,-3); here). But it doesn't seem to
work.
> > Does anyone know why?
>
> What you mean with "doesn't seem to work"
> Buy condition is indeed linked with sell.
> So it issues buy signal on very first bar for all symbols
> (only top N is bought according to highest PositonScore )
> then sell signals occur on different stocks depending on
> Sell=C<Ref(C,-3);//
> sell condition.
> BUT THEN NEW "BUY" signals will appear only
> AFTER this SELL signal
> and then again next matching sell will be looked for.
>
> It works exactly like this and it is according to specs.
>
> Best regards,
> Tomasz Janeczko
> amibroker.com
Here's what I mean by "doesn't seem to work." I ran the code I posted
(below) on the ND100 stocks for a 1 year period and got 4,673 trades
with 4,662 losers. With that many trades in one year over a list of
100 stocks and with that many losers, the code doesn't seem to be
performing as intended. By intended, I mean to buy the top 20 stocks
with the highest stochd and sell them as Sell=C<Ref(C,-3); is met and
then buy more according to the highest stochd. And by "the code
doesn't seem to be performing as intended" I *do not* mean Amibroker
is broken. Just that I thought from the documentation that the simple
code would do what I described but it doesn't seem to. Could you
please take a quick look at it?
/*****
** REGULAR PORTFOLIO mode
****/
SetOption("InitialEquity", 500000 );
SetTradeDelays(1,1,1,1);
SetOption("MaxOpenPositions", 20 ); // limit to 20;
PositionSize = -5;
Buy=C>0;//use a buy condition that is true for all stocks
Sell=C<Ref(C,-3);// your sell condition
// now use score to rank equities
PositionScore = StochD(14); // prefer stocks that have high stochd;
------------------------ Yahoo! Groups Sponsor --------------------~-->
Yahoo! Domains - Claim yours for only $14.70
http://us.click.yahoo.com/Z1wmxD/DREIAA/yQLSAA/GHeqlB/TM
--------------------------------------------------------------------~->
Check AmiBroker web page at:
http://www.amibroker.com/
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.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/
|