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

[amibroker] Re: Does AFL have a function for...



PureBytes Links

Trading Reference Links

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?

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


--- In amibroker@xxxxxxxxxxxxxxx, "Dave Merrill" <dmerrill@xxxx>
wrote:
 
> I'll try again to explain: Whenever there's uncommitted capital,
buy the
> stocks ranked the highest (by StochD for example) ON THAT DAY. So
first bar,
> I'd buy the 20 stocks with the highest StochD, and hold each of them
until
> it exits by a custom AFL rule based on entry price and time.
Whenever
> there's free capital, buy as many of the top StochD stocks as
there's room
> for in the position sizing.
> 
> Make sense? When you buy, you're looking for the stocks ranked
highest THAT
> DAY, which will change every bar.
> 
> I don't see how to do that in native AFL. I thought I'd seen an
example of
> something similar using the Osaka plugin (for its sorting
capability), but I
> don't know where.



------------------------ Yahoo! Groups Sponsor --------------------~--> 
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/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/