Incorrect profit for NET trades (1.26)

Posted By: GPEngine

Incorrect profit for NET trades (1.26) - 02/10/15 04:41

Please look at the attached log file which I produced by [Trade]ing a strategy for several days. The strategy uses several assets and algos, and has Hedge = 4. The surprising parts are that trades are immediately exited at the same price as the entry, and the associated profit is exactly 1 or 3 thousand dollars.
Code:
...
[USD/JPY:NET:S8266] Short 1@119.07 Net trade at 23:00
[USD/JPY:NET:S0001] Cover 1@119.07: +1000$ at 23:00
...
[USD/JPY:NET:S7637] Short 3@118.66 Net trade at 09:25
[USD/JPY:NET:S0001] Cover 3@118.66: +3000$ at 09:25
...


Currently the Result Window reports numbers like "49191 +7073 +20 ////\\" but I believe $7000 of the Money earned, "+7073", is not correct. If it were correct, the Current equity in the demo account would be closer to 56000. Also attached screenshot.

What's going on here?

Attached picture NET_bug.png
Posted By: GPEngine

Re: Incorrect profit for NET trades (1.26) - 02/10/15 04:43

attached log

Attached File
white1440demo.log.txt  (4 downloads)
Posted By: boatman

Re: Incorrect profit for NET trades (1.26) - 02/10/15 04:59

I can report similar behavior after manually closing a trade opened by Zorro or otherwise manually trading on the account on which Zorro is operating.

I don't have the log files to back it up, but it has happened at least twice in 2015.
Posted By: GPEngine

Re: Incorrect profit for NET trades (1.26) - 02/10/15 08:11

Interesting. Thanks. Let me look in that direction.

I manually closed a position or two in January after I changed the strategy I was testing. I have not opened or closed any trades manually since starting the current session of [Trade], meaning the beginning of the attached log.

I checked the all-time report generated by the FXCM client application. I did find one surprising thing. There are 3 open USD/JPY positions, 2 open EUR/JPY positions, and open 2 CAD/JPY positions. I guess FXCM Demo accounts don't enforce NFA Compliance Rule 2-43(b)? Either way, Zorro shouldn't be able to get the account into this state, as I have set(NFA) and Hedge=4.
AUD/JPY 5,000 2/9/15 4:25 AM
AUD/NZD 20,000 2/8/15 6:00 PM
CAD/JPY 18,000 2/8/15 6:00 PM
CAD/JPY 7,000 2/6/15 4:25 AM
EUR/JPY 1,000 2/3/15 4:25 AM
EUR/JPY 2,000 2/4/15 4:25 AM
GBP/JPY 4,000 2/9/15 4:25 AM
NZD/JPY 16,000 1/27/15 4:25 AM
USD/JPY 1,000 2/8/15 6:00 PM
USD/JPY 2,000 2/8/15 6:00 PM
USD/JPY 3,000 2/9/15 4:25 AM

Is it possible that this Zorro instance has become confused about the open positions in the account? Is there a way to force a re-sync? Or is there a way to list the valid ones associated with this running strategy so that I may close the rogue ones manually?

By the way, http://zorro-trader.com/manual/en/heding.htm is an outdated page that should be deleted. The NFA page links to it in error.
Posted By: jcl

Re: Incorrect profit for NET trades (1.26) - 02/10/15 08:42

I can not see what problem you have with the open positions, but there is indeed a problem with the two closed positions. Can you check the two trades that had a wrong closing message - ID ending with 8266 and 7637? When and at which price were they really closed?
Posted By: GPEngine

Re: Incorrect profit for NET trades (1.26) - 02/10/15 08:54

Perhaps I do not know how to read this report.
There is a section of Combined Account Statement called OPEN/FLOATING POSITIONS
IDs 115798266 and 115827637 appear in it. So they are open, not closed.

Ticket # Symbol Volume Date Sold Bought Floating P/L Comm Dividends Rollover Net P/L Condition

115798266 USD/JPY 1,000 2/8/15 6:00 PM 119.059 2.75 -0.04 0.00 -0.03 2.68 Mkt
2/10/15 3:49 AM 118.733

115827637 USD/JPY 3,000 2/9/15 4:25 AM 118.656 -1.95 -0.12 0.00 -0.08 -2.15 Mkt
2/10/15 3:49 AM 118.733

Posted By: GPEngine

Re: Incorrect profit for NET trades (1.26) - 02/10/15 08:59

Code:
OPEN/FLOATING POSITIONS   
Ticket # Symbol Volume Date Sold Bought Floating P/L Comm Dividends Rollover Net P/L Condition
114952070 NZD/JPY 16,000 1/27/15 4:25 AM 87.891   -33.96 -0.96 0.00 -27.19 -62.11 Mkt
115556725 EUR/JPY 2,000 2/4/15 4:25 AM 134.528   1.68 -0.08 0.00 0.01 1.61 Mkt
115742327 CAD/JPY 7,000 2/6/15 4:25 AM   94.258 49.35 -0.42 0.00 0.24 49.17 Mkt
115798257 AUD/NZD 20,000 2/8/15 6:00 PM   1.05685 -88.20 -1.20 0.00 -0.84 -90.24 Mkt
115798259 CAD/JPY 18,000 2/8/15 6:00 PM   95.096 -0.15 -1.08 0.00 0.43 -0.80 Mkt
115798266 USD/JPY 1,000 2/8/15 6:00 PM 119.059   2.75 -0.04 0.00 -0.03 2.68 Mkt
115798383 EUR/JPY 1,000 2/3/15 4:25 AM 132.988   -12.13 -0.04 0.00 0.00 -12.17 Mkt
115827632 AUD/JPY 5,000 2/9/15 4:25 AM   92.408 9.14 -0.30 0.00 0.34 9.18 Mkt
115827634 GBP/JPY 4,000 2/9/15 4:25 AM 180.750   -7.38 -0.16 0.00 -0.29 -7.83 Mkt
115827637 USD/JPY 3,000 2/9/15 4:25 AM 118.656   -1.95 -0.12 0.00 -0.08 -2.15 Mkt
115827744 USD/JPY 2,000 2/8/15 6:00 PM 119.065   5.59 -0.08 0.00 -0.05 5.46 Mkt

