Gamestudio Links
Zorro Links
Newest Posts
Blobsculptor tools and objects download here
by NeoDumont. 03/28/24 03:01
Issue with Multi-Core WFO Training
by aliswee. 03/24/24 20:20
Why Zorro supports up to 72 cores?
by Edgar_Herrera. 03/23/24 21:41
Zorro Trader GPT
by TipmyPip. 03/06/24 09:27
VSCode instead of SED
by 3run. 03/01/24 19:06
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (VoroneTZ, monk12, Quad), 829 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
sakolin, rajesh7827, juergen_wue, NITRO_FOREVER, jack0roses
19043 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
NFA Accounts: Pending to Filled #468807
10/21/17 03:23
10/21/17 03:23
Joined: Feb 2017
Posts: 1,718
Chicago
AndrewAMD Online OP
Serious User
AndrewAMD  Online OP
Serious User

Joined: Feb 2017
Posts: 1,718
Chicago
jcl, I have a broker plugin question regarding NFA accounts.

Zorro distinguishes between “orders” and “trades”. On NFA accounts, there technically are no trades, only orders and positions.

In the plugin, I get a BrokerBuy call. If the order is placed (instantly in pending mode), I return a trade ID from a counter. And normally, the order will eventually get filled, but not exactly at the most recently quoted price. As in: it might be a series of partial fills at different prices whose average will be close to but not equal to the most recently quoted price.

Is there a way to designate the order as: “pending, please confirm actual transaction later”? If not, I’d be interested in a new function such as “BrokerFill”, to verify fill status.

Re: NFA Accounts: Pending to Filled [Re: AndrewAMD] #468814
10/21/17 12:00
10/21/17 12:00
Joined: Jul 2000
Posts: 27,977
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,977
Frankfurt
It normally would be the BrokerTrade function. You can use it for returning the fill price. But for some reason it currently works for non-NFA accounts only. I've noted to make it work also for NFA accounts in the next version.

Re: NFA Accounts: Pending to Filled [Re: jcl] #468815
10/21/17 12:30
10/21/17 12:30
Joined: Feb 2017
Posts: 1,718
Chicago
AndrewAMD Online OP
Serious User
AndrewAMD  Online OP
Serious User

Joined: Feb 2017
Posts: 1,718
Chicago
Good!

For context, I will note the different fill cases that are enumerated.

In FIXML:
Code:
enum FixmlOrdStatus_enum_t
{
	os_New = '0',
	os_PartiallyFilled = '1',
	os_Filled = '2',
	os_DoneForDay = '3',
	os_Canceled = '4',
	os_PendingCancel = '6',
	os_Stopped = '7',
	os_Rejected = '8',
	os_Suspended = '9',
	os_PendingNew = 'A',
	os_Calculated = 'B',
	os_Expired = 'C',
	os_AcceptedForBidding = 'D',
	os_PendingReplace = 'E',
};


In Sierra Chart's DTC protocol:
Code:
enum OrderStatusEnum : int32_t
	{ ORDER_STATUS_UNSPECIFIED = 0
	, ORDER_STATUS_ORDER_SENT = 1
	, ORDER_STATUS_PENDING_OPEN = 2
	, ORDER_STATUS_PENDING_CHILD = 3
	, ORDER_STATUS_OPEN = 4
	, ORDER_STATUS_PENDING_CANCEL_REPLACE = 5
	, ORDER_STATUS_PENDING_CANCEL = 6
	, ORDER_STATUS_FILLED = 7
	, ORDER_STATUS_CANCELED = 8
	, ORDER_STATUS_REJECTED = 9
	, ORDER_STATUS_PARTIALLY_FILLED = 10
	};


I do not think **all** of these should be accounted for, just enough of them.

Thanks!
Andrew

Re: NFA Accounts: Pending to Filled [Re: jcl] #468825
10/22/17 13:01
10/22/17 13:01
Joined: Feb 2017
Posts: 1,718
Chicago
AndrewAMD Online OP
Serious User
AndrewAMD  Online OP
Serious User

