Indicator does not display recent values

 
Hi,
I am working with an indicator that I am not able to solve a problem with the M1 timeframe.
The example of the indicator is like this:
#property description "PruebaM1"

//--- indicator settings
#property indicator_separate_window
#property indicator_minimum 0
#property indicator_maximum 100
#property indicator_level1 30
#property indicator_level2 70
#property indicator_level3 50

#property indicator_buffers 1
#property indicator_plots   1
#property indicator_type1   DRAW_LINE
#property indicator_color1  DodgerBlue

input uchar InpPeriod  = 14; // RSI period 

double    Buffer[]; //Indicator Buffer
int MaxBars = 100;

int rsi;       //Handle rsi
double M1[];   //Matriz rsi

void OnInit(){
   SetIndexBuffer(0,Buffer,INDICATOR_DATA);
   IndicatorSetInteger(INDICATOR_DIGITS,2);
   IndicatorSetString(INDICATOR_SHORTNAME,"PruebaM1("+string(InpPeriod)+")");

   rsi  = iRSI(Symbol(), PERIOD_M1,  14, PRICE_CLOSE);            
}
//+------------------------------------------------------------------+
//| Relative Strength Index                                          |
//+------------------------------------------------------------------+
int OnCalculate(
                const int rates_total,    // amount of history in bars at the current tick
                const int prev_calculated,// amount of history in bars at the previous tick
                const datetime &time[],
                const double &open[],
                const double& high[],     // price array of maximums of price for the calculation of indicator
                const double& low[],      // price array of minimums of price for the calculation of indicator
                const double &close[],
                const long &tick_volume[],
                const long &volume[],
                const int &spread[]){
   
   if(rates_total<=14)     return(0);
   
   for(int i=0; i<rates_total && !IsStopped(); i++){
      if (i >= rates_total-MaxBars){
         CopyBuffer(rsi, 0, i, 14, M1);
         ArraySetAsSeries(M1,true); 
         Buffer[i] = NormalizeDouble(M1[0], 2);
      }   
   }

   return(rates_total);
}

The fact is that it does not show me the latest values: Obviously I am doing something wrong:

I only want to display the last X values, but go all the way to the end.

Can someone help me with the error?