Fora de alcance em Necessidade de ajuda - página 15

 

Metacotações com visualização

2020.12.14 10:55:49.261 AUDUSD,H1: 61687 tick events (61686 bars, 124333 bar states) processed in 0:00:38.188 (total time 0:00:38.203)
2020.12.14 10:55:49.261 2020.12.11 23:59:59  Array2 AUDUSD,H1: << Объект Min_D удалён >>
2020.12.14 10:55:49.261 2020.12.11 23:59:59  Array2 AUDUSD,H1: << Объект Min_D_label удалён >>
2020.12.14 10:55:49.261 2020.12.11 23:59:59  Array2 AUDUSD,H1:  i = 2/ Min_D_Level = 0.74038/ Low_D1_Level0.74233/ Разница0.00195
2020.12.14 10:55:49.261 2020.12.11 23:00:00  Array2 AUDUSD,H1:  i = 2/ Min_D_Level = 0.74038/ Low_D1_Level0.74233/ Разница0.00195

Alpari com visualização

2020.12.14 10:56:13.369 AUDUSD,H1: 129781 tick events (129780 bars, 260520 bar states) processed in 0:01:16.688 (total time 0:01:16.719)
2020.12.14 10:56:13.369 2020.12.11 23:59:59  Array2 AUDUSD,H1: << Объект Min_D удалён >>
2020.12.14 10:56:13.369 2020.12.11 23:59:59  Array2 AUDUSD,H1: << Объект Min_D_label удалён >>
2020.12.14 10:56:13.369 2020.12.11 23:59:59  Array2 AUDUSD,H1:  i = 2/ Min_D_Level = 0.74039/ Low_D1_Level0.74234/ Разница0.00195
2020.12.14 10:56:13.369 2020.12.11 23:00:00  Array2 AUDUSD,H1:  i = 2/ Min_D_Level = 0.74039/ Low_D1_Level0.74234/ Разница0.00195
 
Dark Kchlyzov :

Aqui está a função a ser depurada Post#43

É assim que funciona)))

 //+------------------------------------------------------------------+
//|                                                   Test_Level.mq4 |
//|                        Copyright 2020, MetaQuotes Software Corp. |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2020, MetaQuotes Software Corp."
#property link        "https://www.mql5.com"
#property version    "1.00"
#property strict
double    Bar_data_D1 [][ 6 ]; // Копирует в массив данные баров указанного графика и возвращает количество скопированных баров D1
double    Bar_data_W1 [][ 6 ]; // Копирует в массив данные баров указанного графика и возвращает количество скопированных баров W1
double    Bar_data_MN [][ 6 ];
double    High_D1_Level;     // Возвращает значение максимальной цены бара D1
double    Low_D1_Level;       // Возвращает значение минимальной цены бара  D1
double    High_W1_Level;     // Возвращает значение максимальной цены бара W1
double    Low_W1_Level ;     // Возвращает значение минимальной цены бара  W1
double    High_MN1_Level;     // Возвращает значение максимальной цены бара MN1
double    Low_MN1_Level;     // Возвращает значение минимальной цены бара  MN1
double    Max_D_Level;       // ближайшей максимальный D уровень
double    Min_D_Level ;       // ближайшей минимальный  D уровень
double    Max_W_Level ;       // ближайшей максимальный W уровень
double    Min_W_Level ;       // ближайшей минимальный  W уровень
double    Max_MN_Level ;     // ближайшей максимальный MN уровень
double    Min_MN_Level ;     // ближайшей минимальный  MN уровень