Posted By: jcl

Re: Incorrect profit for NET trades (1.26) - 02/10/15 09:28

Ok, so the "Cover" message was definitely wrong - not only wrong profit, the position was not closed at all. The cover message also had an imaginary id of 0001.

Can you post the script? You can also send it to Support when you don't want it public. We'll look into it. Due to the wrong message, the displayed accumulated profit is likewise wrong.

Update: I believe we found the problem. It was indeed related to the NFA flag. We'll upload a new version, 1.28.1, to the beta forum in the next days. Please continue with that version. And check if you really have an NFA account: if you can manually open a short and long position at the same time, it is not NFA.
Posted By: GPEngine

Re: Incorrect profit for NET trades (1.26) - 02/11/15 06:10

I cannot share the Strategy. All I can say is that it is similar to Workshop 6.

Let's see if this helps anyway.
Since it was time to do system updates on the VPS anyway, I pressed Stop & clicked no for close all trades. and rebooted. When I pressed [Trade] again on the same Strategy, Zorro crashed at start-up. The error reporting dialog had this body. The crash is reproducible.
Code:
Problem signature:
  Problem Event Name: APPCRASH
  Application Name: Zorro.exe
  Application Version:  1.2.4.5
  Application Timestamp:  5418366c
  Fault Module Name:  Zorro.exe
  Fault Module Version: 1.2.4.5
  Fault Module Timestamp: 5418366c
  Exception Code: c0000005
  Exception Offset: 00123031
  OS Version: 6.3.9600.2.0.0.272.7
  Locale ID:  1033
  Additional Information 1: 5861
  Additional Information 2: 5861822e1919d7c014bbb064c64908b2
  Additional Information 3: a10f
  Additional Information 4: a10ff7d2bb2516fdc753f9c34fc3b069


log file has only this.
Quote:
Trade: white1440 portfolio (NFA) 10.02.2015
Trade 0 not found
Trade 1 not found
Trade 2 not found
Trade 3 not found
CNTR0011 Trade 4 not found
Trade 5 not found
Trade 6 not found
Trade 7 not found
Trade 8 not found
Trade 9 not found
Trade 10 not found
Trade 11 not found
AUD/JPY Trade 12 not found

I held on to the previous log file as well.

To possibly help you further, I created a new demo account and began the same strategy again on it. Obviously there are no open positions in this one. I will let you know if Zorro gets confused again. My working theory is that there were some leftover trades in the account when I started this session. And, Zorro was unable to detect and recover from this broken state.
Posted By: GPEngine

Re: Incorrect profit for NET trades (1.26) - 02/11/15 06:45

Oops i did not see your in-place update.

This FXCM demo account has NFA compliance. I just tried your instructions. In FXCM Trading Station App, I was not able to open two opposite positions in the same currency. The 2nd trade caused the first one to be closed, resulting in a single open position with size being the sum of the two requested positions. (-13 + 17 = 4)

I will await beta version. Can you offer more details about the nature of the code fault?
Posted By: jcl

Re: Incorrect profit for NET trades (1.26) - 02/11/15 13:09

The immediate closing of a trade did not close your phantom trade, as it should, but the pool trade instead. This was the bug, which triggered subsequently wrong behavior. Because a trade can not be closed in NFA mode, a trade in opposite direction was opened instead. This caused a wrong ID and wrong profit in this situation - therefore the suspicious message.
Posted By: GPEngine

Re: Incorrect profit for NET trades (1.26) - 02/12/15 04:09

Ok. Thanks for sharing the details.

For the continuous demo, I have upgraded VPS to 1.28.1 but kept fac and par files from previous training since the Asset.dta Spread bug prevents accurate re-training in Zorro 1.28.1 (see reply in Zorro Beta). I closed all trades in the account before starting this session. Let's see.

What I am about to say is meant in the most constructive spirit. Please consider developing a "Z" strategy which works in NFA + Hedge 5 conditions. Release it even if it sucks, performance is not a primary concern. In-house, run it continuously on a US-based FXCM demo account. Additionally the Strat should occasionally place more than one viable market order per asset/algo so that Hedge 5 features will also be at least exercised. That way, problems can surface close to home. Because, you must understand, I barely understand what I'm looking at and can never be sure if it's your bug or mine.
Posted By: jcl

Re: Incorrect profit for NET trades (1.26) - 02/12/15 15:53

You have certainly a point. Some of us are running Z12 in NFA and Hedge=4 mode, but this bug was not yet observed because Z12 did not close trades this way. That's why it is important that many users trade many exotic systems for finding issues of this kind.
© 2024 lite-C Forums