Вы говорили, что это советник, но используете код индикатора.
В индикаторе вы можете объявить буферы как буферы:
IndicatorBuffers(2); //Allocate memory for buffers
double RSIBuf[]; //indicator buffers
double MaBuf[];
// Bind the array and allocated memory to an actual double-array dynamic buffer
SetIndexBuffer(0, RSIBuf);
SetIndexBuffer(1, MaBuf);
int counted_bars=IndicatorCounted();
int limit = Bars-counted_bars-1;
for(int i=limit; i>=0; i--)
{
RSIBuf[i] = iRSI(NULL,higherTF,RSIPeriod,0,i);
MaBuf[i] = iMAOnArray(RSIBuf,higherTF,RSI_SMA,0,0,i);
}
MA = MaBuf[0];
Если этоВ советнике вы должны были бы выделить достаточно памяти заранее, например:
int maxBars = TerminalInfoInteger(TERMINAL_MAXBARS);
double RSIBuf[maxBars];
double MaBuf[maxBar];
И тогда вы продолжите как обычно.