Array fuori portata in Bisogno di aiuto - pagina 15

 

MetaCitazioni con visualizzazione

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 con visualizzazione

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 :

Ecco la funzione di cui eseguire il debug Post#43

Funziona così)))

 //+------------------------------------------------------------------+
//|                                                   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:

È così che funziona)))

Ci sono errori nel codice:

 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;
       }
    } 

Facciamo un loop attraverso una matrice e indirizziamo gli elementi di un'altra. Quando il numero di elementi in Bar_data_D1 supera il numero di elementi in Bar_data_W1 e ci rivolgiamo a un tale elemento, l'array viene superato.

 
Dark Kchlyzov:

Penso di sì, quindi si può andare indietro, nel mio caso due mesi dalla data del test

Il tester vede 1002 barre giornaliere


Il tester aggiunge 1000 candele prima della data di inizio dell'intervallo di test, la storia precedente non viene presa in considerazione. Ho bisogno di fare un grande intervallo di test. Ce l'ho a partire dal 2000.

 
Aleksei Stepanenko:

Ci sono errori nel codice:

Facciamo un loop attraverso una matrice e indirizziamo gli elementi di un'altra. Quando il numero di elementi in Bar_data_D1 supera il numero di elementi in Bar_data_W1, l'array viene superato.

fisso

//--- 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;
       }
    } 

funziona senza errori

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:

Ci sono errori nel codice:

Facciamo un loop attraverso una matrice e indirizziamo gli elementi di un'altra. Quando il numero di elementi in Bar_data_D1 è più grande di Bar_data_W1 e ci rivolgiamo a un tale elemento, l'array viene superato.

Questo non è un errore ma una disattenzione, proprio quando sei seduto a riflettere su quale sia il problema, cancelli e copi e poi qualcuno viene a dire qual è il problema (senza nemmeno leggere il codice) tu lo prendi e lo butti via, questo è il risultato.

 
MakarFX:

Errore con il terminale

Ho copiato il codice dal post sopra e ho eseguito il test

qui c'è un registro

Strappare il terminale e reinstallarlo?

Forse con l'hardware o lo scooter?

 
Dark Kchlyzov:

Non è un errore ma una disattenzione, quando sei seduto lì a chiederti qual è il problema, cancelli e copi e poi qualcuno viene a dirti qual è il problema (senza leggere) semplicemente lo prendi e lo butti via, questo è il risultato.

Non si lasciano indietro le vecchie versioni.

E il codice confronta i valori adiacenti, è corretto e coerente con l'immagine originale e il problema?

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

È una ricerca di valori adiacenti identici, un compito più semplice, non di tutti i valori identici. La ricerca di copie (stessi valori) viene fatta confrontando ogni elemento dell'array con tutti, è costosa, ci sono altre soluzioni più sofisticate ma più economiche.

Non mi piace, ma senza grandi cambiamenti al tuo codice, prima di un tale confronto, ordina l'array per il valore cercato, e poi il codice sarà più corretto.

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

Strappare il terminale e reinstallarlo?

Forse con l'hardware? O con lo scooter?

Comportamento diverso sullo stesso periodo nelle stesse condizioni (stesso fornitore di dati)?

 
MakarFX:

Chi è il vostro broker?

Che terminale usi?

Qualcuno ha un terminale MT4 degli sviluppatori di MT4?