While loop in crashes when reopening MT4
I get a similar problem with this code, when the DLLs import option is disabled:
while(!IsDllsAllowed()) { Alert("You need to enable DLL imports in options!!!"); Sleep(10000); }
I hoped this kind of code would stop the indicator proceeding if the settings aren't right.. but it seems to crash it instead.
Ok thanks, I'll do it another way. It's a shame though.
Sleep(10000); //ignored
BTW, instead of
dis[0] = StringTrimRight("\ ");
the usual way is
dis[0] = "\\";
I get a similar problem with this code, when the DLLs import option is disabled:
I hoped this kind of code would stop the indicator proceeding if the settings aren't right.. but it seems to crash it instead.
That's what I will do but it felt more efficient to keep it out of the start function.
You should understand, that there is only one thread for indicators. You must proceed the init(), start() and deinit() in indicators as fast as possible, the thread can move to the next indicator only if the current method has finished.
In many of my indicators I record data in folders organised by brokers. I just 'improved' my code for getting the broker name. If I add the indicator, no problems. However, if I close and reopen Mt4, it crashes. Can't see the program, CPU 100%. If I delete the ex4 file, reopen Mt4, compile and add the indicator.. again no problems.
The code is in the Init function, but the problem still occurs if it's in the Start function.
Broker() function gets the broker's name and removes any awkward characters:
Any ideas? :S