Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by EternallyCurious. 04/18/24 10:45
StartWeek not working as it should
by Zheka. 04/18/24 10:11
folder management functions
by VoroneTZ. 04/17/24 06:52
lookback setting performance issue
by 7th_zorro. 04/16/24 03:08
zorro 64bit command line support
by 7th_zorro. 04/15/24 09:36
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:48
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:46
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
6 registered members (EternallyCurious, AndrewAMD, ricky_k, 7th_zorro, 2 invisible), 478 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
EternallyCurious, 11honza11, ccorrea, sakolin, rajesh7827
19046 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
Z12 duplicate trade ID ? #462074
09/06/16 20:51
09/06/16 20:51
Joined: Jul 2016
Posts: 93
Düsseldorf, Germany
M
mhdus Offline OP
Junior Member
mhdus  Offline OP
Junior Member
M

Joined: Jul 2016
Posts: 93
Düsseldorf, Germany
I noticed 2x2 duplicate trade IDs in the Z12 status page and apparently resulting wrong values for current price, risk, etc.:

Trade ID Lots Entry Time Entry Price Stop Trail Target Risk Profit Pips
[AUD/USD:NET:S1501] 3521501 3 29.08. 00:14 0.753 0.7685 1.0542 - - - - - - - - -8079$ -413$ -154.1p
[XAU/USD:NET:L5440] 3525440 1 29.08. 20:14 1323 1350 926 - - - - - - - - -3553$ 236$ 2643.2p
[XAG/USD:NET:S1212] 3531212 1 30.08. 16:14 18.655 20.07 26.12 - - - - - - - - -3359$ -638$ -142.3p
[GBP/USD:NET:L5090] 3545090 2 01.09. 12:09 1314 1350 0.9276 - - - - - - - - -23559869$ 319$ 177.7p
[EUR/USD:NET:L5089] 3545089 1 01.09. 20:09 1.1201 1.1252 0.7841 - - - - - - - - -3002$ 43$ 48.7p
[XAU/USD:NET:L5090] 3545090 1 01.09. 20:09 1314 1350 920 - - - - - - - - -3523$ 319$ 3572.0p
[EUR/USD:NET:L5995] 3545995 2 02.09. 00:09 1.12 1.1252 0.784 - - - - - - - - -6004$ 89$ 49.7p
[USD/CAD:NET:S5490] 3565490 1 02.09. 16:03 1.3431 1.3427 1.8203 - - - - - - - - -3293$ -2$ -2.7p
[USD/JPY:NET:S5122] 3555122 2 05.09. 12:03 103.27 102.07 144.58 - - - - - - - - -7174$ 209$ 120.1p
[GBP/USD:CY:L4238] 3564238 1 06.09. 14:37 1.3426 1.343 0.9399 - - - - - - - - -3612$ 1$ 1.2p
[EUR/USD:NET:L4898] 3564898 1 06.09. 16:20 1.1241 1.1252 0.7868 - - - - - - - - -3002$ 9$ 9.9p
[GBP/USD:NET:L5490] 3565490 1 06.09. 20:20 1.3429 1.3429 0.9401 - - - - - - - - -3583$ -2$ -2.1p
[USD/JPY:NET:S5492] 3565492 2 06.09. 20:20 102.01 102.07 142.82 - - - - - - - - -7114$ -11$ -6.3p
{AUD/USD:CY:s4502} 54502 3 29.08. 00:14 0.753 0.7684 0.7757 0.7303 - - - - -614$ -432$ -161.2p
...

In the MT4 Trade window both trades are having different and unique Order IDs (1st GBP/USD: 3542722, USD/CAD: 3550943).

Any ideas how this could have happened and/or how to diagnose further?
As far as I remember, I might have experienced a crash/reboot of my VPS, so maybe it relates to a buggy Z12.trd file. Any general recommendations how to recover from such a situation - without closing all trades and restarting completely fresh?

Last edited by mhdus; 09/06/16 21:46.
Re: Z12 duplicate trade ID ? [Re: mhdus] #462078
09/07/16 08:03
09/07/16 08:03
Joined: Jul 2000
Posts: 27,978
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,978
Frankfurt
Close all 4 trades in the MT4 console. The other trades may stay open. The positions will be automaticalle re-adjusted by Zorro when a trade with that asset is opened or closed the next time. - We had already a report by another user with the same issue, also after a VPS crash. We're currently checking what exactly happened and how it can be prevented.

