ArrayResize(RSI,Volatility_Band); int limit = Bars-counted_bars-1; for(int i=limit; i>=0; i--) { for(int x=i; x<i+Volatility_Band; x++) { RSI[x-i] = RSIBuf[x]; MA += RSIBuf[x]/Volatility_Band; }
x is certainly going to be larger than the array size.
You can't just "move" Indicator code into an EA as they work completely differently; hence why there is no "OnCalculate()" event in EAs.
The EA and Indicator structures are not directly compatible. You can transfer the equivalent of the Indicator logic and calculations into an EA, but it is done in a completely different way.
Don't do that. Just get the value of the indicator.
Detailed explanation of iCustom - MQL4 forum

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Here is the indicator code I'm trying to move inside an EA:
All 6 of the indicator buffers:
are throwing an array out of range error inside the EA during testing. What do I have to change to get this running? I've been doing a lot of searching for similar topics but can't seem to figure this out. All the code is in the correct place.