PureBytes Links
Trading Reference Links
|
<SPAN
class=547093201-18062004>Hi Mark, been a while (:-)... Hope you're
well.
<SPAN
class=547093201-18062004>
<SPAN
class=547093201-18062004>I thought that an always-buy rule would work too,
except that this sell rule is like a trailing stop; it needs to know when you
actually bought, which I think we can't know while our code runs, since it
depends on the value of a stock's PositionScore vs the other stocks under
test.
<SPAN
class=547093201-18062004>
<SPAN
class=547093201-18062004>Roughly speaking, this rule sells when price falls a
spec'd amount below its highest value *since buy*. (It also has some
"acceleration" built in, some ApplyStop won't do it.) Can you think of a way to
code that that would work in this context?
<SPAN
class=547093201-18062004>
<SPAN
class=547093201-18062004>Is anyone out there
using the Osaka plugin? I haven't tried it yet, so I could be on the wrong
track, but for some reason I'm under the impression that its 2D array sorting
capabilities can help. Anyone?
<SPAN
class=547093201-18062004><SPAN
class=547093201-18062004>
<SPAN
class=547093201-18062004><SPAN
class=547093201-18062004>Thanks,
<SPAN
class=547093201-18062004>
<SPAN
class=547093201-18062004>Dave
<BLOCKQUOTE
>After
reviewing the portfolio-level backtesting tutorial, I would havethought
you could use a buy condition that's true for all stocks andthen narrow
the field to the 20 stocks with the highest stochd withMaxOpenPositions
and PositionScore as in the following code. Andthat the system
tester would automatically link buys and sells,where are the sells are
based on your "custom AFL rule" (which Iarbitrarily 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 stocksSell=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. Sofirst bar,> I'd buy
the 20 stocks with the highest StochD, and hold each of themuntil>
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 asthere's room> for in the position sizing.> >
Make sense? When you buy, you're looking for the stocks rankedhighest
THAT> DAY, which will change every bar.> > I don't see
how to do that in native AFL. I thought I'd seen anexample of>
something similar using the Osaka plugin (for its sortingcapability), but
I> don't know where.
Check AmiBroker web page at:
http://www.amibroker.com/
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html
Yahoo! Groups Sponsor
ADVERTISEMENT
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 the Yahoo! Terms of Service.
|