Простой код

 
//+------------------------------------------------------------------+
//|                                                     Proverka.mq5 |
//|                        Copyright 2010, MetaQuotes Software Corp. |
//|                                              http://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2010, MetaQuotes Software Corp."
#property link      "http://www.mql5.com"
#property version   "1.00"
#property indicator_separate_window
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
double buf[];
int OnInit()
  {
//--- indicator buffers mapping
   SetIndexBuffer(0,buf,INDICATOR_CALCULATIONS);
   Print(ArrayIsDynamic(buf));
   for(int i=0;i<10;i++)
   {
      buf[i]=i;
   }
//---
   return(0);
  }
//+------------------------------------------------------------------+
//| 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[])
  {
     for (int i=10;i>=0;i--)
     {
        Print(buf[i]);
     }
  
   return(rates_total);
  }
//+------------------------------------------------------------------+
ни как не могу заставить этот код работать как надо, при присодинении к графику выдает ошибку, что я делаю не так.
 
//+------------------------------------------------------------------+
//|                                                     Proverka.mq5 |
//|                        Copyright 2010, MetaQuotes Software Corp. |
//|                                              http://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2010, MetaQuotes Software Corp."
#property link      "http://www.mql5.com"
#property version   "1.00"
#property indicator_buffers 1
#property indicator_separate_window
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
double buf[];

int OnInit()
  {
//--- indicator buffers mapping
   SetIndexBuffer(0,buf,INDICATOR_DATA);
   Print(ArrayIsDynamic(buf));
//---
   return(0);
  }
//+------------------------------------------------------------------+
//| 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[])
  {
   
      if(prev_calculated==0)
      {
         for(int i=0;i<10;i++)
         {
            buf[i]=i;
         }
      }
      else
      {
         for (int i=9;i>=0;i--)
         {
            Print(buf[i]);
         }
      }
   return(rates_total);
  }
//+------------------------------------------------------------------+

 
avoitenko:

Благодарю, надо же как все запутано )
Причина обращения: