Might want to use Flip on Condition1 and 3 prior to ANDing. Say have cross today, but MA20 is still going down. Then, the next day MA is trending up, but condition1 has already crossed. Sorry, no buy signal. So, am thinking Flip.
--- In [email protected], "Joris Schuller" <jschul...@...> wrote: > > MA5=MA(C,5); > MA20=MA(C,20); > Condition1=Cross(MA5,MA20); > Condition2=MA20>Ref(MA20,-1); > Condition3=Cross(MA20,MA5); > Condition4=MA20<Ref(MA20,-1); > Buy= Condition1 AND Condition2; > Sell= Condition3 AND Condition4; > shape = Buy * shapeUpArrow + Sell * shapeDownArrow;//No same day buy sell > possible > Plot( Close, "Price", colorBlack, styleCandle ); > Plot(MA5,"MA5",colorGreen,5); > Plot(MA20,"MA20",colorRed,5); > PlotShapes( shape, IIf( Buy, colorGreen, colorRed ), 0, IIf( Buy, Low, High > ) );; > > > > From: [email protected] [mailto:[email protected]] On Behalf > Of rijnaars > Sent: Saturday, March 13, 2010 7:13 AM > To: [email protected] > Subject: [amibroker] combining two conditions for buy or sell signals > > > > > > if i want a buy signal for instance when the MA 5 is crossing MA 20 zone > but only want this buy signal when the MA is crossing a rising MA 20 > in upwards direction. > > So not only must MA5 croos upwards but also must the MA 20 be rising > > how do i make this buy condition?? >
