Please be specific about the rules you are wanting.
By bear bar you mean the Open[0] is less than the Close[0]?
Do you mean the Close[0] of the current bar is less than the Close[1] of the previous bar?
"to be more then 5 bars ago at least."
The MRO doesn't have an offset. If you want to start checking from 5 bars ago, you should use a loop.
int barsAgo; for (int index = 5; index < CurrentBar; index++) if (Close[index] < Open[index] && High[index] > EMA(21)[index] && Close[index] < EMA(21)[index]) barsAgo = index; Print("the condition was found " + barsAgo + " barsAgo);
Further, using MRO() will not accomplish your goal above "current price was less than the EMA 10 bars ago and is greater than the EMA on the current bar".
That said, it would likely appear as:
int barsAgo = MRO(() => Close[0] < Open[0] && High[0] > EMA(21)[0] && Close[0] < EMA(21)[0], 1, CurrentBar); Print("The condition was found " + barsAgo + " barsAgo");
Comment