Gamestudio Links
Zorro Links
Newest Posts
Trading Journey
by howardR. 04/24/24 20:04
M1 Oversampling
by Petra. 04/24/24 10:34
Zorro FIX plugin - Experimental
by flink. 04/21/24 07:12
Data from CSV not parsed correctly
by EternallyCurious. 04/20/24 21:39
Scripts not found
by juergen_wue. 04/20/24 18:51
zorro 64bit command line support
by 7th_zorro. 04/20/24 10:06
StartWeek not working as it should
by jcl. 04/20/24 08:38
folder management functions
by VoroneTZ. 04/17/24 06:52
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (howardR, sleakz), 705 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Mega_Rod, EternallyCurious, howardR, 11honza11, ccorrea
19048 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 3 1 2 3
Corrupted Z12.trd? #483606
06/21/21 03:13
06/21/21 03:13
Joined: Jun 2013
Posts: 1,609
D
DdlV Offline OP
Serious User
DdlV  Offline OP
Serious User
D

Joined: Jun 2013
Posts: 1,609
Hi. Windows (Server 2016) wanted to do Updates, so today (Sunday) I clicked Stop, No to Close Trades, Yes to Stop Trading, exited Zorro, and did the Updates, including the reboot after.

Now Z12 will not Trade. It logs in to the broker, loads prices, prints "Trade: Z12 <date>" and then up pops the "Zorro Automaton has stopped working" window. I have also tried with "- diag", but no additional information is recorded.

The same VPS also runs Z7 (from a different directory) and it has restarted fine.

So, it seems the Z12.trd file has somehow been corrupted? How can I verify this and repair the trd file? Is there a trd utility somewhere?

Thanks.

Re: Corrupted Z12.trd? [Re: DdlV] #483608
06/21/21 08:20
06/21/21 08:20
Joined: Apr 2008
Posts: 586
Austria
Petra Offline
Support
Petra  Offline
Support

Joined: Apr 2008
Posts: 586
Austria
Maybe a virus?

If it were the .trd you would see an error message, what you had looked to me more like a broken zorro.exe or z12.x. Better reinstall it.

Re: Corrupted Z12.trd? [Re: DdlV] #483610
06/21/21 11:48
06/21/21 11:48
Joined: Jun 2013
Posts: 1,609
D
DdlV Offline OP
Serious User
DdlV  Offline OP
Serious User
D

Joined: Jun 2013
Posts: 1,609
Thanks Petra. Reinstall done. Unfortunately same crash.

Re: Corrupted Z12.trd? [Re: DdlV] #483611
06/21/21 12:29
06/21/21 12:29
Joined: Jun 2013
Posts: 1,609
D
DdlV Offline OP
Serious User
DdlV  Offline OP
Serious User
D

Joined: Jun 2013
Posts: 1,609
FYI: Reinstall above was done into existing directory. Have also now done fresh install into new directory and copied the trd file into it - same crash.

Re: Corrupted Z12.trd? [Re: DdlV] #483612
06/21/21 13:26
06/21/21 13:26
Joined: Jun 2013
Posts: 1,609
D
DdlV Offline OP
Serious User
DdlV  Offline OP
Serious User
D

Joined: Jun 2013
Posts: 1,609
I have also renamed the trd file and Traded Z12. A new trd file is created and Trade starts fine. The problem seems clearly to be the trd file has been corrupted. Is there any utility to examine and/or repair trd files? Or a manual way to examine/fix it?

Re: Corrupted Z12.trd? [Re: DdlV] #483614
06/22/21 05:57
06/22/21 05:57
Joined: Apr 2008
Posts: 586
Austria
Petra Offline
Support
Petra  Offline
Support

Joined: Apr 2008
Posts: 586
Austria
Its binary, so you cannot look into it easily, but you could load it with loadStatus and different SaveMode flags to check which parts of it are readable.

Re: Corrupted Z12.trd? [Re: DdlV] #483617
06/23/21 13:01
06/23/21 13:01
Joined: Jun 2013
Posts: 1,609
D
DdlV Offline OP
Serious User
DdlV  Offline OP
Serious User
D

Joined: Jun 2013
Posts: 1,609
Thanks Petra. I will see if that gives any clues. Do the SaveMode modes cover the entire contents of a trd file?

