PureBytes Links
Trading Reference Links
|
I haven't had a chance to try out your code, but I can explain why I think
the date and price of the actual buys aren't known at the time our code
runs, based on my understanding of the general process I think AB goes
through during backtests:
First, AB makes a pass through all stocks under test, using our code to
calculate Buy/Sell/Short/Cover signals and PositionScore for each stock,
however we said that should be done.
Note that if the trade signals ask for more stocks to be held on any given
day than there's room for in our equity and PostionSize, some of those
Buy/Short signals won't actually be taken. Which ones actually are taken
can't be known until *all* stocks have been examined, and their trade
signals and PositionScore calculated. In the case we've proposed, where Buy
= Short = 1, and PositionScore alone rules, we know exactly nothing about
what gets bought or when at this stage.
AB then makes another pass through all stocks under test to actually execute
the trades, using the signals and PositionScore calculated during the first
pass. Only then is it known which stocks are bought and when, as determined
by the interactions between the signals and scores for all tested stocks,
and the change in available trading equity.
But our code isn't running now. It ran during the first pass, when trade
signals and PositionScore were calculated, and we don't get another crack at
it. Far as I can see, this means that a custom AFL exit that needs to know
when a stock was bought and for how much can't meaningfully be used under
these circumstances.
Any clearer?
Dave
> I hear what you're saying, but from the documentation:
>
> "You can use new PositionScore variable to decide which trades should
> be entered if there are more entry signals on different securities
> than maximum allowable number of open positions or available funds. In
> such case AmiBroker will use the absolute value of PositionScore
> variable to decide which trades are preferred."
>
> Nothing says it won't work if you have a buy signal on all stocks. If
> you have X maximum allowable open positions and a watchlist of Y
> stocks, PositionScore should work with X+1 entry signals, also with
> X+2, X+3, ... Y. If not, at what point would it fail and why? And if
> there is a buy signal on all stocks, it would seem that the trades
> taken would be the top X ranked by the absolute value of the
> PositionScore variable.
>
> Not sure why you think it would be unknown when you bought. If the
> system tester did not somehow track this, how could it work with the
> PositionScore variable at all? And if it works with X+1 stocks,
> why not with Y stocks?
>
> With that said, the code I posted still doesn't work, LOL. I'm
> surprised about that plus the fact that so far nobody has explained
> what's happening. I must be missing some nuance. Anyone care to
> enlighten me?
>
> --- In amibroker@xxxxxxxxxxxxxxx, "Dave Merrill" <dmerrill@xxxx>
> wrote:
> > Hi Mark, been a while (:-)... Hope you're well.
> >
> > 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.
> >
> > 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?
------------------------ 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/
|