Gamestudio Links
Zorro Links
Newest Posts
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
Release 2.68 replacement of the .par format
by Martin_HH. 09/23/25 20:48
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
1 registered members (TipmyPip), 17,605 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
BrokerTrade() is fundamentally flawed. #487821
10/08/23 21:04
10/08/23 21:04
Joined: Feb 2017
Posts: 1,806
Chicago
AndrewAMD Offline OP
Serious User
AndrewAMD  Offline OP
Serious User

Joined: Feb 2017
Posts: 1,806
Chicago
My proposal is that BrokerTrade receives an additional return code to indicate that an order is expired/cancelled/rejected/dead while 100% unfilled.

Here's why:

BrokerTrade returns the following, according to the docs:
a) Number of contracts or lots (as in BrokerBuy2) currently filled for the order
b) Negative number of filled contracts or lots when the position was closed.
c) -1 when the position was closed at an unknown fill amount. Zorro will then assume that the order was completely filled.
d) NAY (defined in trading.h) when the order or trade state was unavailable. Zorro will then assume that the order was completely filled.

So what of the case of, say, a tif=DAY order with lots=10 that expires completely unfilled. Well, it could return 0 to indicate 0 lots have been filled, but it does not establish the end of the order. Or it could return NAY, but then Zorro will assume the order was completely filled.

Therefore one good solution is to add another return, maybe call it NAY_UNFILLED to say definitively that the order is both dead and unfilled.

Re: BrokerTrade() is fundamentally flawed. [Re: AndrewAMD] #487824
10/09/23 09:25
10/09/23 09:25
Joined: Apr 2008
Posts: 594
Austria
Petra Offline
Support
Petra  Offline
Support

Joined: Apr 2008
Posts: 594
Austria
A rejected order returns 0 at BrokerBuy2. But it is true, there is no return code for an order that was accepted, but unfilled and later cancelled. I will forward this request to the developers to implement such a code.


Moderated by  Petra 

Gamestudio download | 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