Re: Corrupted Z12.trd? [Re: DdlV] #483619
06/23/21 14:35
06/23/21 14:35
Joined: Jun 2013
Posts: 1,609
D
DdlV Offline OP
Serious User
DdlV  Offline OP
Serious User
D

Joined: Jun 2013
Posts: 1,609
Thanks again, Petra. loadStatus crashes trying to load the AlgoVars. Sliders and Trades seem OK.

Now, how can I fix the AlgoVars?!

Re: Corrupted Z12.trd? [Re: DdlV] #483627
06/24/21 10:23
06/24/21 10:23
Joined: Jul 2000
Posts: 27,982
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,982
Frankfurt
You could reset the SV_ALGOVARS flag. They will then not be loaded. But that would not work for Z12 where you have no code access. Delete the broken .trd file and close the trades manually.

Re: Corrupted Z12.trd? [Re: DdlV] #483628
06/24/21 12:11
06/24/21 12:11
Joined: Jun 2013
Posts: 1,609
D
DdlV Offline OP
Serious User
DdlV  Offline OP
Serious User
D

Joined: Jun 2013
Posts: 1,609
Thanks @jcl.

Would the code below work? It creates a MUCH smaller trd...

Code
function run()
{
  if(Bar >= 1) {
    SaveMode = SV_SLIDERS+SV_TRADES;
    loadStatus("/home/user/QubesIncoming/a-personal/Z12.trd");
    saveStatus("/home/user/QubesIncoming/a-personal/Z12-Fixed.trd");
    quit();
  }
}


Re: Corrupted Z12.trd? [Re: DdlV] #483675
07/07/21 13:38
07/07/21 13:38
Joined: Jun 2013
Posts: 1,609
D
DdlV Offline OP
Serious User
DdlV  Offline OP
Serious User
D

Joined: Jun 2013
Posts: 1,609
@jcl: Would appreciate your thoughts before I try using the post-surgery trd. 116k went to 12k. Is this expected? 90% of a trd is the algovars?

Thanks.

Re: Corrupted Z12.trd? [Re: DdlV] #483682
07/08/21 11:11
07/08/21 11:11
Joined: Jul 2000
Posts: 27,982
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,982
Frankfurt
I estimate for algovars a size of about 1 kb multiplied with the numbers of algos and assets.

Re: Corrupted Z12.trd? [Re: DdlV] #483685
07/08/21 17:38
07/08/21 17:38
Joined: Jun 2013
Posts: 1,609
D
DdlV Offline OP
Serious User
DdlV  Offline OP
Serious User
D

Joined: Jun 2013
Posts: 1,609
Thanks @jcl. That puts the size reduction is in the same ballpark, so I'll give the tiny trd a try.

FYI, I save a copy of the trd file most every weekend. I tested starting Zorro (in a test environment, not live) with these backups, and had to go back a number of weeks to find an un-corrupted trd. Zorro ran continuously over that period, and the weekly trd files have different sizes. Since Zorro was never stopped and restarted, the trd file was apparently never read - only written to. Unfortunately, especially given the passage of time, I have no hope of correlating the corruption to anything else. But from these circumstances a reasonable suspicion could be a rare pointer/buffer problem in Zorro?

HTH.

Re: Corrupted Z12.trd? [Re: DdlV] #483688
07/09/21 01:26
07/09/21 01:26
Joined: Jun 2013
Posts: 1,609
D
DdlV Offline OP
Serious User
DdlV  Offline OP
Serious User
D

Joined: Jun 2013
Posts: 1,609
@jcl: The saga continues. The tiny trd allowed Z12 to start. But:

a) Intermingled with the "resumed" messages were a number of "closed" messages. The "closed" messages were all for real trades, and all exactly 1 lot. Is this expected?

b) After the "resumed" messages came a slew of Trails, Stops, and Longs. I assume this is normal as Z12 adjusts to the new market conditions it finds? (Although without the benefit of the missing AlgoVars...)

c) Lastly, the net result of the above seems to be that the account balance being reported by Zorro is accurate, the number of open trades matches the number of open positions in the broker's web interface, but Zorro's view of the value of these open positions, including which are winning vs. losing, is incorrect. Is anything to be done?

FYI, the trd file has grown from 12k to 57k.

Thanks.

Re: Corrupted Z12.trd? [Re: DdlV] #483691
07/10/21 15:20
07/10/21 15:20
Joined: Apr 2008
Posts: 586
Austria
Petra Offline
Support
Petra  Offline
Support

Joined: Apr 2008
Posts: 586
Austria
Closed means that the trade was not open anymore. You probably closed it?

Open value includes swaps and commissions, so it can differ.

Re: Corrupted Z12.trd? [Re: DdlV] #483692
07/10/21 18:40
07/10/21 18:40
Joined: Jun 2013
Posts: 1,609
D
DdlV Offline OP
Serious User
DdlV  Offline OP
Serious User
D

Joined: Jun 2013
Posts: 1,609
Thanks @Petra.

- No, I didn't close anything. Wanted to keep everything unchanged on the hope the trd could be fixed. Also very suspicious that in every case exactly 1 lot was closed - no trades of 1 lot were ever opened.

- Open value is ~1/2 what the broker shows, even though balance is the same. Swap & commission could account for that?

Re: Corrupted Z12.trd? [Re: DdlV] #483693
07/11/21 06:40
07/11/21 06:40
Joined: Apr 2008
Posts: 586
Austria
Petra Offline
Support
Petra  Offline
Support

Joined: Apr 2008
Posts: 586
Austria
There can be 1000 reasons of differences, hard to tell with so vague information. Compare the different trade in the platform trade list with the same trade on the trade status page. There you can see all parameters of the trade and calculate the open value yourself.

Re: Corrupted Z12.trd? [Re: DdlV] #483694
07/11/21 12:58
07/11/21 12:58
Joined: Jun 2013
Posts: 1,609
D
DdlV Offline OP
Serious User
DdlV  Offline OP
Serious User
D

Joined: Jun 2013
Posts: 1,609
Thanks @Petra. Yes, I am aware of that process, and a full investigation would also include the trades done when Zorro "reconciled" to the new world it found after being disconnected for many days...

Before embarking on that, I was hoping @jcl or someone who knows the internals of Zorro and trd processing could add insight into why _exactly_ 1 lot closes during resume, and why the open value might have gone off (while balance is correct).

Re: Corrupted Z12.trd? [Re: DdlV] #483705
07/14/21 07:57
07/14/21 07:57
Joined: Jul 2000
Posts: 27,982
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,982
Frankfurt
Hmm, how am I supposed to know your trade sizes and open values? If you want, you can get a support ticket and send them the log, trd file, and trade status page. They will look through all and explain the open value and why 1 lot was closed. I don't think Zorro internals are needed.

Re: Corrupted Z12.trd? [Re: DdlV] #483707
07/14/21 13:29
07/14/21 13:29
Joined: Jun 2013
Posts: 1,609
D
DdlV Offline OP
Serious User
DdlV  Offline OP
Serious User
D

Joined: Jun 2013
Posts: 1,609
Thanks @jcl. Clearly you are not supposed to know what you can't. The question was explicitly if what you DO know (Zorro internals) could shed some light as to why on restart with AlgoVars removed:

- Zorro would at startup time of trades resume enter only multiple close orders across all Assets of exactly 1 lot - is 1 lot some sort of default or fall-back?

- Zorro would "lose its mind" and not know the correct values of open trades, while reporting correct account balance.

Thanks.

Re: Corrupted Z12.trd? [Re: DdlV] #483712
07/14/21 18:21
07/14/21 18:21
Joined: Jul 2000
Posts: 27,982
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,982
Frankfurt
No, 1 lot is not a fallback. It's really the stored trade size.

The open value is simply the difference of current price and open price multiplied with the number of contracts.

Re: Corrupted Z12.trd? [Re: DdlV] #483713
07/15/21 01:22
07/15/21 01:22
Joined: Jun 2013
Posts: 1,609
D
DdlV Offline OP
Serious User
DdlV  Offline OP
Serious User
D

Joined: Jun 2013
Posts: 1,609
Thanks @jcl. Well, I now know what happened. I made a mistake (no surprise there frown ), Zorro's message of closing 1 lot is in error and misdirected the investigation, and I would appreciate your help in how best to proceed.

Mistake: After determining I could successfully create a trd with the AlgoVars removed, in my exuberance I didn't double-check close enough and converted an old trd. Consequently, when Z12 finally was able to start, it was presented with an old trade list.

Message: Z12 startup resumed all the virtual trades and checked the real trades against the broker. Real trades found were resumed. Real trades not found were correctly listed as closed - but rather than printing the lots of those Real trades, Zorro printed "1", which I believe is a bug.

Help: Zorro is now running with a list of virtual trades that no longer match reality, since it's lost the intelligence of what happened to those trades in the interim. What to do? I suspect the response will be to close all trades in the broker interface and let Z12 start over; but are there any other choices to consider?

Thanks.

Re: Corrupted Z12.trd? [Re: DdlV] #483715
07/15/21 11:44
07/15/21 11:44
Joined: Jun 2013
Posts: 1,609
D
DdlV Offline OP
Serious User
DdlV  Offline OP
Serious User
D

Joined: Jun 2013
Posts: 1,609
Hmmm... Or is Open Value not used in determining exit and I should just let the positions ride and all will become right over time?

Or are the Stops based on the (incorrect) opening prices and something needs to be done?

Re: Corrupted Z12.trd? [Re: DdlV] #483716
07/15/21 13:58
07/15/21 13:58
Joined: Jul 2000
Posts: 27,982
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,982
Frankfurt
When it's really messed up, I would close all open trades and restart. A wrong .trd file can have all sorts of wrong stops or other parameters.

Normally .trd files should not go corrupted. The only scenario I can imagine is a hard server crash just at the moment when the .trd file is written.


Re: Corrupted Z12.trd? [Re: DdlV] #483717
07/15/21 18:51
07/15/21 18:51
Joined: Jun 2013
Posts: 1,609
D
DdlV Offline OP
Serious User
DdlV  Offline OP
Serious User
D

Joined: Jun 2013
Posts: 1,609
Thanks @jcl. Please clarify - I see 2 scenarios:

1) In the Broker platform, close all trades. Zorro retains its virtual trades, and will re-enter real NET trades to match.

2) Click Stop, Close all Trades, and Stop Trading. In the Broker platform, verify all trades are gone - if any remain, close them. Delete the trd. When Zorro restarts, it will create a new, empty trd and restart completely fresh with no trades - virtual or real - resumed.

Which scenario did you mean?

Re: Corrupted Z12.trd? [Re: DdlV] #483738
07/19/21 14:51
07/19/21 14:51
Joined: Jul 2000
Posts: 27,982
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,982
Frankfurt
2.

Re: Corrupted Z12.trd? [Re: DdlV] #485277
02/15/22 18:31
02/15/22 18:31
Joined: Oct 2021
Posts: 10
Z
ztests Offline
Newbie
ztests  Offline
Newbie
Z

Joined: Oct 2021
Posts: 10
I have been trading live on Interactive Brokers with Zorro.

Unfortunately, my laptop crashed and burned - nearly to ashes...

Obviously, the open lives trades stated on the IB platform - is it possible somehow to re-reconnect those trades with Zorro again so that Zorro continues to manage them?

I see in the documentation a function

brokerTrades (int Filter): int,
Call the GET_TRADES command. Cancel all currently open trades, and replace them with the open positions on the broker account (if any).
https://manual.zorro-project.com/brokercommand.htm

Could this function be helpful in re-creating the .trd file?

Maybe there is an example script somewhere for this task?

Re: Corrupted Z12.trd? [Re: DdlV] #485278
02/16/22 10:44
02/16/22 10:44
Joined: Jul 2000
Posts: 27,982
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,982
Frankfurt
brokerTrades will not recreate the original trades from the .trd, but create new ones. Theoretically a .trd can be constructed from that, but that's a forensic task and probably not worth the effort. Close the open positions and start over.

Re: Corrupted Z12.trd? [Re: jcl] #485279
02/16/22 11:04
02/16/22 11:04
Joined: Oct 2021
Posts: 10
Z
ztests Offline
Newbie
ztests  Offline
Newbie
Z

Joined: Oct 2021
Posts: 10
Originally Posted by jcl
brokerTrades will not recreate the original trades from the .trd, but create new ones. Theoretically a .trd can be constructed from that, but that's a forensic task and probably not worth the effort. Close the open positions and start over.


JCL - thank you!

Page 1 of 3 1 2 3

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