MT4 Init Script does not work for EAs with DLL Import

 

Hello,


I have the following situation:

1. Have an EA which loads DLLs

2. The DLL needs more extra DLLs

3. I have copied the EA Dll to the lib folder and the extra DLLs to the Meta Trader 4 Installation directory (I don't know another solution, otherwise it is not possible to load this dll)

4. Interactively the EA works like a charm. Executing it on a Chart works, all DLLs could be loaded.

5. I have created a Init-Startup Script:

; common settings
Profile=Nemesis 1
Login=...
Password=...
Server=...

; experts settings
ExpertsEnable=true
ExpertsDllImport=true
ExpertsExpImport=true
ExpertsTrades=true
 
; open chart and run expert and/or script
Symbol=DAX30
Period=M15
Expert=...
ExpertParameters=...


The "..." is filled with meaningfull text on my side.


If I run the it with C:> terminal.exe startup.ini:

1. MT4 starts

2. Opens the Chart

3. Executes the EA, prints that everything works fine in the log window

4. Executes the EA a second time??? But cannot be initialized because DLL could not be loaded. Exit.


Why that? Is there any solution for that? Maybe I have to copy the extra dlls somewhere else (inside lib folder it does not work). I need to do this because I want to reboot my VPS automatically and start everything on startup of the VPS. It is unacceptable that this doesn't work and makes really no sense that MT4 opens the script twice.


I have tried it with a naked empty EA, same situation the script is called twice. But this empty EA does not work with a external DLL so it works.


I hope someone has a solution for my problem. Thank you anyway!

Reason: