I need to do somthing like this
if ( iAO( Symbol(),PERIOD_M1, 0) <= iAO( Symbol(), PERIOD_M5, 0) )
{
....
}
But iAO( Symbol(), PERIOD_M5, 0) does not work when my chart timeframe is M1 (It return 0 always).
Is it possible to obtain the real returned value of this function in M1?
UPDATE
I found out that the problem is something related with the bars number at the different time frames. something like this:
int BM1 = iBars(NULL,PERIOD_M1);
where
int BM5 = BM1/5;
or
int BM5 = iBars(NULL,PERIOD_BM5);
So, if i do this it does works if i'm in timeframe M1.
int i, n=0, Counted_bars;
Counted_bars=IndicatorCounted();
i=Bars-Counted_bars-1;
while(i>=0)
{
if ( iAO( Symbol(),PERIOD_M1, i) <= iAO( Symbol(), PERIOD_M5, i/5) )
{
...
}
i--;
}
But it only works when i'm programing a indicator. It does not works in a Expert Advisor. ¿Any idea?