Custom indicator does not plot anything

 

Hello everyone! I am coding a simple indicator that plots the slope of the moving average with given period. The code compiles without any errors and warnings. However it does not plot anything on the window. Can you point out my mistakes?

//+------------------------------------------------------------------+
//|                                      Slope of Moving Average.mq5 |
//|                                               Miraç Baver Öztürk |
//|                                     mirac.baver.ozturk@gmail.com |
//+------------------------------------------------------------------+
#property copyright "Miraç Baver Öztürk"
#property link      "mirac.baver.ozturk@gmail.com"
#property version   "1.00"

#property description "This indicator calculates the slope of Moving Average with given periods"

#property indicator_separate_window
#property indicator_buffers 3
#property indicator_plots 1

//input parameters
input int MA_Period = 14;//period of the moving average

//plot color histogram
#property indicator_label1 "SMA"//Slope of Moving Average
#property indicator_type1 DRAW_COLOR_HISTOGRAM
#property indicator_color1 clrGreen, clrRed
#property indicator_style1 STYLE_SOLID
#property indicator_width1 2

//buffers
double SMA_Buffer[];
double SMA_Colors_Buffer[];
double MA_Buffer[];

color colors[] = {clrGreen, clrRed};

int MA_Handle;

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
{
   MA_Handle = iMA(_Symbol, _Period, MA_Period, 0, MODE_SMA, PRICE_MEDIAN);

   SetIndexBuffer(0, SMA_Buffer, INDICATOR_DATA);
   SetIndexBuffer(1, SMA_Colors_Buffer, INDICATOR_COLOR_INDEX);

   return(INIT_SUCCEEDED);
}

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
   IndicatorRelease(MA_Handle);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime &time[],
                const double &open[],
                const double &high[],
                const double &low[],
                const double &close[],
                const long &tick_volume[],
                const long &volume[],
                const int &spread[])
{
   ArraySetAsSeries(MA_Buffer, true);
   
   int start = 0;
   
   if(prev_calculated > 0)start = prev_calculated - 1;
   
   for(int i=start;i<rates_total;i++)
   {
      CopyBuffer(MA_Handle, 2, i, 3, MA_Buffer);
      SMA_Buffer[i] = (MA_Buffer[i] - MA_Buffer[i+1]) / 2;
      if(SMA_Buffer[i]>0)SMA_Colors_Buffer[i] = 0;//green
      else SMA_Colors_Buffer[i] = 1;//red
   }


//--- return value of prev_calculated for next call
   return(rates_total);
}
//+------------------------------------------------------------------+