The Start() function is invoked at every tick. It is not x seconds. It may be several times per second or less.
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
I am writing a DLL where I need to keep information between calls from MT4. As a result, I allocated Thread Local Storage (TLS) in DLL Main. In tester mode, the DLL functions properly. The TLS retains the information stored between calls. In real trading mode, however, the DLL can find the TLS (same TLS address between calls) but all of the saved information is gone (binary 0). Is there something different about how the Strategy Tester handles DLL calls and the normal trade platform?
While investigating this problem using the Visual Studio debugger, I see that MT4 (not Strategy Tester) does a Thread Attach and Detach at every tick. Why doesn't Strategy Tester exhibit the same behavior? How and why does it keep the Thread alive between ticks? It seems that the normal Trading Platform strategy of Attach/Detach is destroying my access to the TLS.
FYI, the DLL Thread Attach and Detach occurs at every tick even if the MT4 Expert does not call the DLL. Seems like unnecessary overhead.