PureBytes Links
Trading Reference Links
|
Thanks, Al, for your comments. Of course you're right, realistically
that should read yesterday's high or today's OPEN. Funnily enough, I
lifted that particular bit of code directly from the AFL
documentation. I don't think I misunderstood the context - maybe the
example given is just an error.
Anyway, that hasn't affected the strange phenomenon I referred to,
when for some reason the BackTester elects to enter at TODAY's high,
instead of yesterday's. In my code today's high isn't included in the
calculation for BuyPrice at all as far as I can see. I can't fathom
why it's happening. Any ideas?
Paolo
--- In amibroker@xxxxxxxxxxxxxxx, "Al Venosa" <advenosa@xxxx> wrote:
> Paolo:
>
> Because you've told it to. Take a look at your price arrays. You are
> assigning the buyprice, for example, as the max of either
YESTERDAY's high
> or TODAY's low. So, depending on which is higher, that's what
you'll get. If
> the price gaps up on entry day such that the low is higher than
yesterday's
> high, then you'll enter on today's low. That may be OK for
backtesting, but
> of course, in real trading, you won't know that until the end of
the day
> after you download your data. You might consider BuyPrice =
> Max(ref(H,-1),O); to better simulate real trading.
>
> Ciao!
>
> Al Venosa
>
> ----- Original Message -----
> From: "Paolo" <pmonnetti@xxxx>
> To: <amibroker@xxxxxxxxxxxxxxx>
> Sent: Friday, April 30, 2004 6:03 AM
> Subject: [amibroker] BuyPrice/ShortPrice Problem
>
>
> > The following code is designed to trade on DI+/DI- crossovers,
> > entering on a stop set at the previous day's high or low. As far
as
> > the buy/short signals are concerned it seems to perform perfectly,
> > but can anyone tell me why about 50% of the time, and apparently
> > randomly, it enters at the CURRENT day's high or low, instead of
on a
> > stop at the previous day's?
> >
> > Paolo
> >
> >
> > BuyStop=Ref(H,-1); SellStop=Ref(L,-1);
> > BuyPrice=Max(BuyStop,L);
> > CoverPrice=Max(BuyStop,L);
> > ShortPrice=Min(SellStop,H);
> > SellPrice=Min(SellStop,H);
> > PositionSize=4000;
> >
> > Buy=Cross(Ref(PDI(14),-1),Ref(MDI(14),-1));
> > Short=Cross(Ref(MDI(14),-1),Ref(PDI(14),-1));
> > Sell=Short;
> > Cover=Buy;
> >
> >
> >
> >
> > Send BUG REPORTS to bugs@xxxx
> > Send SUGGESTIONS to suggest@xxxx
> > -----------------------------------------
> > Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx
> > (Web page: http://groups.yahoo.com/group/amiquote/messages/)
> > --------------------------------------------
> > Check group FAQ at:
> http://groups.yahoo.com/group/amibroker/files/groupfaq.html
> > Yahoo! Groups Links
> >
> >
> >
> >
> >
------------------------ Yahoo! Groups Sponsor ---------------------~-->
Buy Ink Cartridges or Refill Kits for your HP, Epson, Canon or Lexmark
Printer at MyInks.com. Free s/h on orders $50 or more to the US & Canada.
http://www.c1tracking.com/l.asp?cid=5511
http://us.click.yahoo.com/mOAaAA/3exGAA/qnsNAA/GHeqlB/TM
---------------------------------------------------------------------~->
Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
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/
|