Used iMAOnArray

 

Hi,

i need expert’s help for an EA


Thank you.

Jé.

 

I want to use two simple indicators: IRSI and iMAOnArray to detect the failure by the RSI MA.

These indicators work very well as an indicator, but not in an EA. I think it's because of the loop (For..). The values are stored in a table (RsiBuf [] MaP [] MaF []) but the comparison with "If" not done correctly.
Who can help me? I tried everything. I despair ...

Attached file in detail because i can't write a lot of text.

Thanks.

 

First Loop : for(shift=limit-1; shift>=0; shift--) { RsiBuf[shift] = iRSI(NULL,0,Rsi,PRICE_CLOSE,shift);}

Second Loop : for(shift=limit-1; shift>=0; shift--) { MaF[shift] = iMAOnArray(RsiBuf,0,Ma,0,MODE_SMA,shift);MaP[shift] = iMAOnArray(RsiBuf,0,Ma,0,MODE_EMA,shift);}

Comparison : if(RsiBuf[shift] > (MaF[shift]+ MaP[shift]/2))

Action : "Then Buy else Sell"

 
Caladois974:

These indicators work very well as an indicator, but not in an EA.

Why not just write it as an indicator and then use iCustom to get the values

The problem with EAs is that arrays are not automatically re-sized as new bars open

Your code probably over-writes some of the array elements 

 

iCustom ? i have never use it. ok, I will explore this way and i'll say to you the result.

Thanks.

Reason: