Download MetaTrader 5
To add comments, please log in or register
Start making profit using the Market. Publish your product!
Caladois974
41
Caladois974 2015.01.23 13:39 

Hi,

i need expert’s help for an EA


Thank you.

Jé.

Caladois974
41
Caladois974 2015.01.23 13: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.

Caladois974
41
Caladois974 2015.01.23 13: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"

Keith Watford
Moderator
7976
Keith Watford 2015.01.23 23: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 

Caladois974
41
Caladois974 2015.01.26 09:16  

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

Thanks.

/
To add comments, please log in or register