[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[amibroker] Re: buyprice?



PureBytes Links

Trading Reference Links

Thanks a lot Graham.  I didn't know about the INSIDE function!  
Cool...

Anyway I tried it again and the problem is this:  If the stock goes 
up the day following the buy criteria being set, the purchase occurs 
according to the BUYPRICE criteria listed below.  If, however, the 
stock goes down the day following the buy criteria being met, the 
stock is still purchased at that day's high value even though it 
never satisfied the BUYPRICE criteria.

Try cutting and pasting the formula in and you'll see what I mean.

By the way I've got my settings with "activate stops immediately" 
ticked.  Also, "Buy Delay" is set at 1.  

Oh yeah, the RSI > 200 thing is just a dummy variable until I get 
the buy thing sorted out.

Chris



--- In amibroker@xxxxxxxxxxxxxxx, "Graham" <gkavanagh@xxxx> wrote:
> Chris, 
> Here are some suggestions.
> Just to tidy up what you have written to make it simpler to 
follow, at least
> for me. The one to nine are conditional statements and will always 
give you
> a 0 or 1 answer anyway. Same with the ==1 in the Buy statements, 
default is
> 1 so no need to type more than need to (unless you want something 
to be
> false in shich case use ==0)
> Also it looks like your search is for 2 consecutieve inside days. 
You could
> replace one to six with
> One = inside();
> Two = ref(inside(),-1);
> 
> one = High < Ref (High, -1);
> two = Ref (High, -1) < Ref (High, -2);
> three = Ref (High, -2) < Ref (High, -3);
> four = Low > Ref (Low, -1);
> five = Ref (Low, -1) > Ref (Low, -2);
> six = Ref (Low, -2) > Ref (Low, -3);
> seven = EMA (Close, 13) > Ref (EMA(Close, 13), -5);
> eight = EMA (Close, 100) > Ref (EMA(Close, 100), -5);
> nine = EMA (Volume, 100) > 25000;
> 
> Buy = One  AND two AND three AND four AND five AND six AND seven 
AND eight
> AND nine ;
> BuyPrice = ValueWhen( Buy,  Ref (H, -1)+.01 ) ; //I think there 
were to many
> brakets in here
> 
> Sell = RSI (9) > 200;                    //can RSI be >100
> ?????????????????????????????????
> Buy = ExRem (Buy, Sell);
> 
> Cheers,
> Graham
> http://groups.msn.com/ASXShareTrading
> http://groups.msn.com/FMSAustralia
> 
> 
> -----Original Message-----
> From: indiana0352 [mailto:cs_winn@x...] 
> Sent: Sunday, 28 September 2003 10:59 AM
> To: amibroker@xxxxxxxxxxxxxxx
> Subject: [amibroker] Re: buyprice?
> 
> 
> Thanks for the input guys, but I still seem to be having 
problems.  
> Here's my code, maybe you can provide some more input.
> 
> I realize the code is messy but keep in mind I am new at this!  If 
> you've got suggestions for improvement let 'em fly!
> 
> By the way, the backtest is based on looking for symmetrical 
> triangles in uptrends and buying if the price continues up and 
> exceeds the high of the second to last day of the triangle.
> 
> ********************
> 
> 
> one = IIf (High < Ref (High, -1), 1, 0);
> 
> two = IIf (Ref (High, -1) < Ref (High, -2), 1, 0);
> 
> three = IIf (Ref (High, -2) < Ref (High, -3), 1, 0);
> 
> four = IIf(Low > Ref (Low, -1), 1 , 0);
> 
> five = IIf (Ref (Low, -1) > Ref (Low, -2), 1, 0);
> 
> six = IIf (Ref (Low, -2) > Ref (Low, -3), 1, 0);
> 
> seven = IIf (EMA (Close, 13) > Ref (EMA(Close, 13), -5), 1, 0);
> 
> eight = IIf (EMA (Close, 100) > Ref (EMA(Close, 100), -5), 1, 0);
> 
> nine = IIf (EMA (Volume, 100) > 25000, 1, 0);
> 
> Buy = One == 1 AND two == 1 AND three == 1 AND four == 1 AND five 
== 
> 1 AND six == 1 AND seven == 1 AND eight == 1 AND nine == 1;
> 
> BuyPrice = ValueWhen(Buy, (Ref (H, -1)+.01)) ;
> 
> Sell = RSI (9) > 200;
> 
> Buy = ExRem (Buy, Sell);
> 
> ************************
> 
> Thanks,
> Chris
> 
> --- In amibroker@xxxxxxxxxxxxxxx, "Graham" <gkavanagh@xxxx> wrote:
> > Just to expand on this answer, you may also need to use exrem
> (buy,sell) in
> > case you get further buy signals before a sell occurs. The buy
> price could
> > change with each added buy signal.
> > 
> > 
> > Buy = YourCondition
> > Sell = Yourcondition
> > buy = ExRem( buy, sell );
> > Buyprice = valuewhen(buy,ref(h,-1));
> > 
> > Cheers,
> > Graham
> > http://groups.msn.com/ASXShareTrading
> > http://groups.msn.com/FMSAustralia
> > 
> > 
> > -----Original Message-----
> > From: Anthony Faragasso [mailto:ajf1111@x...]
> > Sent: Sunday, 28 September 2003 9:44 AM
> > To: amibroker@xxxxxxxxxxxxxxx
> > Subject: Re: [amibroker] buyprice?
> > 
> > 
> > something like
> > 
> > valuewhen(buy,ref(h,-1));
> > 
> > 
> > ----- Original Message -----
> > From: "indiana0352" <cs_winn@xxxx>
> > To: <amibroker@xxxxxxxxxxxxxxx>
> > Sent: Saturday, September 27, 2003 9:40 PM
> > Subject: [amibroker] buyprice?
> > 
> > 
> > > Ok another question:
> > >
> > > I'm doing my first backtest.  I have my buy criteria set and 
now
> I 
> > > want to enter my buy price.  Rather than just use the open,
> close, 
> > > average etc values, I want to define that my position only get
> entered 
> > > into if the stock rises above the high value of the day PRIOR 
to
> when 
> > > the buy signal was triggered.
> > >
> > > How do I do this?
> > >
> > > Thanks,
> > > Chris
> > >
> > >
> > >
> > > 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
> > >
> > > Your use of Yahoo! Groups is subject to
> > > http://docs.yahoo.com/info/terms/
> > >
> > >
> > 
> > 
> > ---
> > Outgoing mail is certified Virus Free.
> > Checked by AVG anti-virus system (http://www.grisoft.com).
> > Version: 6.0.521 / Virus Database: 319 - Release Date: 9/24/2003
> > 
> > 
> > ------------------------ 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@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 
> > 
> > Your use of Yahoo! Groups is subject to
> http://docs.yahoo.com/info/terms/
> 
> 
> 
> 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 
> 
> Your use of Yahoo! Groups is subject to 
http://docs.yahoo.com/info/terms/


------------------------ 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 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/