Re: Z12 duplicate trade ID ? [Re: jcl] #462084
09/07/16 15:01
09/07/16 15:01
Joined: Apr 2016
Posts: 27
Frankfurt, Germany
M
MIGI Offline
Newbie
MIGI  Offline
Newbie
M

Joined: Apr 2016
Posts: 27
Frankfurt, Germany
In MT4 the MagicNumber can be used to prevent duplicate orders/positions.

Here is a piece of code that I use in my RangeTrader to find all orders/postions after a restart:

void Synchronize( int MagicNumber )
{
for ( int Count = OrdersTotal(); Count > 0; Count-- )
{
if ( OrderSelect( ( Count - 1 ), SELECT_BY_POS, MODE_TRADES ) != true ) continue;
if ( OrderSymbol() != Symbol() ) continue;
if ( OrderMagicNumber() != MagicNumber ) continue;

switch ( OrderType() )
{
case OP_BUY :
case OP_BUYLIMIT :
case OP_BUYSTOP : Trade.Long = OrderTicket();

break;

case OP_SELL :
case OP_SELLLIMIT:
case OP_SELLSTOP : Trade.Short = OrderTicket();

break;
}
}

LogTicket( Trade.Long, "Synchronize(Long)", ERR_NO_ERROR );
LogTicket( Trade.Short, "Synchronize(Short)", ERR_NO_ERROR );
}

Re: Z12 duplicate trade ID ? [Re: MIGI] #462222
09/14/16 14:06
09/14/16 14:06
Joined: Jul 2016
Posts: 93
Düsseldorf, Germany
M
mhdus Offline OP
Junior Member
mhdus  Offline OP
Junior Member
M

Joined: Jul 2016
Posts: 93
Düsseldorf, Germany
Again I have a duplicate Trade ID ... this time I'm sure there was no issue with the VPS. While it might be challenging to ultimately fix this it would be good to provide a way of automatically watching for such duplicates and throw an alarm once it happens.
(Otherwise Z12 is working quite well recently ...)

Re: Z12 duplicate trade ID ? [Re: mhdus] #462228
09/15/16 05:44
09/15/16 05:44
Joined: Jul 2000
Posts: 27,978
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,978
Frankfurt
Yes, we'll detect duplicate IDs in the next version, 1.52.

Re: Z12 duplicate trade ID ? [Re: jcl] #462253
09/16/16 20:08
09/16/16 20:08
Joined: Jul 2016
Posts: 93
Düsseldorf, Germany
M
mhdus Offline OP
Junior Member
mhdus  Offline OP
Junior Member
M

Joined: Jul 2016
Posts: 93
Düsseldorf, Germany
Had another one. Maybe the duplicates are somehow related to a partial close? See below.

In MT4 the GBP/USD position is dated 2016.09.15 09:07:48 and the US30 position is dated 2016.09.15 13:07:47. Time difference between broker's server and VPS is 2h: UTC vs. CEST (when starting the strategy Zorro reported !MT4 time zone shift -1 at UTC ... is this the reason why the time difference between the trade open timestamps in MT4 and Zorro is just 1h ?). I'm running Zorro S 1.46.3. Maybe this helps.

Friday 16.09.16 Profit +786$ ----
{GBP/USD:ES:s9934} Cover 6@1.3237: -122$ at 00:08
{GBP/USD:ES:l0337} Long 5@1.3237 Risk 1011$ .
[GBP/USD:NET:S0426] Cover 3@1.3237: +51.07 at 00:08
[GBP/USD:NET:S3806] Cover 4@1.3237: -147$ at 00:08
[GBP/USD:NET:S7488] Cover part 4@1.3237: +115$ at 00:08..................................................

[Fri 16.09.16 04:08] 14847 +3586 +799 !6/4...................................................................................
[Fri 16.09.16 08:08] 15038 +3586 +906 !6/4
{EUR/USD:HU:s0538} Short 4@1.1237 Risk 1221$ ts.
[EUR/USD:NET:S4320] Short 4@1.1237 Pool trade........................................................................................................................................

[Fri 16.09.16 12:08] 15218 +3586 +989 !8/3
{GBP/USD:ES:l0337} Sell 5@1.3174: -289$ at 12:08
{GBP/USD:ES:s0639} Short 6@1.3174 Risk 1197$ .
[GBP/USD:NET:S7675] Short 11@1.3174 Pool trade....................................................................................................................................


