Zorro vs Oanda: Lot sizes do not match

Posted By: MMK

Zorro vs Oanda: Lot sizes do not match - 01/04/21 12:35

Dear all,

I am running Z2 on an Oanda demo account without hedging.

Everything works fine, but for one USD/CAD trade the information in Zorro and the Broker do not match.

[USD/CAD:HP:S00186] ID 186 Lots 840
[USD/CAD:HP:S00192] ID 192 Lots 843

Oanda account:
ID 186 USD/CAD 465 Short
ID 192 USD/CAD 843 Short

As you can see the lot sizes do not match.

The Oanda support was not helpful (for me):
"Therefore when you have Sell order 840 units , you placed a Buy order of 375 units , it will offset the original Sell order ( Ticket 186)"

But according to the logs a trade for 375 units has not been triggered.
Also no change on trade 186 is listed in the Zorro log.

I have identified one log entry (the line with Error 075) that could be related to the problem:

[Thu 20-12-31 20:03] 99962 -26.46 -10.24 6/5 (1.22108)
(USD/CAD:CY:L) Long 1207@1.27398 Entry limit
!position closed by reversal
Error 075 (USD/CAD:CY:L) - can't open 1207@0.0 Stop 0.079591 at 20:03:27
[USD/CAD:HP:S00155] Closed 832@1.27396: +2.12 at 20:03:35
Market closed on 01-01 00:00:00 (local 00:00)
Market open on 01-03 23:00:01 (local 23:00)

Full log is attached to this post.

The manual says:
"Oanda accounts require special settings. They are NFA compliant, but Oanda works around most NFA issues on their side of the API, so the NFA flag needs not be set. Hedge must be either disabled (Hedge = 0) or in virtual hedging mode (Hedge = 4 or 5), otherwise closing trades will cause error messages.
"Compliance of the account. Affects default state of NFA flag and Hedge mode: 0 for no restrictions, 2 for Hedge = 0 (no hedging), 14 or 15 for NFA = on (full NFA compliance)."

Could it be that I have not configured the z.ini correctly?
Which combination of NFA and Hedge is correct for Oanda in the z.ini?
Is it NFA=2 and Hedge=0 or NFA=0 and Hedge=0?

Right now I do not see why the lot sizes do not match in Zorro and on the broker account.
I assume it has something to do with non-hedging on the Oanda account, but I am just too blind to see it. frown
Can someone give me a hint?

Thanks a lot for your help!

Attached File
Posted By: MMK

Re: Zorro vs Oanda: Lot sizes do not match - 01/12/21 12:40

Solved it partially (mea culpa -> RTFM! wink )

NFA=0 (NFA Flag must not be set)
Hedge=0 (no hedging)
Hedge=4 or 5 (virtual hedging, ZorroS required)

But the question concerning the lot size remains.
My understanding is that Zorro synchronizes lot sizes via the API. When restarting Zorro the resumed positions are listed, but the lot size displayed is not the one I see in my Oanda account:

[USD/CAD:HP:S00192] - resumed (843 lots)

ID 186 USD/CAD 465 Short

My plan is just to wait until Zorro tries to close the trades with an error message and than closing the trade manually on the broker platform.

Is there no other way to synchronize the open trades between Zorro and the broker via the API?

Posted By: Petra

Re: Zorro vs Oanda: Lot sizes do not match - 01/16/21 13:17

I don't think that Zorro tries to synchronize lot sizes, it only checks if a trade with this ID ending with 00192 exists and resumes it then. If Zorro closes that trade it will be completely closed, regardless of lot sizes. Only when you close it partially it will be a problem.
Posted By: MMK

Re: Zorro vs Oanda: Lot sizes do not match - 01/19/21 13:39

Thanks a lot for your answer!

In the meantime the same thing happended again with a different trade:

(GBP/USD:CX:L) Long 434@1.35891 Entry limit
!position closed by reversal
Error 075 (GBP/USD:CX:L) - can't open 434@0.0 Stop 0.075288 at 00:22:28

The pending trade above change the lot size of trade 181:
Zorro shows the lot size to be 879 lots:
Trade ID Lots Entry time
[GBP/USD:CT:S00181] 181 879 12-16 12:03

Oanda shows a new lot size of 445 Lots for ID 181.

I have set NFA=0 and Hedge=0 as stated in the manual. Therefore no hedging is allowed.

Why does Zorro create a Long trade when Short trades for GBP/USD are still open? The Hedge=0 shoud have prevented this, right?

Posted By: Petra

Re: Zorro vs Oanda: Lot sizes do not match - 01/21/21 16:42

No, the long trade is opened. Hedge 0 only means that the short trades are then closed.
Posted By: MMK

Re: Zorro vs Oanda: Lot sizes do not match - 01/22/21 09:35

You are right of course:

"0 = no hedging; automatically close all opposite positions with the same asset when a new position is opened."

But it looks like Zorro has not closed all opposite position but closed one position partially without updating the lot sizes internally.
Oanda lot sizes are in line with the trading activities, Zorro lot sizes are not. This affects 2 trades (181 and 186) where a trade in the opposite direction ha been triggered.
I have attached two screenhots to illustrate this.

As error 075 has been reported, something must be wrong, but I do not see what that could be.

Attached picture Trades Oanda.png
Attached picture Trades Zorro.png
© 2021 lite-C Forums