Подскажите, нужно простенький индикатор переписать под MQL5

 

Привет всем! MQL 4 немного знаю, но вот в 5-м никак пока. Пользуюсь индикатором NR7, в нём 10-к строк, как заставить заработать его в MT5? Нужно что то существенно менять или достаточно функцию какую поправить?

Вот собственно его текст. Если бы кто нибудь помог, буду премного благодарен!

#property indicator_chart_window
#property indicator_buffers 1
#property indicator_color1 Green
//+------------------------------------------------------------------+
extern int Back = 7;
//+------------------------------------------------------------------+
double ExtMapBuffer1[];
//+------------------------------------------------------------------+
int init()
{
  SetIndexStyle(0,DRAW_ARROW);
  SetIndexArrow(0,217);
  SetIndexBuffer(0,ExtMapBuffer1);
  SetIndexEmptyValue(0,0.0);
  return(0);
}
//+------------------------------------------------------------------+
int start()
{
  int i,j,pos;
  for(i=Bars-IndicatorCounted()-1;i>0;i--)
  {
      pos=i;
      for(j=i+1;j<i+Back;j++)
        if ((High[j]-Low[j])<(High[i]-Low[i]))
          pos=j;
      if (pos==i)
        ExtMapBuffer1[i] = High[i] + (High[i] - Low[i])/3;
  }
  return(0);
}

Документация по MQL5: Основы языка / Препроцессор / Свойства программ (#property)
Документация по MQL5: Основы языка / Препроцессор / Свойства программ (#property)
  • www.mql5.com
Основы языка / Препроцессор / Свойства программ (#property) - Документация по MQL5
 
#property copyright ""
#property link      "https://www.mql5.com/ru/users/avoitenko"
#property version   "1.00"

#property indicator_chart_window
#property indicator_plots   1
#property indicator_buffers 1

#property indicator_type1  DRAW_ARROW
#property indicator_color1 Green
#property indicator_width1 1

//--- input variables
input ushort InpBack=7;// Период
//--- buffer
double ExtMapBuffer1[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
  {

   SetIndexBuffer(0,ExtMapBuffer1);
   PlotIndexSetInteger(0,PLOT_ARROW,217);
   PlotIndexSetDouble(0,PLOT_EMPTY_VALUE,0);

   PlotIndexSetString(0,PLOT_LABEL,StringFormat("NR7(%d)",InpBack));
   IndicatorSetString(INDICATOR_SHORTNAME,"NR7");

   IndicatorSetInteger(INDICATOR_DIGITS,_Digits);

   ArraySetAsSeries(ExtMapBuffer1,true);

   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[])
  {

   ArraySetAsSeries(high,true);
   ArraySetAsSeries(low,true);

   int limit;
   if(prev_calculated<=0 || prev_calculated>rates_total) limit=rates_total-InpBack;
   else limit=rates_total-prev_calculated;

   int pos;
   for(int i=limit; i>0; i--)
     {
      pos=i;
      for(int j=i+1;j<i+InpBack;j++)
         if(NormalizeDouble(high[j]-low[j],_Digits)<NormalizeDouble(high[i]-low[i],_Digits)) pos=j;

      if(pos==i) ExtMapBuffer1[i]=NormalizeDouble(high[i]+(high[i]-low[i])/3,_Digits);
      else ExtMapBuffer1[i]=0.0;
     }

   return(rates_total);
  }
//+------------------------------------------------------------------+

 
avoitenko: Спасибо огромное!