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

[amibroker] Re: buyprice?



PureBytes Links

Trading Reference Links

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/


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