Trade ID Lots Entry Time Entry Price Stop Trail Target Risk Profit Pips
[EUR/USD:NET:S1108] 3581108 16 09.09. 00:08 1.1265 1.1157 1.5772 - - - - - - - - -64022$ 1547$ 108.9p
[XAU/USD:NET:L1513] 3581513 2 09.09. 04:08 1339 1309 937 - - - - - - - - -7130$ -536$ -3019.8p
[UK100:NET:S2557] 3582557 3 09.09. 08:08 6853 6720 9594 - - - - - - - - -9707$ 464$ 1311.8p
[EUR/USD:NET:S7579] 3587579 8 12.09. 00:08 1.1238 1.1157 1.5733 - - - - - - - - -32011$ 575$ 80.8p
[XAU/USD:NET:L8720] 3598720 2 13.09. 08:08 1331 1309 932 - - - - - - - - -7116$ -392$ -2203.4p
[SPX500:NET:L1317] 3611317 1 14.09. 16:08 2134 2137 1494 - - - - - - - - -14213$ 73$ 328.2p
[XAU/USD:NET:L1318] 3611318 2 14.09. 16:08 1324 1309 927 - - - - - - - - -7057$ -270$ -1518.7p
[AUD/USD:NET:L4900] 3614900 8 15.09. 04:08 0.7464 0.7489 0.5225 - - - - - - - - -15940$ 176$ 24.8p
[USD/JPY:NET:S4902] 3614902 4 15.09. 04:08 102.29 102.34 143.21 - - - - - - - - -14237$ -19$ -5.4p
[GBP/USD:NET:S7488] 3617488 2 15.09. 08:08 18066 18132 1.8502 - - - - - - - - +321737811$ 117$ 65.7p
[US30:NET:L7488] 3617488 2 15.09. 12:08 18066 18133 12646 - - - - - - - - -9640$ 117$ 658.4p

[EUR/USD:NET:S4320] 3624320 4 16.09. 08:08 1.1237 1.1157 1.5732 - - - - - - - - -16005$ 286$ 80.5p
[GBP/USD:NET:S7675] 3627675 11 16.09. 12:08 1.3174 1.3087 1.8443 - - - - - - - - -51637$ 842$ 86.0p
{EUR/USD:CY:s6804} 56804 4 08.09. 00:08 1.124 1.1157 1.1599 1.0882 - - - - -1280$ 292$ 82.0p

Re: Z12 duplicate trade ID ? [Re: mhdus] #462258
09/17/16 10:00
09/17/16 10:00
Joined: Jul 2000
Posts: 27,978
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,978
Frankfurt
Which of the two trades has the correct ID in the MT4 terminal? The GBP or the US30 trade?

Re: Z12 duplicate trade ID ? [Re: jcl] #462264
09/17/16 19:28
09/17/16 19:28
Joined: Jul 2016
Posts: 93
Düsseldorf, Germany
M
mhdus Offline OP
Junior Member
mhdus  Offline OP
Junior Member
M

Joined: Jul 2016
Posts: 93
Düsseldorf, Germany
the US30 trade had ID 3617488 (in the meantime I have closed both trades)

Re: Z12 duplicate trade ID ? [Re: mhdus] #462288
09/19/16 09:49
09/19/16 09:49
Joined: Jul 2000
Posts: 27,978
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,978
Frankfurt
Hmm, the trade ID normally changes when a trade is only partically closed, so that would be a hint why this happens - but it does not happen here when I test it. Maybe it is broker dependent. Which broker are you using?

Re: Z12 duplicate trade ID ? [Re: jcl] #462289
09/19/16 10:00
09/19/16 10:00
Joined: Jul 2016
Posts: 93
Düsseldorf, Germany
M
mhdus Offline OP
Junior Member
mhdus  Offline OP
Junior Member
M

Joined: Jul 2016
Posts: 93
Düsseldorf, Germany
I'm using IG here. But I will transition to FXCM soon to get Microlots and rid of the MT4 requirement. Nevertheless, I would be happy to support debugging if you let me know what additional data you need and how to capture. I had such duplicates now 3 times in less than 4 weeks trading Z12, so a "good" chance to capture another event soon...

Re: Z12 duplicate trade ID ? [Re: mhdus] #462290
09/19/16 11:04
09/19/16 11:04
Joined: Jul 2000
Posts: 27,978
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,978
Frankfurt
Thanks for the offer! We'll test it first with an IG account and since you got it this often, we should be able to reproduce it here. Otherwise we'll send you a special bridge version with some diagnostics output. Either way I think we'll find out soon what happened.