int       Max_D_Num ;         // ближайшей максимальный день (номер бара)  
int       Min_D_Num ;         // ближайшей минимальный  день (номер бара)
int       Max_D_Volume ;     // ближайшей максимальный день (Объём)  
int       Min_D_Volume ;     // ближайшей минимальный  день (Объём)
datetime Max_D_Time;         // 
datetime Min_D_Time;         //
datetime Time_Day;
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit ()
  {
   Level();
   return ( INIT_SUCCEEDED );
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit ( const int reason)
  {
   ObjectsDeleteAll ( 0 , "Arr_" ); Print ( "<< Все объекты удалены >>" );
  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick ()
  {
  On_Timer();
  }
//+------------------------------------------------------------------+
//|                        Функция Level v 1.0
//+------------------------------------------------------------------+
void Level()
{
 ArrayCopyRates(Bar_data_D1, _Symbol , PERIOD_D1 ); // Копирует в массив данные баров указанного графика и возвращает количество скопированных баров
 ArrayCopyRates(Bar_data_W1, _Symbol , PERIOD_W1 ); // Копирует в массив данные баров указанного графика и возвращает количество скопированных баров
 ArrayCopyRates(Bar_data_MN, _Symbol , PERIOD_MN1 ); // Копирует в массив данные баров указанного графика и возвращает количество скопированных баров
 
 High_D1_Level  = iHigh ( _Symbol , PERIOD_D1 , 1 );   // Возвращает значение максимальной цены бара D1
 Low_D1_Level   = iLow ( _Symbol , PERIOD_D1 , 1 );   // Возвращает значение минимальной цены бара  D1
 High_W1_Level  = iHigh ( _Symbol , PERIOD_W1 , 1 );   // Возвращает значение максимальной цены бара W1
 Low_W1_Level   = iLow ( _Symbol , PERIOD_W1 , 1 );   // Возвращает значение минимальной цены бара  W1 
 High_MN1_Level = iHigh ( _Symbol , PERIOD_MN1 , 1 );   // Возвращает значение максимальной цены бара MN1
 Low_MN1_Level  = iLow ( _Symbol , PERIOD_MN1 , 1 );   // Возвращает значение минимальной цены бара  MN1
 
//--- Max_D_Level
 for ( int i = 1 ; i< ArrayRange (Bar_data_D1, 0 ) ;i++)
    {
     if (Bar_data_D1 [i][ 3 ] != Bar_data_D1 [i+ 1 ][ 3 ])
       {
         if (Bar_data_D1 [i][ 3 ] > High_D1_Level)  
          {
           Max_D_Level = Bar_data_D1 [i][ 3 ];
           Print ( " i = " ,i, "/Max_D Разница" , DoubleToString (Max_D_Level-High_D1_Level, Digits ));
           break ;
          }
       }
     if (Bar_data_D1 [i][ 3 ] == Bar_data_D1 [i+ 1 ][ 3 ])
       {
        Max_D_Level = High_D1_Level;
         Print ( " i = " ,i, "/Max_D Разница" , DoubleToString (Max_D_Level-High_D1_Level, Digits ));
         break ;
       }
    } 
    
//--- Min_D_Leve  
 for ( int i = 1 ; i< ArrayRange (Bar_data_D1, 0 ) ;i++)
    {
     if (Bar_data_D1 [i][ 2 ] != Bar_data_D1 [i+ 1 ][ 2 ])
       {
         if ( Bar_data_D1 [i][ 2 ] < Low_D1_Level)
          {
           Min_D_Level = Bar_data_D1 [i][ 2 ];
           Print ( " i = " ,i, "/Min_D Разница" , DoubleToString (Low_D1_Level-Min_D_Level, Digits ));
           break ;
          }
       }   
     if (Bar_data_D1 [i][ 2 ] == Bar_data_D1 [i+ 1 ][ 2 ])
       {
        Min_D_Level = Low_D1_Level;
         Print ( " i = " ,i, "/Min_D Разница" , DoubleToString (Low_D1_Level-Min_D_Level, Digits ));
         break ;
       }
    } 
    
    
//--- Max_W_Level
 for ( int i = 1 ; i< ArrayRange (Bar_data_D1, 0 ) ;i++)
    {
     //Print(" i = ",i);
     if (Bar_data_W1 [i][ 3 ] != Bar_data_W1 [i+ 1 ][ 3 ])
       {
         if (Bar_data_W1 [i][ 3 ] > High_W1_Level)    
          {
           Max_W_Level = Bar_data_W1 [i][ 3 ];
           Print ( " i = " ,i, "/Max_W Разница" , DoubleToString (Max_W_Level-High_W1_Level, Digits ));
           break ;
          }
       }  
     if (Bar_data_W1 [i][ 3 ] == Bar_data_W1 [i+ 1 ][ 3 ])
       {
        Max_W_Level = High_W1_Level;
         Print ( " i = " ,i, "/Max_W Разница" , DoubleToString (Max_W_Level-High_W1_Level, Digits ));
         break ;
       }
    } 
    
//--- Min_W_Level 
 for ( int i = 1 ; i< ArrayRange (Bar_data_D1, 0 ) ;i++)
    {
     // Print(" i = ",i);
     if (Bar_data_W1 [i][ 2 ] != Bar_data_W1 [i+ 1 ][ 2 ])
       {
         if (Bar_data_W1 [i][ 2 ] < Low_W1_Level)
          {
           Min_W_Level = Bar_data_W1 [i][ 2 ];
           Print ( " i = " ,i, "/Min_W Разница" , DoubleToString (Low_W1_Level-Min_W_Level, Digits ));
           break ;
          }
       }  
     if (Bar_data_W1 [i][ 2 ] == Bar_data_W1 [i+ 1 ][ 2 ])
       {
        Min_W_Level = Low_W1_Level;
         Print ( " i = " ,i, "/Min_W Разница" , DoubleToString (Low_W1_Level-Min_W_Level, Digits ));
         break ;
       }
    } 

 //+-----------------------High_D1_Level-----------------------------+  
 if ( ObjectFind ( "Arr_High_D1" )!=High_D1_Level) 
   {
     ObjectDelete ( "Arr_High_D1" );
     if ( ObjectFind ( "Arr_High_D1" )!= 0 )
      {
       ObjectCreate ( "Arr_High_D1" , OBJ_HLINE , 0 , Time[ 0 ],High_D1_Level);
       ObjectSet( "Arr_High_D1" , OBJPROP_COLOR , clrMaroon );
       ObjectSet( "Arr_High_D1" , OBJPROP_WIDTH , 1 );
      }
   } 
 if ( ObjectFind ( "Arr_High_D1_label" )!=High_D1_Level)
   {
     ObjectDelete ( "Arr_High_D1_label" ); 
     if ( ObjectFind ( "Arr_High_D1_label" ) != 0 )
      {
       ObjectCreate ( "Arr_High_D1_label" , OBJ_TEXT , 0 , Time[ 13 ], High_D1_Level);
       ObjectSetText( "Arr_High_D1_label" , "High_D1: " + DoubleToStr(High_D1_Level, _Digits ), 8 , "Verdana" , Brown);
      }
   } 
 //+-------------------------Low_D1_Level----------------------------+ 
 if ( ObjectFind ( "Arr_Low_D1" )!=Low_D1_Level) 
   {
     ObjectDelete ( "Arr_Low_D1" );
     if ( ObjectFind ( "Arr_Low_D1" )!= 0 )
      {
       ObjectCreate ( "Arr_Low_D1" , OBJ_HLINE , 0 , Time[ 0 ],Low_D1_Level);
       ObjectSet( "Arr_Low_D1" , OBJPROP_COLOR , clrMaroon );
       ObjectSet( "Arr_Low_D1" , OBJPROP_WIDTH , 1 );
      }
   } 
   
 if ( ObjectFind ( "Arr_Low_D1_label" )!=Low_D1_Level)
   {
     ObjectDelete ( "Arr_Low_D1_label" ); 
     if ( ObjectFind ( "Arr_Low_D1_label" ) != 0 )
      {
       ObjectCreate ( "Arr_Low_D1_label" , OBJ_TEXT , 0 , Time[ 13 ], Low_D1_Level);
       ObjectSetText( "Arr_Low_D1_label" , "Low_D1: " + DoubleToStr(Low_D1_Level, _Digits ), 8 , "Verdana" , Brown);
      }
   } 
   
     //+-----------------------Max_D_Level-----------------------------+  
 if ( ObjectFind ( "Arr_Lax_D" )!=Max_D_Level) 
   {
     ObjectDelete ( "Arr_Lax_D" );
     if ( ObjectFind ( "Arr_Lax_D" )!= 0 )
      {
       ObjectCreate ( "Arr_Lax_D" , OBJ_HLINE , 0 , Time[ 0 ],Max_D_Level);
       ObjectSet( "Arr_Lax_D" , OBJPROP_COLOR , clrMaroon );
       ObjectSet( "Arr_Lax_D" , OBJPROP_WIDTH , 1 );
      }
   } 
 if ( ObjectFind ( "Arr_Lax_D_label" )!=Max_D_Level)
   {
     ObjectDelete ( "Arr_Lax_D_label" ); 
     if ( ObjectFind ( "Arr_Lax_D_label" ) != 0 )
      {
       ObjectCreate ( "Arr_Lax_D_label" , OBJ_TEXT , 0 , Time[ 30 ], Max_D_Level);
       ObjectSetText( "Arr_Lax_D_label" , "Max_D: " + DoubleToStr(Max_D_Level, _Digits ), 8 , "Verdana" , Brown);
      }
   } 
 //+-------------------------Min_D_Level----------------------------+ 
 if ( ObjectFind ( "Arr_Lin_D" )!= Min_D_Level) 
   {
     ObjectDelete ( "Arr_Lin_D" );
     if ( ObjectFind ( "Arr_Lin_D" )!= 0 )
      {
       ObjectCreate ( "Arr_Lin_D" , OBJ_HLINE , 0 , Time[ 0 ],Min_D_Level);
       ObjectSet( "Arr_Lin_D" , OBJPROP_COLOR , clrMaroon );
       ObjectSet( "Arr_Lin_D" , OBJPROP_WIDTH , 1 );
      }
   } 
   
 if ( ObjectFind ( "Arr_Lin_D_label" )!=Min_D_Level)
   {
     ObjectDelete ( "Arr_Lin_D_label" ); 
     if ( ObjectFind ( "Arr_Lin_D_label" ) != 0 )
      {
       ObjectCreate ( "Arr_Lin_D_label" , OBJ_TEXT , 0 , Time[ 30 ], Min_D_Level);
       ObjectSetText( "Arr_Lin_D_label" , "Min_D: " + DoubleToStr(Min_D_Level, _Digits ), 8 , "Verdana" , Brown);
      }
   }  
 //+-----------------------High_W1_Level-----------------------------+         
 if ( ObjectFind ( "Arr_High_W1" )!=High_W1_Level) 
   {
     ObjectDelete ( "Arr_High_W1" );
     if ( ObjectFind ( "Arr_High_W1" )!= 0 )
      {
       ObjectCreate ( "Arr_High_W1" , OBJ_HLINE , 0 , Time[ 0 ],High_W1_Level);
       ObjectSet( "Arr_High_W1" , OBJPROP_COLOR , clrMaroon );
       ObjectSet( "Arr_High_W1" , OBJPROP_WIDTH , 1 );
      }
   } 
 if ( ObjectFind ( "Arr_High_W1_label" )!=High_W1_Level)
   {
     ObjectDelete ( "Arr_High_W1_label" ); 
     if ( ObjectFind ( "Arr_High_W1_label" ) != 0 )
      {
       ObjectCreate ( "Arr_High_W1_label" , OBJ_TEXT , 0 , Time[ 47 ], High_W1_Level);
       ObjectSetText( "Arr_High_W1_label" , "High_W1: " + DoubleToStr(High_W1_Level, _Digits ), 8 , "Verdana" , Brown);
      }
   } 
 //+-------------------------Low_W1_Level----------------------------+       
 if ( ObjectFind ( "Arr_Low_W1" )!=Low_W1_Level) 
   {
     ObjectDelete ( "Arr_Low_W1" );
     if ( ObjectFind ( "Arr_Low_W1" )!= 0 )
      {
       ObjectCreate ( "Arr_Low_W1" , OBJ_HLINE , 0 , Time[ 0 ],Low_W1_Level);
       ObjectSet( "Arr_Low_W1" , OBJPROP_COLOR , clrMaroon );
       ObjectSet( "Arr_Low_W1" , OBJPROP_WIDTH , 1 );
      }
   } 
   
 if ( ObjectFind ( "Arr_Low_W1_label" )!=Low_W1_Level)
   {
     ObjectDelete ( "Arr_Low_W1_label" ); 
     if ( ObjectFind ( "Arr_Low_W1_label" ) != 0 )
      {
       ObjectCreate ( "Arr_Low_W1_label" , OBJ_TEXT , 0 , Time[ 47 ], Low_W1_Level);
       ObjectSetText( "Arr_Low_W1_label" , "Low_W1: " + DoubleToStr(Low_W1_Level, _Digits ), 8 , "Verdana" , Brown);
      }
   }  
   
   
 //+-----------------------Max_W_Level-----------------------------+         
 if ( ObjectFind ( "Arr_Lax_W" )!=Max_W_Level) 
   {
     ObjectDelete ( "Arr_Lax_W" );
     if ( ObjectFind ( "Arr_Lax_W" )!= 0 )
      {
       ObjectCreate ( "Arr_Lax_W" , OBJ_HLINE , 0 , Time[ 0 ],Max_W_Level);
       ObjectSet( "Arr_Lax_W" , OBJPROP_COLOR , clrMaroon );
       ObjectSet( "Arr_Lax_W" , OBJPROP_WIDTH , 1 );
      }
   } 
 if ( ObjectFind ( "Arr_Lax_W_label" )!= Max_W_Level)
   {
     ObjectDelete ( "Arr_Lax_W_label" ); 
     if ( ObjectFind ( "Arr_Lax_W_label" ) != 0 )
      {
       ObjectCreate ( "Arr_Lax_W_label" , OBJ_TEXT , 0 , Time[ 64 ], Max_W_Level);
       ObjectSetText( "Arr_Lax_W_label" , "Max_W: " + DoubleToStr(Max_W_Level, _Digits ), 8 , "Verdana" , Brown);
      }
   } 
 //+-------------------------Min_W_Level----------------------------+       
 if ( ObjectFind ( "Arr_Lin_W" )!=Min_W_Level) 
   {
     ObjectDelete ( "Arr_Lin_W" );
     if ( ObjectFind ( "Arr_Lin_W" )!= 0 )
      {
       ObjectCreate ( "Arr_Lin_W" , OBJ_HLINE , 0 , Time[ 0 ],Min_W_Level);
       ObjectSet( "Arr_Lin_W" , OBJPROP_COLOR , clrMaroon );
       ObjectSet( "Arr_Lin_W" , OBJPROP_WIDTH , 1 );
      }
   } 
   
 if ( ObjectFind ( "Arr_Lin_W_label" )!= Min_W_Level)
   {
     ObjectDelete ( "Arr_Lin_W_label" ); 
     if ( ObjectFind ( "Arr_Lin_W_label" ) != 0 )
      {
       ObjectCreate ( "Arr_Lin_W_label" , OBJ_TEXT , 0 , Time[ 64 ], Min_W_Level);
       ObjectSetText( "Arr_Lin_W_label" , "Min_W: " + DoubleToStr(Min_W_Level, _Digits ), 8 , "Verdana" , Brown);
      }
   }
 //+-----------------------High_MN1_Level-----------------------------+         
 if ( ObjectFind ( "Arr_High_MN1" )!=High_MN1_Level) 
   {
     ObjectDelete ( "Arr_High_MN1" );
     if ( ObjectFind ( "Arr_High_MN1" )!= 0 )
      {
       ObjectCreate ( "Arr_High_MN1" , OBJ_HLINE , 0 , Time[ 0 ],High_MN1_Level);
       ObjectSet( "Arr_High_MN1" , OBJPROP_COLOR , clrMaroon );
       ObjectSet( "Arr_High_MN1" , OBJPROP_WIDTH , 1 );
      }
   } 
 if ( ObjectFind ( "Arr_High_MN1_label" )!=High_MN1_Level)
   {
     ObjectDelete ( "Arr_High_MN1_label" ); 
     if ( ObjectFind ( "Arr_High_MN1_label" ) != 0 )
      {
       ObjectCreate ( "Arr_High_MN1_label" , OBJ_TEXT , 0 , Time[ 81 ], High_MN1_Level);
       ObjectSetText( "Arr_High_MN1_label" , "High_MN1: " + DoubleToStr(High_MN1_Level, _Digits ), 8 , "Verdana" , Brown);
      }
   } 
 //+-------------------------Low_MN1_Level----------------------------+       
 if ( ObjectFind ( "Arr_Low_MN1" )!=Low_MN1_Level) 
   {
     ObjectDelete ( "Arr_Low_MN1" );
     if ( ObjectFind ( "Arr_Low_MN1" )!= 0 )
      {
       ObjectCreate ( "Arr_Low_MN1" , OBJ_HLINE , 0 , Time[ 0 ],Low_MN1_Level);
       ObjectSet( "Arr_Low_MN1" , OBJPROP_COLOR , clrMaroon );
       ObjectSet( "Arr_Low_MN1" , OBJPROP_WIDTH , 1 );
      }
   } 
   
 if ( ObjectFind ( "Arr_Low_MN1_label" )!=Low_MN1_Level)
   {
     ObjectDelete ( "Arr_Low_MN1_label" ); 
     if ( ObjectFind ( "Arr_Low_MN1_label" ) != 0 )
      {
       ObjectCreate ( "Arr_Low_MN1_label" , OBJ_TEXT , 0 , Time[ 81 ], Low_MN1_Level);
       ObjectSetText( "Arr_Low_MN1_label" , "Low_MN1: " + DoubleToStr(Low_MN1_Level, _Digits ), 8 , "Verdana" , Brown);
      }
   }       
}
//+-------------------------------------------------------------------------+   
//                         функция Timer                    
//+-------------------------------------------------------------------------+
void On_Timer()
{

     
 if (Day()!= Time_Day)
   {
    Level();
    Time_Day = Day();
   }
}
 
MakarFX:

É assim que funciona))))

