Gamestudio Links
Zorro Links
Newest Posts
Zorro Trader GPT
by TipmyPip. 04/27/24 13:50
Trading Journey
by 7th_zorro. 04/27/24 04:42
Help with plotting multiple ZigZag
by M_D. 04/26/24 20:03
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
M1 Oversampling
by jcl. 04/26/24 11:12
Why Zorro supports up to 72 cores?
by jcl. 04/26/24 11:09
Eigenwerbung
by jcl. 04/26/24 11:08
MT5 bridge not working on MT5 v. 5 build 4160
by EternallyCurious. 04/25/24 20:49
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (TipmyPip, Ayumi), 773 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
wandaluciaia, Mega_Rod, EternallyCurious, howardR, 11honza11
19049 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
BrokerTrade: "non-NFA compliant"? #485389
03/04/22 12:11
03/04/22 12:11
Joined: Feb 2017
Posts: 1,725
Chicago
AndrewAMD Offline OP
Serious User
AndrewAMD  Offline OP
Serious User

Joined: Feb 2017
Posts: 1,725
Chicago
jcl,

When placing limit orders (i.e. "NFA") via a plugin, my understanding is that fill status can be tracked using BrokerTrade.

But in the manual, BrokerTrade is described as for "non-NFA compliant" plugins. I think this is incorrect. Can you confirm?

Andrew

Re: BrokerTrade: "non-NFA compliant"? [Re: AndrewAMD] #485424
03/09/22 11:36
03/09/22 11:36
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
Yes, BrokerTrade only works when brokers keep track of trades. NFA brokers normally don't.

You can use BrokerTrade to return order fill status, but it must then return NAY when the trade is filled and the order disappears. NAY tells Zorro that BrokerTrade is not supported anymore for this trade.

Re: BrokerTrade: "non-NFA compliant"? [Re: jcl] #485468
03/14/22 16:50
03/14/22 16:50
Joined: Feb 2017
Posts: 1,725
Chicago
AndrewAMD Offline OP
Serious User
AndrewAMD  Offline OP
Serious User

Joined: Feb 2017
Posts: 1,725
Chicago
Originally Posted by jcl
You can use BrokerTrade to return order fill status, but it must then return NAY when the trade is filled and the order disappears. NAY tells Zorro that BrokerTrade is not supported anymore for this trade.
If I understand correctly:

1) In NFA mode, BrokerTrade must never return a negative number.
2) In NFA mode, order is placed via BrokerBuy2. Order is completely filled and is therefore complete. So BrokerTrade must return the full fill (positive) and then return NAY on the next call.
3) In NFA mode, order is placed via BrokerBuy2. Order is partially filled and then no longer active (expired or canceled). So BrokerTrade must return the partial fill (positive) and then return NAY on the next call.
4) In NFA mode, order is placed via BrokerBuy2. Order is never filled and then no longer active (expired or canceled). So BrokerTrade must return 0 until the order becomes inactive, so it must return NAY on the next call.
5) In NFA mode, order is placed via BrokerBuy2. BrokerTrade returns NAY the first time. Zorro therefore assumes the order was 100% unfilled.

Is this correct?

Re: BrokerTrade: "non-NFA compliant"? [Re: AndrewAMD] #485470
03/14/22 19:46
03/14/22 19:46
Joined: Jan 2014
Posts: 86
London City
B
byakuren81 Offline
Junior Member
byakuren81  Offline
Junior Member
B

Joined: Jan 2014
Posts: 86
London City
Hello,

I am implementing a broker API and I can tell you BrokerTrade can handle a trade fully closed manually from the broker GUI with a negative value returned from BrokerTrade corresponding to the lot amount initially opened and Zorro understands this trade is now closed.
However, as I raised the issue in a recent post, it does not work for partially closing the trade manually. When the negative size returned is smaller in absolute value than the lot amount of this trade, Zorro does not do any update on lot amount of the trade.

Last edited by byakuren81; 03/14/22 20:02.
Re: BrokerTrade: "non-NFA compliant"? [Re: AndrewAMD] #485472
03/14/22 21:51
03/14/22 21:51
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
1) In NFA mode, BrokerTrade must never return a negative number.

No. It can return a negative number when the position was closed.

2) In NFA mode, order is placed via BrokerBuy2. Order is completely filled and is therefore complete. So BrokerTrade must return the full fill (positive) and then return NAY on the next call.

No. It should return the fill when it is known, NAY when it is not known.

5) In NFA mode, order is placed via BrokerBuy2. BrokerTrade returns NAY the first time. Zorro therefore assumes the order was 100% unfilled.

No. It assumes that the API does not support BrokerTrade.

Re: BrokerTrade: "non-NFA compliant"? [Re: AndrewAMD] #485475
03/15/22 11:18
03/15/22 11:18
Joined: Feb 2017
Posts: 1,725
Chicago
AndrewAMD Offline OP
Serious User
AndrewAMD  Offline OP
Serious User

Joined: Feb 2017
Posts: 1,725
Chicago
1) The position? Meaning a reverse order was placed and filled? I fail to see how this can be correctly managed with an NFA plugin. It's probably smarter to keep orders and positions separate.

2) So even if I have a REST plugin (where there is rate limiting), the plugin should continue to inquire about the status of a filled / inactive order, even though its fate is sealed. Then once the broker fails to provide information on the order, return NAY. Is this correct?

Re: BrokerTrade: "non-NFA compliant"? [Re: AndrewAMD] #485478
03/15/22 15:30
03/15/22 15:30
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
If you want, you can theoretically manage trades even with a NFA plugin. The plugin must then keep track of trades and synchronize them with open orders and position sizes. Since this would reqiure a lot programming, we do not mention it in the manual. I also know no plugin that would do that. NFA plugins normally don't use BrokerTrade at all.

Simply return all information that you easily get. Return the fill amount when you get it from the order, otherwise return NAY.


Moderated by  aztec, Inestical, Matt_Coles, Tobias 

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