How to get the EMA value of price's stored in array using mql5

Good day codders, I want to get the ema value of the price I stored in an array, please what is the best way to do it in mql5? this is my code below

//copy price to an array using copybuffer
   MqlRates barsPrice[];
   //ArraySetAsSeries(barsPrice,true);
   int copied=CopyRates(Symbol(),NULL,0,10,barsPrice);

   double barsClosedPrice[10]; //closed price of 10 bars on the chart

   if(copied > 0)
 {
  for(int i = 0; i <= ArraySize(barsPrice) - 1; i++)
    {
     barsClosedPrice[i] = barsPrice[i].close; //fill the barClosedPrices array with the last 10 candle closed price
    }
 }
 
   Print(barsClosedPrice[0]); 
   
   double barsMaValues[10];// create an array to hold the Ema value of the price

//use movingaverage.mqh library function to get the ema value of those price in the array, and save in another array
   ExponentialMAOnBuffer(10,0,0,20,barsClosedPrice,barsMaValues); // get the Ema value of the price and save in barsMaValues array

 Print("last fully formed candle Ema value = ", barsMaValues[8]); // HERE AM GETTING 0.0 INSTEAD OF THE EMA VALUE OF THE LAST COMPLETED FORMED CANDLE

can somebody tell me what am doing wrong ??