Getting an false value of EMA when using iMaOnArray function.

 

I am trying to build an Ea on EMA of RSI and trying to build that iMaOnArray but getting a false value and can seem`` to know why, please have a look at it and help me if anyone can

I am getting the correct value of LWMA but not for EMA, can not understand why.


double _rsi = 0;
for(int i = period_rsi_ema2; i > 0; i--){
_rsi = iRSI(Symbol(), PERIOD_CURRENT, rsi_period, PRICE_CLOSE,i);
rsi_array[i-1] = _rsi;
}
bool x = ArraySetAsSeries(rsi_array, true);
double rsi_ema1_slow = iMAOnArray(rsi_array,0, period_rsi_ema1, 0, MODE_EMA,0);
double rsi_ema2_fast = iMAOnArray(rsi_array,0,period_rsi_ema2,0,MODE_LWMA,0);
 
Set as-series before populating.
 
William Roeder #:
Set as-series before populating.

Done that but is not working.

 
bakaparty #: Done that but is not working.
You didn't according to your posted code.
Reason: