PureBytes Links
Trading Reference Links
|
Paolo:
You have designed a reversal system, meaning that if you are long and you
get a short signal, you will exit your long and go short. If you have
Reverse Entry Forces Exit checked in Settings, then when you get a short
signal triggered, you will exit your long and to short at today's high,
according to your ShortPrice code. The best way to diagnose what's happening
is to write an exploration such as:
Filter = 1;
Addcolumn(Buy,"Buy",1);
Addcolumn(Short,"Short,1);
Addcolumn(Sell,"Sell",1);
Addcolumn(Cover,"Cover",1);
AddColumn(O,"O",1.2);
AddColumn(H,"H",1.2);
AddColumn(L,"L",1.2);
AddColumn(C,"C",1.2);
Addcolumn(BuyPrice,"BP",1.2);
Addcolumn(ShortPrice,"ShP",1.2);
Addcolumn(SellPrice,"SP",1.2);
Addcolumn(CoverPrice,"CP",1.2);
When you view the output, you ought to be able to figure out why you are
exiting on today's high sometimes. Good luck.
Al Venosa
----- Original Message -----
From: "Paolo" <pmonnetti@xxxxxxxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Friday, April 30, 2004 9:42 PM
Subject: [amibroker] Re: BuyPrice/ShortPrice Problem
> 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
> > >
> > >
> > >
> > >
> > >
>
>
>
>
> 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
>
>
>
>
>
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.665 / Virus Database: 428 - Release Date: 4/21/2004
------------------------ 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/
|