alladir: Hi all, I'm wondering if imports and includes are all done at the start of a file, or done when they are first needed?
Neither, they are used during compile time, and when the script is loaded the DLL is loaded if not already in memory.
WHRoeder:
Neither, they are used during compile time, and when the script is loaded the DLL is loaded if not already in memory.
Neither, they are used during compile time, and when the script is loaded the DLL is loaded if not already in memory.
Ah excellent,
As regards loading the DLL, does that mean the first time I run the script (after starting MT4 or after a reboot or something) will be slower than the next times? Could I run a dummy version of the same script to load up the dll before trading?
I know this is get a bit ridiculous now, I'm just curious.
WHRoeder:
Neither, they are used during compile time, and when the script is loaded the DLL is loaded if not already in memory.
Neither, they are used during compile time, and when the script is loaded the DLL is loaded if not already in memory.
This is not true, read the documentation :
To import functions during execution of an mql4 program, the so-called late binding is used. This means that, until the imported function is called, the corresponding module (ex4 or dll) will not be loaded.
Even better, so I can put as much rubbish as I want in the header and it won't slow the OrderSent at the start.. :]

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hi all, I'm wondering if imports and includes are all done at the start of a file, or done when they are first needed?
I have a script that places an immediate buy or sell order with OrderSend, then uses OrderModifty to add stops, and finally after the dust as settled, uses the imported functions to print all the useful figures to a .csv file (outside the metatrader 'files' folder). These functions are needed for the file writing but do the slow the order placement at all?
As mentioned in another post, the lots are calculated in accordance with my risk tolerance and stoploss settings and slippage throws these numbers off a bit, so if I can make the script faster.. great.
The head looks like this: