Hi, I have an Expert Advisor that calls an API, which executes trades on a Binary Options broker.
My problem is that now I need the EA to call the API multiple times simultaneously (to place trades on friends accounts).
The Call takes about half second to execute, so if I put them under under each other the bottom ones get delayed.
So what I need is to execute all API calls asynchronously. Please see example below, I need Call1, Call2 and Call3 all executed at the same time, or at least as close as possible.
Can someone please point me to the right direction and give me a code example and/or step-by-step instructions of how to achieve this?
This is rather urgent.
-------------------------------------------------------------
#property strict
#include <[login to view URL]>
void OnStart()
{
string response = CallBinary(1);
//Call 1
InitBinary("testapi1", USD, "frxEURCHF", 5, m);
response = CallBinary(1);
//Call 2
InitBinary("testapi2", USD, "frxEURCHF", 5, m);
response = CallBinary(1);
//Call 3
InitBinary("testapi3", USD, "frxEURCHF", 5, m);
response = CallBinary(1);
Sleep(5000);
}
You need multithread. It is may be possible if you will have 1 main expert and many slave experts. Main expert will set global variable, slave experts will send command to accounts, using signals from global variables. If it will not work, becouse I not sure MT4 make separate thread for each expert. you can use many MT4 terminals, each one for 1 BO account. Also you can use external application written on C++ for example. In this application you can create many threads. 1 thread for 1 account. This application can get signal from MT4 and transfer to BO accounts. It is possible if you have DLL for work with BO accounts. C++ application can use functions from DLL.