PureBytes Links
Trading Reference Links
|
--- In amibroker@xxxxxxxxxxxxxxx, "Dave Merrill" <dmerrill@xxxx>
wrote:
> Interweaved.
>
> Dave
> Hi Dave,
>
> Now your getting tricky! Understand now...
>
> It's simple to say, harder to code: Buy the top 20 stocks by
turnover (for
> instance). Hold each one until price falls x% below its highest
value since
> buy. When capital is available, buy as many of the highest rated
stocks as
> you can afford.
>
> The exit I'm interested in isn't actually quite that simple, or
ApplyStop
> could do it. But it's similar, in that it needs to know entry date
and
> price.
>
>
> BTW Did you try out Dimitris IB code?
>
> I didn't, because I can see that it uses a static watchlist for
the entire
> duration of the test. What we need is a new ranking order on every
bar. I
> didn't immediately see how the principle he used could get there.
>
Dave,
The code gives the top5 list *per bar*. Just check in your IB with
// The top5 list
list = CategoryGetSymbols( categoryWatchlist, 61 );
g=-100;t="";topList="";i1=0;
nt=5;// calibrate here the topX
for(n=1;n<=nt;n++)
{
for( i = 0; ( sym = StrExtract( list, i ) ) != "" ; i++ )
{
SetForeign(sym);
x=StochD();//the individual metric
t=WriteIf(x>g,sym,t);i1=IIf(x>g,i,i1);
g=Max(g,x);
}
topList=topList+t+",";L0="";
for( i = 0; ( sym = StrExtract( list, i ) ) != "" ; i++ )
{
SetForeign(sym);
L0=L0+ WriteIf(i!=i1,sym+",","");
}
List=L0;g=-100;
}
Title="The top"+WriteVal(nt,1.0)+"list for "+Date()+" is "+topList;
moving your cursor from bar to bar.
I dont know if it is useful to you, but the code works.
If you want me to explain the principle line per line, just let me
know.
Dimitris Tsokakis
> Cheers Glenn
>
> --- In amibroker@xxxxxxxxxxxxxxx, "Dave Merrill" <dmerrill@xxxx>
wrote:
> > Thanks for the reminder on this Glenn. Unfortunately, while
that msg
> is a
> > useful technique, it still won't get where I'm try to go, at
least
> in that
> > form.
> >
> > That code works by creating a composite representing the Nth
highest
> value
> > of your indicator on each day. If you're using that by itself,
just
> checking
> > whether a given stock's indicator value is that or above tells
you
> if it's
> > in the top N.
> >
> > But say you bought the 20 stocks with the highest turnover
today,
> and held
> > each one until a custom AFL stop was hit. Some time after that
buy,
> when 3
> > stocks hit their sell triggers, you need to replace them. You
don't
> need the
> > top 20 stocks this time, you need the top 3, since that's all
the
> position
> > slots you have available.
> >
> > My guess is that this just isn't possible using AB in its
current
> form. Most
> > things are though (:-).
> >
> > Dave
> > BTW Dave, I have been looking for a simpler way to finding
the top N
> > stocks using AFL. I am currently using the Osaka plug-in, the
code I'm
> > using with it is in message 50457.
> >
> > Cheers Glenn
------------------------ 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/
|