Сигнал по времени.

 

Добрый день. требуется ваша помощь.

Почему в отладке индикатор рисует сигналы, а когда отладка выполняется до конца, то сигналы пропадают.

Когда индикатор выставляю на график, то нет ни каких сигналов .


Код индикатора.

Файлы:
 

Исправленный код:

//+------------------------------------------------------------------+
//|                                               Indicator_time.mq5 |
//|                        Copyright 2021, MetaQuotes Software Corp. |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property version   "1.001"
//Grid Time 10:00-10:30
//14:30 - 15:00
//02:00 - 02:30
//06:00 - 06:30
//03:30 - 04:00
#property copyright "Copyright 2021, MetaQuotes Software Corp."
#property link      "https://www.mql5.com"
#property version   "1.00"
#property indicator_separate_window
#property indicator_minimum -3
#property indicator_maximum 3
#property indicator_buffers 1
#property indicator_plots   1
//--- plot Label1
#property indicator_label1  "Label1"
#property indicator_type1   DRAW_HISTOGRAM
#property indicator_color1  clrForestGreen
#property indicator_style1  STYLE_SOLID
#property indicator_width1  2
//--- indicator buffers
double         Label1Buffer[];
datetime start=D'01.01.2021';
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
  {
//--- indicator buffers mapping
   SetIndexBuffer(0,Label1Buffer,INDICATOR_DATA);
//--- set as an empty value 0
   PlotIndexSetDouble(0,PLOT_EMPTY_VALUE,0.0);
//---
   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[])
  {
//---
   for(int i=prev_calculated>0?prev_calculated-1:0; i<rates_total; i++)
     {
      Label1Buffer[i]=0.0;
      if(time[i]<start)
         continue;
      //Grid Time 10:00-10:30
      //14:30 - 15:00
      //02:00 - 02:30
      //06:00 - 06:30
      //03:30 - 04:00
      MqlDateTime STime;
      TimeToStruct(time[i],STime);
      if(STime.hour==10 && STime.min==0)
        {
         Print("Время = ", TimeToString(time[i],TIME_DATE|TIME_MINUTES));
         Label1Buffer[i]=2;
        }
     }
//--- return value of prev_calculated for next call
   return(rates_total);
  }
//+------------------------------------------------------------------+
 
Vladimir Karputov:

Исправленный код:

Спасибо большое. Заработало !

Причина обращения: