PureBytes Links
Trading Reference Links
|
Graham,
Thank you very much.
Your solution worked.
I wasn't aware of PriceBoundChecking, but I believe what happened was
the following:
I am selling my stocks on the day of purchase, but appending
tomorrow's opening price as my SellPrice. I'm doing this on purpose
with a reason explained in my original post.
Because of this, when stocks gap up/down beyond the limit of today's
OHLC, PriceBoundChecking comes into play.
Regards,
intermilan04
--- In amibroker@xxxxxxxxxxxxxxx, Graham <kavemanperth@xxx> wrote:
>
> this may not be the case, but it appears that those sells with the
correct
> price are within the price range of the previous bar
> Try turning off the priceboundchecking
> SetOption( "PriceBoundChecking", 0 );
>
>
> --
> Cheers
> Graham
> AB-Write >< Professional AFL Writing Service
> Yes, I write AFL code to your requirements
> http://www.aflwriting.com
>
>
> On 03/12/06, intermilan04 <intermilan04@xxx> wrote:
> >
> > Hi all,
> >
> > I have a trading system which is intended to work in the following
way:
> >
> > 1. I scan for signals on Day 1.
> > 2. I buy signaled stocks at the open on Day 2.
> > 3. I sell stocks at the open on Day 3.
> >
> > In a nutshell, here is a portion of my code that are relevant.
> >
> > // Options
> > SetTradeDelays(1, 1, 1, 1);
> >
> > Buy = SomeCondition;
> > BuyPrice = Open;
> > Sell = Ref(Buy, 0);
> > SellPrice = Ref(Open, 1);
> >
> > I'm deliberately doing Sell = Ref(Buy, 0); so that I can free up my
> > Equity for next day's purchase of new stocks. If I do Ref(Buy, 1),
> > the Backtester tries to buy stocks next morning, can't do so because I
> > have positions from previous day, and sell my stocks, and I end up
> > with a cash position which could have been utilized on new stocks.
> >
> > Well, that became a lengthy explanation but the problem is the
> > SellPrice = Ref(Open, 1); code. While it works most of the times, it
> > does not work 100%. Here is a situation where it failed;
> >
> > Ticker Trade Date Price Ex. date Ex. Price % chg
> > Profit % Profit
> > REGN Long 2006/11/30 21.5 2006/11/30 21.54 0.19%
> > 18 0.10%
> > OVTI Long 2006/11/30 16.6 2006/11/30 16.04 -3.37%
> > -574 -3.46%
> > TLAB Long 2006/11/30 9.99 2006/11/30 10.05 0.60%
> > 88 0.52%
> > BRCM Long 2006/11/30 32.88 2006/11/30 32.66 -0.67%
> > -124 -0.75%
> >
> > I have no problem with REGN, TLAB, BRCM; the Ex. Price is that of the
> > Open price of next day.
> > But for OVTI, the 16.04 exit price is filthily wrong. The stock
> > gapped down big time to 14.22, and my AmiBroker quote for OVTI of 12/1
> > shows 14.22 as well, so it is not the case of me having corrupted
> > quote data. It appears that the 16.04 exit price is the low price of
> > the day, but then, I never set my SellPrice at Low.
> >
> > I will greatly appreciate any insights as to why my problem has
> > occurred. It's driving me crazy because if things like this happen, I
> > might get rosier results than what reality might bring.
> >
> > Regards,
> >
> > intermilan04
> >
> >
> >
> > Please note that this group is for discussion between users only.
> >
> > To get support from AmiBroker please send an e-mail directly to
> > SUPPORT {at} amibroker.com
> >
> > For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
> > http://www.amibroker.com/devlog/
> >
> > For other support material please check also:
> > http://www.amibroker.com/support.html
> >
> > Yahoo! Groups Links
> >
> >
> >
> >
>
Content-Description: "AVG certification"
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.430 / Virus Database: 268.15.6/566 - Release Date: 12/3/2006 4:36 PM
|