HI Steve, I know the system you are doing, again you need to think thru the delays & entry price properly. If you are only wanting to get in at open just the last line needs a tidy up.
Buy = ref(Buysig,-1) and Open < ref(Close - 1*ATR(5),-1); BuyPrice = open; Cheers, Dave PS - email me on [EMAIL PROTECTED] if you want more help on that specific system. ----- Original Message ----- From: Steve Carlsson To: Amibroker (E-mail) Sent: Thursday, March 20, 2008 7:36 PM Subject: [amibroker] Buy Signal Hi all The code below is trying to buy if the open tomorrow is lower than todays close minus 1 atr(5).... Does the code do what I think it is doing...thanks in advance... Trigger=Close < Ref(Close,-1) AND Ref(Close,-1) < Ref(Close,-2) AND Ref(Close,-2) < Ref(Close,-3); Cond1 = trigger; Cond2=ATR(30)/C >.025; // atr>2.5% cond3=MA(C,21)*MA(V,21)>500000; //turnover > 500000 Cond4=MA(C,200)>Ref(MA(C,200),-50) > - 2*ATR(200) ; //mov avg ang greater than -2 atr200 Buysig = Cond1 AND Cond2 AND Cond3 AND Cond4; Buy= (Ref(Buysig,-1)==1) AND (L<Ref(C,-1)-1*ATR(5)); BuyPrice = Ref(L,-1)-1*ATR(5); Regards Steve C