Gamestudio Links
Zorro Links
Newest Posts
parameters of the plotDay function
by danatrader. 08/04/20 23:58
A9
by Dooley. 08/04/20 22:32
New Zorro version 2.30
by Zheka. 08/04/20 14:23
Why gamestudio USE Lite_C
by Superku. 08/04/20 14:13
script CurrencyStrength
by jcl. 08/03/20 14:01
Moving Panels together
by Aku_Aku. 08/03/20 12:22
Price clusters
by jcl. 08/03/20 10:04
AUM Magazine
Latest Screens
The Space Between
Pogostuck: Rage With Your Friends
Worst Case Z
AckCon'18 - Lotter vs the World 2 - Preview Release
Who's Online Now
8 registered members (TianYu, Amanda_Dearheart, Superku, danatrader, AndrewAMD, kalmar, Dooley, 1 invisible), 466 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
tzw101, Al82, Alibert, jsch, daan
18488 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
MT4 Bridge Magic and comments with multiple scripts + Z12 #464421
02/12/17 11:03
02/12/17 11:03
Joined: Nov 2016
Posts: 103
NSW
V
vinsom Offline OP
Member
vinsom  Offline OP
Member
V

Joined: Nov 2016
Posts: 103
NSW
I have several Zorro scripts + Z12 running on the same account.
I'm trying to set up different magic numbers for each script and different comment for each algos.
At the moment all magics and comments get messed up as mt4 global variables are overwritten by other scripts before the OrderSend happen.
I haven't found any way to let this work properly.
There are the issues I found:

- All strategies get a hardcoded magic when no other magic is set with command SET_MAGIC
- The SET_ORDERTEXT and SET_MAGIC are called at different time from the OrderSend call, therefore other scripts override the global variables where magic and comment are saved, and all magics and comments are messed up.
- I coded a queue, so that all custom strategies would wait for the previous one to set the magic and comment and call OrderSend before allowing another OrderSend to happen, but wouldn't work for Z12 as I can't change the code to let her wait.
- There is no way to add a parameter to identify the caller for the enterLong/enterShort to build a communication channel.

Having several Zorro scripts + Z12 running on the same account , is very important for me to distinguish the trades between the different strategies running.
At the moment is impossible for me to do this.
And the Zorro stats are reset at each restart, so they are pretty much useless in case you need to restart strategies from times to times.

Does anyone has any better idea on how to achieve this ?

Thanks
Vincenzo

Re: MT4 Bridge Magic and comments with multiple scripts + Z12 [Re: vinsom] #464447
02/14/17 16:59
02/14/17 16:59
Joined: Jul 2000
Posts: 27,298
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,298
Frankfurt
We got complaints of this already from another user, so we'll probably implement something in the bridge for connecting order text and magic to a certain order.

Until then, you can solve this by implementing a simple handshake. Edit the Zorro EA and add a new brokerCommand that just sets and reads a global variable. Before setting the order parameters, read that variable and wait until it is zero. Then set it to nonzero, set your parameters, call the buy command, and set it back to zero.

Re: MT4 Bridge Magic and comments with multiple scripts + Z12 [Re: jcl] #478896
01/08/20 12:14
01/08/20 12:14
Joined: Dec 2019
Posts: 4
Netherlands
D
DavidB1969 Offline
Guest
DavidB1969  Offline
Guest
D

Joined: Dec 2019
Posts: 4
Netherlands
Originally Posted by jcl
We got complaints of this already from another user, so we'll probably implement something in the bridge for connecting order text and magic to a certain order.


What is the current status of the proposed fix?

David

Re: MT4 Bridge Magic and comments with multiple scripts + Z12 [Re: vinsom] #478898
01/08/20 17:32
01/08/20 17:32
Joined: Jul 2000
Posts: 27,298
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,298
Frankfurt
That was 3 years ago. I don't recall the state of things so far back, but you can find all about connecting comments to orders in the manual.