Re: Z12 duplicate trade ID ? [Re: jcl] #467441
08/02/17 20:34
08/02/17 20:34
Joined: Jul 2016
Posts: 93
Düsseldorf, Germany
M
mhdus Offline OP
Junior Member
mhdus  Offline OP
Junior Member
M

Joined: Jul 2016
Posts: 93
Düsseldorf, Germany
I still had these duplicates on a regular basis but not much time to further diagnose ... Now I restarted Z12 using a fresh 1.60.1 installation - and again duplicates after just a few days:

Trade ID Lots Entry Time Entry Price Stop Trail Target Risk Profit Pips
[AUD/USD:NET:L8864] 8078864 31 07-28 08:19 0.7968 0.7969 0.5578 - - - - - - - - -6334$ -0$ -0.1p
[EUR/USD:NET:L0742] 8090742 18 07-28 16:19 1.1747 1.1857 0.8223 - - - - - - - - -5402$ 166$ 108.1p
[NAS100:NET:L1665] 8131665 7 08-01 08:19 5914 5912 4140 - - - - - - - - -10508$ -19$ -31.9p
[NAS100:NET:L6937] 8136937 3 08-01 12:19 5900 5912 4130 - - - - - - - - -4499$ 27$ 107.6p
[GBP/USD:HP:S7153] 8157153 8 08-02 01:46 5943 5911 1.8481 - - - - - - - - +40243204$ -189$ -278.9p
[NAS100:NET:L7153] 8157153 7 08-02 04:19 5943 5912 4160 - - - - - - - - -10562$ -189$ -319.1p

[USD/CAD:HU:S0357] 8170357 19 08-02 15:26 1.2545 1.2562 1.7563 - - - - - - - - -6427$ -23$ -18.0p
[AUD/USD:NET:L1156] 8171156 32 08-02 16:19 0.7979 0.7968 0.5585 - - - - - - - - -6459$ -31$ -11.4p
[USD/CAD:NET:S1157] 8171157 31 08-02 16:19 1.2550 1.2562 1.7570 - - - - - - - - -10458$ -28$ -13.6p
{AUD/USD:CT:l9802} 69802 31 07-28 08:19 0.7968 0.7969 0.7706 0.8230 - - - - -697$ 2$ 0.6p
{EUR/USD:CY:l0004} 70004 18 07-28 16:19 1.1747 1.1857 1.1828 1.1886 - - - - +122$ 166$ 108.3p
{USD/CAD:CY:s0105} 70105 19 07-31 00:19 1.2481 1.2562 1.3003 1.1959 - - - - -681$ -109$ -83.9p
{GBP/USD:BB:s0606} 70606 36 07-31 20:19 1.3194 1.3226 1.3366 1.3022 - - - - -528$ -102$ -33.6p
{NAS100:VO:l0908} 70908 7 08-01 08:19 5914 5912 5828 6000 - - - - -516$ -20$ -33.2p
{NAS100:HU:l1009} 71009 3 08-01 12:19 5900 5912 5609 6191 - - - - -741$ 27$ 106.8p
{NAS100:VO:l1410} 71410 7 08-02 04:19 5943 5912 5856 6029 - - - - -516$ -189$ -320.0p
{GBP/USD:HP:l1611} 71611 28 08-02 12:19 1.3231 1.3226 1.2936 1.3526 - - - - -702$ -15$ -6.4p
{USD/CAD:HP:s1712} 71712 31 08-02 16:19 1.2550 1.2562 1.2881 1.2219 - - - - -695$ -31$ -14.8p
{AUD/USD:HP:l1713} 71713 32 08-02 16:19 0.7979 0.7969 0.7720 0.8238 - - - - -703$ -32$ -12.0p

In MT4, 8157153 is the NAS100 trade (0.07 long) while GBP/USD is 8155548 (0.08 short).