Há erros no código:

 for(int i = 1; i<ArrayRange(Bar_data_D1,0) ;i++)
    {
     //Print(" i = ",i);
     if(Bar_data_W1 [i][3] != Bar_data_W1 [i+1][3])
       {
        if(Bar_data_W1 [i][3] > High_W1_Level)    
          {
           Max_W_Level = Bar_data_W1 [i][3];
           Print(" i = ",i,"/Max_W Разница",DoubleToString(Max_W_Level-High_W1_Level,Digits));
           break;
          }
       }  
     if(Bar_data_W1 [i][3] == Bar_data_W1 [i+1][3])
       {
        Max_W_Level = High_W1_Level;
        Print(" i = ",i,"/Max_W Разница",DoubleToString(Max_W_Level-High_W1_Level,Digits));
        break;
       }
    } 

Fazemos um loop através de uma matriz e endereçamos itens de outra matriz. Quando o número de itens em Bar_data_D1 excede o número de itens em Bar_data_W1 e nós abordamos tal item, a matriz é ultrapassada.

 
Dark Kchlyzov:

Acho que sim, para que você possa retroceder, no meu caso dois meses a partir da data do teste

O testador vê 1002 barras diárias


O testador adiciona 1000 castiçais antes da data de início do intervalo de teste, o histórico anterior não é levado em conta. Preciso fazer um grande intervalo de teste. Eu o tenho a partir do ano 2000.

 
Aleksei Stepanenko:

