Try something like this... Mike
MA50 = MA(Close, 50); CrossOver = Cross(MA50, Close); CrossUnder = Cross(Close, MA50); LowRSI = RSI() < 30; BarsSinceCrossOver = BarsSince(CrossOver); BarsSinceCrossUnder = BarsSince(CrossUnder); Buy = LowRSI AND BarsSinceCrossUnder < BarsSinceCrossOver AND BarsSinceCrossUnder >= 5; Sell = ... // Your third signal here --- In amibroker@yahoogroups.com, "jminkkin" <jaakko.minkki...@...> wrote: > > Hi all > > Any idea how to code conditional buy in following case: > > If price is over MA 50 and suddenly goes below for at least 5 bar. > THEN we wait for next occurrence for example RSI below 30. This is out > BUY. After that we do not care what ever happens to RSI but we wait > third signal to get wanted exit. > > I am sure this not magic but for beginners it is. >