array out of range in '_Test.mq4' (451,34)
In line 451,34 there is an exit outside the array.
See in , what's behind <=
for(int i = 1; 0 <= Bar_data_D1 [i][2] ;i++)
for(int i = 1; ;i++) { Print(" i = ",i," Bar_data_D1 [i][2] = ",Bar_data_D1 [i][2]); if( Bar_data_D1 [i][2] < Low_D1_Level) { Min_D_Level = Bar_data_D1 [i][2];break; } } //--- изначально было так
can you think of a better option? how to implement it?
CODE RETURNED : No error, no further array and no line redraw this day.
//--- Min_D_Leve for(int i = 1; i<ArrayRange(Bar_data_D1,0) ;i++) { Print(" i = ",i," Bar_data_D1 [i][2] = ",Bar_data_D1 [i][2]); if(Bar_data_D1 [i][2]>=0) { if( Bar_data_D1 [i][2] < Low_D1_Level) { Min_D_Level = Bar_data_D1 [i][2];break; } } }
2020.12.09 17:03:30.363 2016.12.16 00:00:00 _Test EURUSD,H1: i = 996 Bar_data_D1 [i][2] = 1.33147
2020.12.09 17:03:30.363 2016.12.16 00:00:00 _Test EURUSD,H1: i = 997 Bar_data_D1 [i][2] = 1.3426
2020.12.09 17:03:30.363 2016.12.16 00:00:00 _Test EURUSD,H1: i = 998 Bar_data_D1 [i][2] = 1.3364
2020.12.09 17:03:30.363 2016.12.16 00:00:00 _Test EURUSD,H1: i = 999 Bar_data_D1 [i][2] = 1.33562
2020.12.09 17:03:30.363 2016.12.16 00:00:00 _Test EURUSD,H1: i = 1000 Bar_data_D1 [i][2] = 1.33532
2020.12.09 17:03:30.363 2016.12.16 00:00:00 _Test EURUSD,H1: i = 1001 Bar_data_D1 [i][2] = 1.33705
the error may not be here. Without the code it is difficult to understand
the error may not be here. Without the code it's hard to understand
//--глобальные переменныеdouble Low_D1_Level;
double Bar_data_D1 [][6]; // Копирует в массив данные баров указанного графика и возвращает количество скопированных баров D1
//--- тело void On_Timer() { if(Day()!= Time_Day) { Level(); Time_Day = Day(); } } //+------------------------------------------------------------------+ //| Функция Level //+------------------------------------------------------------------+ void Level() ArrayCopyRates(Bar_data_D1,_Symbol,PERIOD_D1); // Копирует в массив данные баров указанного графика и возвращает Low_D1_Level = iLow (_Symbol,PERIOD_D1,1); // Возвращает значение минимальной цены бара D1 //--- Min_D_Leve for(int i = 1; 0 <= Bar_data_D1 [i][2] ;i++) { Print(" i = ",i," Bar_data_D1 [i][2] = ",Bar_data_D1 [i][2]); if( Bar_data_D1 [i][2] < Low_D1_Level) { Min_D_Level = Bar_data_D1 [i][2];break; } } //---
What else do you need?
- www.mql5.com
- www.mql5.com
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Greetings All ! Thank you all in advance !
Bug of this type:
There is a line Low_D1_Level relative to which we are looking in array Bar_data_D1 [][6]; new level Min_D_Level
//--- global variables
double_D1_Level;
double Bar_data_D1 [][6]; //copies bar data of the specified chart into the array and returns number of copied D1 bars
The first dimension of the array contains the number of bars. The second dimension has 6 elements with the values:
0 - time,
1 - open price,
2 - lowest price (low),
3 - highest price (high),
4 - close price (close),
5 - volume.
Print Print