Há erros no código:

Fazemos um loop através de uma matriz e endereçamos itens de outra matriz. Quando o número de itens em Bar_data_D1 excede o número de itens em Bar_data_W1, a matriz é ultrapassada.

fixo

//--- Max_W_Level
 for(int i = 1; i<ArrayRange(Bar_data_W1,0) ;i++)
    {
     if(Bar_data_W1 [i][3] != Bar_data_W1 [i+1][3])
       {
        if(Bar_data_W1 [i][3] > High_W1_Level)    
          {
           Max_W_Level = Bar_data_W1 [i][3];
           Print(" i = ",i,"/Max_W Разница",DoubleToString(Max_W_Level-High_W1_Level,Digits));
           break;
          }
       }  
     if(Bar_data_W1 [i][3] == Bar_data_W1 [i+1][3])
       {
        Max_W_Level = High_W1_Level;
        Print(" i = ",i,"/Max_W Разница",DoubleToString(Max_W_Level-High_W1_Level,Digits));
        break;
       }
    } 
    
//--- Min_W_Level 
 for(int i = 1; i<ArrayRange(Bar_data_W1,0) ;i++)
    {
     if(Bar_data_W1 [i][2] != Bar_data_W1 [i+1][2])
       {
        if(Bar_data_W1 [i][2] < Low_W1_Level)
          {
           Min_W_Level = Bar_data_W1 [i][2];
           Print(" i = ",i,"/Min_W Разница",DoubleToString(Low_W1_Level-Min_W_Level,Digits));
           break;
          }
       }  
     if(Bar_data_W1 [i][2] == Bar_data_W1 [i+1][2])
       {
        Min_W_Level = Low_W1_Level;
        Print(" i = ",i,"/Min_W Разница",DoubleToString(Low_W1_Level-Min_W_Level,Digits));
        break;
       }
    } 

