Hello everybody,

I am facing a problem to make Zorro trading in parallel (via MT4Bridges) on multiple accounts at the same time.

To point out the core problem : AT THE SAME TIME.

In my example, I connect one(1) Zorro to two(2) brokers via MT4 bridge: both demo accounts, FXpro and Roboforex.
All works great, Zorro handles the requested instruments, there is no problem to „fire and manage“ individual trades to a connected broker, enter, exit, managing stops, using TMF .. all good … but :

To have a trading system getting (nearly) the same results on different accounts, I am looking for entry and exit at nearly the same time … and here comes my problem, I am not able to tell Zorro to do that.

To have maximum „close controll“, I do not use TMF in this example. I use simple

enterLong()
enterShort()

exitLong()
exitShort()


commands. As I can understand the logic of Zorro by watching its behavior, it seems that Zorro is entering trade Nr.1 @Broker<A>, waits until all steps for this is done and booked, and then starts to work along trade Nr.2 @Broker<B>.
To proof that, I use (beside the Logs of both MT4 Terminals / Journal in Milliseconds ) the following code with some .txt logging addons:

algo("AB01");
asset(ASSET_A);

zeittext1 = strdate("%d.%m.%Y %a %H:%M",ldate(UTC,NOW) );
zeittext2 = strf("%06.3f",second(ldate(UTC,NOW)));
file_append("Data\\AAA-LOG\\Trades.txt",strf("\n%s:%s UTC |before sending enterLong() AA",zeittext1,zeittext2),0);

enterLong();

zeittext1 = strdate("%d.%m.%Y %a %H:%M",ldate(UTC,NOW) );
zeittext2 = strf("%06.3f",second(ldate(UTC,NOW)));
file_append("Data\\AAA-LOG\\Trades.txt",strf("\n%s:%s UTC |after sending enterLong() AA",zeittext1,zeittext2),0);


algo("AB01");
asset(ASSET_B);

zeittext1 = strdate("%d.%m.%Y %a %H:%M",ldate(UTC,NOW) );
zeittext2 = strf("%06.3f",second(ldate(UTC,NOW)));
file_append("Data\\AAA-LOG\\Trades.txt",strf("\n%s:%s UTC |before sending enterShort() BB",zeittext1,zeittext2),0);

enterShort();

zeittext1 = strdate("%d.%m.%Y %a %H:%M",ldate(UTC,NOW) );
zeittext2 = strf("%06.3f",second(ldate(UTC,NOW)));
file_append(„Data\\AAA-LOG\\Trades.txt",strf("\n%s:%s UTC |after sending enterShort() BB",zeittext1,zeittext2),0);



… and the same logic with exit commands…


The mouse-click-event triggering the actions has also been equipped with a timing log to file, similar to the enter/exit events.

The complete results look like this :

ZORRO:
05.05.2022 Thu 20:46:34.563 UTC |MouseClick ENTER command
05.05.2022 Thu 20:46:34.579 UTC |before sending enterLong() AA

// MT4 BrokerA opens trade
05.05.2022 Thu 20:46:34.784 UTC |after sending enterLong() AA
05.05.2022 Thu 20:46:34.790 UTC |before sending enterShort() BB

// MT4 BrokerA closes trade
05.05.2022 Thu 20:46:35.246 UTC |after sending enterShort() BB


05.05.2022 Thu 20:46:38.509 UTC |MouseClick EXIT command
05.05.2022 Thu 20:46:38.526 UTC |before sending exitLong() AA

// MT4 BrokerB opens trade
05.05.2022 Thu 20:46:38.798 UTC |after sending exitLong() AA
05.05.2022 Thu 20:46:38.804 UTC |before sending exitShort() BB

// MT4 BrokerB closes trade
05.05.2022 Thu 20:46:39.180 UTC |after sending exitShort() BB



…in addition to that, here the broker logs :

<MT4 Broker A>
2022.05.05 20:46:34.622 order buy market 0.01 EURUSD
2022.05.05 20:46:34.719 order was opened buy 0.01 EURUSD

2022.05.05 20:46:38.594 close order buy 0.01 EURUSD
2022.05.05 20:46:38.734 order buy 0.01 EURUSD closed




<MT4 Broker B>
2022.05.05 20:46:34.791 order sell market 0.01 EURUSD
2022.05.05 20:46:35.191 order was opened sell 0.01 EURUSD

2022.05.05 20:46:38.826 close order sell 0.01 EURUSD
2022.05.05 20:46:39.113 order sell 0.01 EURUSD closed




It is clearly visible that Zorro is waiting all the time, until brokerA operations is complete before going on to brokerB.
My desired behavior is, that the the ENTRY (and later EXIT) commands are sent to the brokers at the same time = both "leave" Zorro in parallel, not in sequence.
So both brokers would take care of their tasks to be done to have my trades booked into my accounts, there is no need that one broker is waiting until the other one is done.

But I am not able to generate the correct code for this in Zorro.
Maybe someone could give me an advise, how to use/produce better Zorro code to get rid of this problem above.


I also tried (maybe in the wrong way?):

1) to have TMF involved - hoping that the separated trade management would make have an „independent“ impact
…but no improvement

2) to manipulate Zorro by using the NOLOCK Flag : set(TICKS|LOGFILE,NOLOCK)
…but no improvement

3) to use (alltough shown in documentation its only for trade simulation)
Fill = 8;
…but no improvement

Is there a solution for that problem, what is my mistake ?

Regards
Hendrix