OnTick critical error when change broker
-
Hi, guys!
I've build an EA which works fine in most of forex brokers. I'm trying to run the same EA with a brazillian broker and local market. But only with these local brokers I've got the "Array out of range"error in the following segment :
MT5 Error

public: /* The main method */ virtual void _execute_() { // this is static for speed reasons bool next = false; string token = Symbol + IntegerToString(Period); int index = ArraySearch(tokens, token); if (index == -1) { index = ArraySize(tokens); ArrayResize(tokens, index + 1); ArrayResize(old_values, index + 1); ArrayResize(passes, index + 1); /*.This is the 685 line. The error happens right here on this line*/ tokens[index] = token; passes[index] = 0; old_values[index] = 0; } if (PassMaxTimes > 0) { CopyTime(Symbol, Period, 1, 1, time); datetime new_value = time[0]; if (new_value > old_values[index]) { passes[index]++; if (passes[index] >= PassMaxTimes) { old_values[index] = new_value; passes[index] = 0; } next = true; } }What can cause this error in one broker and not to others?
-
I don't know. It doesn't look like brokers' fault, but I wonder why a problem would happen in this block at this place. If you put Print(token) at this place, what will be printed in the logs? Or Print(index)