Re: MT4 Bridge Magic and comments with multiple scripts + Z12 [Re: vinsom] #478903
01/09/20 16:44
01/09/20 16:44
Joined: Dec 2019
Posts: 4
Netherlands
D
DavidB1969 Offline
Guest
DavidB1969  Offline
Guest
D

Joined: Dec 2019
Posts: 4
Netherlands
Thanks for your prompt reply. I guess this hasn't been picked up yet since I experience occasional mix ups of order, magic# and comment.
I will try to solve it with a workaround in the bridge EA as per your suggestion. And I'll add a request to the future features.

Re: MT4 Bridge Magic and comments with multiple scripts + Z12 [Re: vinsom] #478909
01/10/20 13:27
01/10/20 13:27
Joined: Jul 2000
Posts: 27,298
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,298
Frankfurt
What exactly is the problem? Comment and magic are stored for the next trade. You can set a lock for not getting interrupted. There should be no mixup.

https://manual.zorro-project.com/lock.htm

Re: MT4 Bridge Magic and comments with multiple scripts + Z12 [Re: vinsom] #478913
01/11/20 14:12
01/11/20 14:12
Joined: Jan 2020
Posts: 7
Haarlem
M
matchristrading Offline
Newbie
matchristrading  Offline
Newbie
M

Joined: Jan 2020
Posts: 7
Haarlem
I too experience a mixup of magic number and ordercomment. I have 5 Zorro strategies running. They all trade on one MT4 instance. I would like to give the all trades of one strategy the same magic number and comment, so I can distinguish in MT4 which trades belong to which strategy. But the magic number and ordercomment get mixed up. In the file attachments you can see that the same magic number is related with two different ordercomments. That should not be the case. One of the combinations is the correct one, as you can see in the code of the Zorro strategy.
In the two attachments that show some trades, you can seen that the comment "xsgap" in one trade is associated with magic number 100 and in another trade is associated with magic number 500. The third attachment shows the two lines of code in the strategy "xsgap". There you can see that the magic number of all trades of this strategy should be 500. The combination of comment "xsgap" and magic number 100 should not occur. I do not run a strategy that in his code combines comment "xsgap" with magic number 100. So there is a mixup of comments and magic numbers form different strategies into one trade that should not occur.

Attached Files Schermafdruk van 2020-01-11 15-05-02.png
Last edited by matchristrading; 01/11/20 18:06.
Re: MT4 Bridge Magic and comments with multiple scripts + Z12 [Re: vinsom] #478915
01/12/20 08:26
01/12/20 08:26
Joined: Apr 2008
Posts: 312
Austria
Petra Offline
Support
Petra  Offline
Support

Joined: Apr 2008
Posts: 312
Austria
If you cant solve that on your own you have always the option to get help from zorro support.

Re: MT4 Bridge Magic and comments with multiple scripts + Z12 [Re: Petra] #478921
01/14/20 06:23
01/14/20 06:23
Joined: Jan 2020
Posts: 7
Haarlem
M
matchristrading Offline
Newbie
matchristrading  Offline
Newbie
M

Joined: Jan 2020
Posts: 7
Haarlem
Thanks a lot for the hint to the lock statement. I think that will give the solution!!! Either the general lock or the lock as an option in the brokerCommand statement

Re: MT4 Bridge Magic and comments with multiple scripts + Z12 [Re: vinsom] #478928
01/17/20 14:29
01/17/20 14:29
Joined: Dec 2019
Posts: 4
Netherlands
D
DavidB1969 Offline
Guest
DavidB1969  Offline
Guest
D

Joined: Dec 2019
Posts: 4
Netherlands
I added the brokerCommand(SET_LOCK,1) / brokerCommand(SET_LOCK,0) statements and tested it succesfully with 7 parallel Zorro instances coupled to a single MT4 instance. It works very well. Thank you so much for your support!


Moderated by  Petra 

Powered by UBB.threads™ PHP Forum Software 7.7.1