Help with SMAs in calculating and plotting on chart.

 
//+------------------------------------------------------------------+
//|                                                   SMABot.mq5     |
//|                        Copyright MetaQuotes Ltd.                |
//|                https://www.mql5.com/en/users/metaquotes         |
//+------------------------------------------------------------------+
#property copyright "Copyright MetaQuotes Ltd."
#property link      "https://www.mql5.com"
#property version   "1.00"
#property indicator_chart_window
#property indicator_buffers 3
#property indicator_color1  clrRed
#property indicator_color2  clrGreen
#property indicator_color3  clrBlue
#property indicator_width1  1
#property indicator_width2  1
#property indicator_width3  1

//--- indicator buffers
double SMA7Buffer[];
double SMA14Buffer[];
double SMA28Buffer[];

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
  {
   //--- indicator buffers mapping
   SetIndexBuffer(0, SMA7Buffer);
   SetIndexBuffer(1, SMA14Buffer);
   SetIndexBuffer(2, SMA28Buffer);

   //--- set plot styles using PlotIndexSetInteger
   PlotIndexSetInteger(0, PLOT_DRAW_TYPE, DRAW_LINE);
   PlotIndexSetInteger(1, PLOT_DRAW_TYPE, DRAW_LINE);
   PlotIndexSetInteger(2, PLOT_DRAW_TYPE, DRAW_LINE);

   PlotIndexSetInteger(0, PLOT_LINE_WIDTH, 1); // Line width for SMA7
   PlotIndexSetInteger(1, PLOT_LINE_WIDTH, 1); // Line width for SMA14
   PlotIndexSetInteger(2, PLOT_LINE_WIDTH, 1); // Line width for SMA28

   //--- set index labels
   IndicatorSetString(INDICATOR_SHORTNAME, "SMA 7, 14, 28");
   PlotIndexSetString(0, PLOT_LABEL, "SMA7");
   PlotIndexSetString(1, PLOT_LABEL, "SMA14");
   PlotIndexSetString(2, PLOT_LABEL, "SMA28");

   return(INIT_SUCCEEDED);
  }

//+------------------------------------------------------------------+
//| 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[])
{
    // Loop through each bar to calculate SMAs
    for(int i = 0; i < rates_total; i++)
    {

        // Calculate SMA7 for the i-th bar
        SMA7Buffer[i] = iMA(_Symbol, _Period, 7, 0, MODE_SMA, PRICE_CLOSE);

        // Calculate SMA14 for the i-th bar
        SMA14Buffer[i] = iMA(_Symbol, _Period, 14, 0, MODE_SMA, PRICE_CLOSE);

        // Calculate SMA28 for the i-th bar
        SMA28Buffer[i] = iMA(_Symbol, _Period, 28, 0, MODE_SMA, PRICE_CLOSE);
    }
 
    return(rates_total);
}
I have a problem with SMAs, I want to plot 3 SMA, 7, 14, 28, I am not getting any compiling errors, but I cannot for the life of me see the values or the lines on the chart, the value just reads 10 for the SMA7, any help would be greatly appreciated, thank you.
            
 
iMA function returns indicator handle. And you have to use CopyBuffer to access the buffer values.