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"
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.
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi,
i need expert’s help for an EA
Thank you.
Jé.