Joined: Feb 2017
Posts: 1,718
Chicago
Originally Posted By: jcl
It normally would be the BrokerTrade function. You can use it for returning the fill price. But for some reason it currently works for non-NFA accounts only. I've noted to make it work also for NFA accounts in the next version.
jcl, this solution would appear to confirm fill status for orders to open a position.

Does it also confirm fill status for orders to close a position? This would also be useful.

Re: NFA Accounts: Pending to Filled [Re: AndrewAMD] #468840
10/23/17 11:05
10/23/17 11:05
Joined: Jul 2000
Posts: 27,977
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,977
Frankfurt
For closing an order on an NFA account, the fill price is passed in the BrokerBuy function. If the position is not yet closed, return zero. Zorro will then repeat the close order until the fill price is known.

Re: NFA Accounts: Pending to Filled [Re: jcl] #468843
10/23/17 11:48
10/23/17 11:48
Joined: Feb 2017
Posts: 1,718
Chicago
AndrewAMD Online OP
Serious User
AndrewAMD  Online OP
Serious User

Joined: Feb 2017
Posts: 1,718
Chicago
How would my plugin know the difference between multiple identical close orders vs a series of close order follow-ups?

Suppose instead that I return a negative ID number at BrokerBuy so that Zorro can follow up with the negative number at BrokerTrade. Can this be implemented?

Re: NFA Accounts: Pending to Filled [Re: AndrewAMD] #468844
10/23/17 14:29
10/23/17 14:29
Joined: Jul 2017
Posts: 783
Z
Zheka Offline
User
Zheka  Offline
User
Z

Joined: Jul 2017
Posts: 783
Hi, Andrew,
Originally Posted By: AndrewAMD
In the plugin, I get a BrokerBuy call. If the order is placed (instantly in pending mode), I return a trade ID from a counter. And normally, the order will eventually get filled, but not exactly at the most recently quoted price. As in: it might be a series of partial fills at different prices whose average will be close to but not equal to the most recently quoted price.

It would be useful to get the actual OrderId at the broker, rather then an artificial internal trade counter.
Same for actual order fill prices (rather then the quoted ask/bid at the time of placing an order).

Re: NFA Accounts: Pending to Filled [Re: Zheka] #468846
10/23/17 14:54
10/23/17 14:54
Joined: Feb 2017
Posts: 1,718
Chicago
AndrewAMD Online OP
Serious User
AndrewAMD  Online OP
Serious User

Joined: Feb 2017
Posts: 1,718
Chicago
Zheka, of course! I would always do this if my broker had a compatible value.

Sadly, this is not always the case. Ally Invest gives me an order ID - it’s a string with two letters, a dash, and then a series of numbers.

Re: NFA Accounts: Pending to Filled [Re: AndrewAMD] #468848
10/23/17 15:08
10/23/17 15:08
Joined: Jul 2000
Posts: 27,977
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,977
Frankfurt
>>How would my plugin know the difference between multiple identical close orders<<

The difference is not needed, since on NFA accounts it does not matter which order is closed. Only the close amount matters. When positions are not closed immediately, you need anyway a bookkeeping of the positions in your plugin. When a position closes, then return 1 and pass the fill price on the next close order of the same amount. If the close order has a different amount, just ignore it. Unlike open orders, close orders are repeated until the right amount is closed.

Re: NFA Accounts: Pending to Filled [Re: AndrewAMD] #468853
10/23/17 16:58
10/23/17 16:58
Joined: Jul 2017
Posts: 783
Z
Zheka Offline
User
Zheka  Offline
User
Z

Joined: Jul 2017
Posts: 783
Quote:
Sadly, this is not always the case. Ally Invest gives me an order ID - it’s a string with two letters, a dash, and then a series of numbers.
In case of SierraChart, it is quite safe to assume that OrderIDs reported via DTC would conform to the same convention.
Most SC broker integrations are based on FIX.

Page 1 of 2 1 2

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