Gamestudio Links
Zorro Links
Newest Posts
Zorro FIX plugin - Experimental
by flink. 04/21/24 07:12
Data from CSV not parsed correctly
by EternallyCurious. 04/20/24 21:39
M1 Oversampling
by 11honza11. 04/20/24 20:57
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 (rki, AndrewAMD), 426 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
EternallyCurious, howardR, 11honza11, ccorrea, sakolin
19047 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Z12 Realized P/L problem [Unresolved] #480280
05/29/20 15:24
05/29/20 15:24
Joined: Apr 2020
Posts: 14
E
ESR Offline OP
Newbie
ESR  Offline OP
Newbie
E

Joined: Apr 2020
Posts: 14
Hi All,

I have been running Zorro S with Z12 in demo account since 04/28/20 (It's 05/29/20 today) on a US based Oanda account with 50:1 leverage, FX Only and virtual hedging. Z12.84: FX PH H 5 B 0 V 3

Events:
Zorro was shut down (for testing purposes) with Trades left open on Sunday May 3rd and resumed the same day prior to markets opening for the week.
Zorro was shut down (for testing purposes) with Trades left open on Tuesday May 28th and resumed within a few minutes.
In both of these instances the open trades were resumed with no errors.

Issue
On May 29th I noticed that my Realized P/L for the brokerage account (6.40) and Zorro (3.63) didn't match. I am trying find out why by matching closed positions between my brokerage account and Zorro.

In the brokerage account the 1st Closed Trade was listed as:
Ticket Type Market Units Price Half Spread Cost Profit (USD) Commission Balance Date / Time
15 Close Trade USD/JPY 912 106.776 -0.0726 -3.76 0.00 3995.98 5/1/2020, 5:29:41 AM

When I view the Z12_demo.log the trade does not show up.

Nor do any of these trades;
19 Close Trade USD/JPY 912 106.673 -0.0598 -6.10 0.00 3989.88 5/1/2020, 8:11:50 AM
46 Close Trade USD/JPY 225 107.154 -0.0147 1.27 0.00 3989.26 5/11/2020, 4:07:01 AM
50 Close Trade USD/JPY 912 106.961 -0.0554 3.52 0.00 3992.01 5/13/2020, 4:40:05 AM
52 Close Trade USD/JPY 912 106.928 -0.0512 -0.29 0.00 3991.72 5/13/2020, 7:43:08 AM
64 Close Trade EUR/USD 2,140 1.09339 -0.1177 10.02 0.00 3999.67 5/19/2020, 12:07:08 PM
79 Close Trade USD/JPY 912 107.656 -0.0508 -1.86 0.00 3995.03 5/26/2020, 12:07:12 PM
81 Close Trade USD/JPY 50 107.657 -0.0030 -0.05 0.00 3994.98 5/26/2020, 12:07:13 PM

These are first references to Closed Trades in Z12_demo.log
[Fri 20-05-29 04:04] 4109 0 +111 9/3 1.10741/1.10942\1.10707/1.10930 -0.00014
[Fri 20-05-29 08:04] 4101 0 +103 8/4 1.10930/1.11142\1.10903/1.11027 -0.00013
{USD/JPY:BB:s76309} exit
{USD/JPY:BB:s76309} Cover 862@107.20: +4.24 at 08:04:01
Opn 107.75 Cls 107.20 Spr 0.0150000 Slp 0.00 Rol -0.08 Com 0.00 Net -862
[USD/JPY:NET:S00083] Cover 862@107.20: +3.63 at 08:04:01
Opn 107.67 Cls 107.20 Spr 0.0120000 Slp 0.00 Rol -0.03 Com 0.00 Net -862

Not sure why the Cover for 862@107.20 shows up twice with different P/L's. The brokerage account shows;
90 Close Trade USD/JPY 862 107.199 -0.0523 3.66 0.00 3996.26 5/29/2020, 4:04:01 AM
There is no trade with a P/L of 4.24


What am I missing? Should the Closed Trades show up in Z12_demo.log? If not where would they be? They don't show up in Z12_pnl.csv. That file only shows that trades from the test period.

Lastly, the Trade Period field does not seem correct in the Z12.htm web page.
It shows:Trade period 2020-05-28..2020-05-29
When it should show: 2020-04-28..2020-05-29


Note: All of the Open Positions are accurate between Zorror and the brokerage account.

Thank you in advance for any help!

~eric

Last edited by ESR; 06/01/20 14:43.
Re: Z12 Realized P/L problem [Re: ESR] #480283
05/30/20 00:11
05/30/20 00:11
Joined: Mar 2019
Posts: 357
D
danatrader Offline
Senior Member
danatrader  Offline
Senior Member
D

Joined: Mar 2019
Posts: 357
https://zorro-trader.com/manual/en/log.htm

{} are phantom trades and should not show up on the broker

Not sure why the Cover for 862@107.20 shows up twice with different P/L's. <<-- Hedging 5, updates open positions to the new value the newly triggered trade would have in other hedge mode.

[] <- only those are executed trades.

Last edited by danatrader; 05/30/20 00:11.
Re: Z12 Realized P/L problem [Re: ESR] #480337
06/01/20 14:27
06/01/20 14:27
Joined: Apr 2020
Posts: 14
E
ESR Offline OP
Newbie
ESR  Offline OP
Newbie
E

Joined: Apr 2020
Posts: 14
Update:

As for the closed trades issue I found that all of the open trades are showing up properly and the closed trades show up properly in the demo_trades.csv file.

However, the web status page and zorro panel do not reflect the correct numbers for closed trades.

On the web status page Trade period 2020-05-28..2020-06-01

As such the page only references one closed trade that took place on the 28th of May.

The Trade period should show: 2020-04-28.2020-06-01

How can this be adjusted?

Re: Z12 Realized P/L problem [Re: danatrader] #480338
06/01/20 14:31
06/01/20 14:31
Joined: Apr 2020
Posts: 14
E
ESR Offline OP
Newbie
ESR  Offline OP
Newbie
E

Joined: Apr 2020
Posts: 14
Ah! I see. Thank you danatrader,

Does the algorithm provide a reason why they were phantom trades? They would normally only be phantom trades due to equity curve trading or would trade balance/leverage also cause a phantom trade?

Re: Z12 Realized P/L problem [Re: ESR] #480345
06/01/20 19:31
06/01/20 19:31
Joined: Mar 2019
Posts: 357
D
danatrader Offline
Senior Member
danatrader  Offline
Senior Member
D

Joined: Mar 2019
Posts: 357
https://zorro-trader.com/manual/en/trademode.htm

Phantom trades are used for equity curve trading, for Virtual Hedging, or for both.

And the online manual for "Hedge":

Hedge
Hedging behavior; determines how simultaneous long and short positions with the same asset are handled.
Range:
0 No hedging; automatically closes opposite positions with the same asset when a new position is opened (NFA compliant; default for NFA accounts).
1 Hedging across algos; automatically closes opposite positions with the same algo when a new position is opened (not NFA compliant in multi-algo systems; default for non-NFA accounts).
2 Full hedging; long and short positions even with the same algo can be open at the same time (not NFA compliant).
4 Virtual hedging without partial closing. Long and short positions can be open simultaneously, but only the net position is open in the broker account. Phantom trades immediately trigger the opening or closing of corresponding pool positions. NFA and FIFO compliant. Zorro S required.
5 Virtual hedging with partial closing and pooling. Phantom trades in the run function are collected and result in a single pool trade. Intrabar phantom trades trigger pool trades immediately. Open pool positions are partially closed to match the net amount. NFA and FIFO compliant. Zorro S required.

Last edited by danatrader; 06/01/20 19:35.
Re: Z12 Realized P/L problem [Re: danatrader] #480346
06/01/20 20:23
06/01/20 20:23
Joined: Apr 2020
Posts: 14
E
ESR Offline OP
Newbie
ESR  Offline OP
Newbie
E

Joined: Apr 2020
Posts: 14
Thanks danatrader, I hadn't thought about the virtual hedging aspect of phantom trades. It's very cool...

As of right now the only remaining issue for this post is:

On the Trading Status web page Trade period shows 2020-05-28..2020-06-01 (the last day that I stopped and restarted Zorro)

As such the page only references one closed trade that took place on the 28th of May (not the other 8 trades that occurred) and of course the rest of the trade statistics are incorrect because of this.

The Trade period should show: 2020-04-28.2020-06-01

How can this be adjusted?

Last edited by ESR; 06/01/20 20:27.

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