Used iMAOnArray

Back to topics list To post a new topic, please log in or register
avatar
4
Caladois974 2015.01.23 14:39
 

Hi,

i need expert’s help for an EA


Thank you.

Jé.

avatar
4
Caladois974 2015.01.23 14:41 #
 

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.

avatar
4
Caladois974 2015.01.23 14:47 #
 

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"

avatar
Moderator
3407
GumRai 2015.01.24 00:16 #
 
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 

avatar
4
Caladois974 2015.01.26 10:16 #
 

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

Thanks.

Back to topics list  

To add comments, please log in or register