trabalha sem erros

2020.12.14 13:02:09.812 AUDUSD,H1: 5902 tick events (5901 bars, 12803 bar states) processed in 0:00:00.125 (total time 0:00:00.125)
2020.12.14 13:02:09.812 2020.12.11 23:59:59  Array3 AUDUSD,H1: << Все объекты удалены >>
2020.12.14 13:02:09.812 2020.12.11 00:00:00  Array3 AUDUSD,H1:  i = 2/Min_W Разница0.00738
2020.12.14 13:02:09.812 2020.12.11 00:00:00  Array3 AUDUSD,H1:  i = 3/Max_W Разница0.00000
2020.12.14 13:02:09.812 2020.12.11 00:00:00  Array3 AUDUSD,H1:  i = 2/Min_D Разница0.00195
2020.12.14 13:02:09.812 2020.12.11 00:00:00  Array3 AUDUSD,H1:  i = 264/Max_D Разница0.00000
 
Aleksei Stepanenko:

Há erros no código:

Fazemos um loop através de uma matriz e endereçamos itens de outra matriz. Quando o número de itens em Bar_data_D1 é maior do que em Bar_data_W1 e abordamos tal item, a matriz é ultrapassada.

Isto não é um erro, mas um descuido, apenas quando você está sentado e se interroga sobre qual é o problema, você apaga e copia e então alguém vem e diz qual é o problema (sem sequer ler o código) você simplesmente pega e joga fora, este é o resultado.

 
MakarFX:

Erro com o terminal

copiou o código do correio acima e fez o teste

aqui está um registro

Desmonte o terminal e reinstale ?

Talvez com hardware ? ou scooter ?

 
Dark Kchlyzov:

Não é um erro, mas um descuido, quando você está sentado ali se perguntando qual é o problema, você apaga e copia e então alguém vem e diz qual é o problema (sem ler) você simplesmente o pega e joga fora, esse é o resultado.

Não se deixa para trás as versões antigas.

E o código compara valores adjacentes, isto é correto e consistente com a imagem original e o problema?

if(Bar_data_W1 [i][3] == Bar_data_W1 [i+1][3])

É uma busca por valores adjacentes idênticos, uma tarefa mais simples, não todos os valores idênticos. A busca de cópias (mesmos valores) é feita comparando cada elemento da matriz com todos, é cara, existem outras soluções mais sofisticadas, mas mais baratas.

Não gosto disso, mas sem grandes mudanças em seu código, antes de tal comparação, classifique a matriz pelo valor pesquisado, e então o código será mais correto.

Документация по MQL5: Основы языка / Переменные
Документация по MQL5: Основы языка / Переменные
  • www.mql5.com
Переменные - Основы языка - Справочник MQL5 - Справочник по языку алгоритмического/автоматического трейдинга для MetaTrader 5
 
Dark Kchlyzov:

Desmonte o terminal e reinstale ?

Talvez com o hardware ? ou com a scooter ?

Comportamento diferente no mesmo período sob as mesmas condições (mesmo fornecedor de dados) ?

 
MakarFX:

Quem é seu corretor?

Que terminal você usa?

Alguém tem um terminal MT4 dos desenvolvedores do MT4?