To summarize:
o MT4 statement
- GBP/USD 8155548 is only visible as an open trade, 0.08 short.
- NAS100 8157153 is only visible as an open trade, 0.07 long
o Zorro\Log\trades.csv
- HP,Short,GBP/USD,8157153,19,2017-08-02 01:46,2017-08-02 12:19,5942.60,5933.40,-38.31,0.00,Reverse
o Zorro\Log\Z12real.log
[...]
[Wed 17-08-02 00:19] 11598 +360 +378 //// 1.1801/1.18141.1800/1.1810
[...]
{GBP/USD:HP:l9701} Stop 27@1.32010: +277$ at 01:46:41
Entr 1.3080 Exit 1.3201 Spr 0.0001 Slp -0.20$ Rol 0.54$ Com 1.62$
Enter 27S GBP/USD Stop 0.4548 at 01:46:41.
[GBP/USD:HP:S5548] Short 27@1.32010 Pool trade at 01:46:41
Stop: 1.8481 Trail: 0.0000 TakeProfit: 0.0000
[...]
[Wed 17-08-02 04:19] 11686 +360 +465 //// 1.1810/1.18291.1794/1.1823
Enter 1L NAS100 Stop 86.2268 Trail 86.2268 at 04:19:01
{NAS100:VO:l1410} Long 7@5942.60 Risk 522$ ts at 04:19:01
Stop: 5856.3730 Trail: 6028.8271 TakeProfit: 0.0000
Enter 7L NAS100 Stop 0.4531 at 04:19:01.
[NAS100:NET:L7153] Long 7@5942.60 Pool trade at 04:19:01
Stop: 4159.8203 Trail: 0.0000 TakeProfit: 0.0000
[...]
[Wed 17-08-02 12:19] 11485 +360 +265 ////\ 1.1834/1.18681.1819/1.1829
[...]
[GBP/USD:HP:S7153] Cover % 19@1.32309: -38.31 at 12:19:01
Entr 5942.6001 Exit 5933.3999 Spr 0.0001 Slp 0.32$ Rol 0.00$ Com 0.48$

But I guess you need to see all the phantom trades, too?
I can provide Zorro's logs and an MT4 Detailed Statement for diagnosis, if needed... where to send it to?
I will even leave both trades open for now as I'd like this to be fixed as soon as possible.

Thanks.

Re: Z12 duplicate trade ID ? [Re: mhdus] #467450
08/03/17 09:18
08/03/17 09:18
Joined: Jul 2000
Posts: 27,978
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,978
Frankfurt
Please contact support(at)opgroup.de, they'll look into it.

Re: Z12 duplicate trade ID ? [Re: jcl] #467466
08/04/17 12:28
08/04/17 12:28
Joined: Jul 2016
Posts: 93
Düsseldorf, Germany
M
mhdus Offline OP
Junior Member
mhdus  Offline OP
Junior Member
M

Joined: Jul 2016
Posts: 93
Düsseldorf, Germany
Support quickly found the root cause in MT4 and already provided a modified version of the plugin supposed to work around the issue. I'm really impressed. Testing now ...

Re: Z12 duplicate trade ID ? [Re: mhdus] #467524
08/09/17 17:26
08/09/17 17:26
Joined: Jul 2016
Posts: 93
Düsseldorf, Germany
M
mhdus Offline OP
Junior Member
mhdus  Offline OP
Junior Member
M

Joined: Jul 2016
Posts: 93
Düsseldorf, Germany
So far no more duplicates. But now IG have a problem with all MT4 accounts, no trades can be opened for several instruments. IG support told me it would last for another few hours, at least. For some accounts even until tomorrow ... frown

Re: Z12 duplicate trade ID ? [Re: mhdus] #467547
08/11/17 17:43
08/11/17 17:43
Joined: Jul 2016
Posts: 93
Düsseldorf, Germany
M
mhdus Offline OP
Junior Member
mhdus  Offline OP
Junior Member
M

Joined: Jul 2016
Posts: 93
Düsseldorf, Germany
The problems @ IG were related to the transition to "Limited Risk" for all accounts by default. This is now completed (at least for my account) but leading to new serious issues for system traders, see this post..

Re: Z12 duplicate trade ID ? [Re: mhdus] #467612
08/16/17 22:05
08/16/17 22:05
Joined: Jul 2016
Posts: 93
Düsseldorf, Germany
M
mhdus Offline OP
Junior Member
mhdus  Offline OP
Junior Member
M

Joined: Jul 2016
Posts: 93
Düsseldorf, Germany
So far no more duplicates despite several partially closed trades. I assume the modified MT4 plugin will become part of the regular Zorro distribution? If yes, from which version onward?

Re: Z12 duplicate trade ID ? [Re: mhdus] #467649
08/18/17 17:13
08/18/17 17:13
Joined: Jul 2000
Posts: 27,978
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,978
Frankfurt
From 1.62 on. But it is already in the beta version and can also be download from the bugs list.

Page 1 of 2 1 2

Moderated by  Petra 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1