Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by EternallyCurious. 04/25/24 10:20
Trading Journey
by howardR. 04/24/24 20:04
M1 Oversampling
by Petra. 04/24/24 10:34
Zorro FIX plugin - Experimental
by flink. 04/21/24 07:12
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
3 registered members (EternallyCurious, Quad, vicknick), 700 guests, and 7 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Mega_Rod, EternallyCurious, howardR, 11honza11, ccorrea
19048 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 4 1 2 3 4
Some questions for BrokerAPI(1.96.4) #475575
12/26/18 10:15
12/26/18 10:15
Joined: Dec 2014
Posts: 56
I
ibne Offline OP
Junior Member
ibne  Offline OP
Junior Member
I

Joined: Dec 2014
Posts: 56
Hi,

I have some questions regarding the BrokerAPI for Zorro 1.96.4, while testing my plugin:

1) The TradeTest script seems broken. I can only open trades, but not closing them for a hedged account.
Zorro keeps on saying that one needs to check the NFA flag.
But NFA is set to Off and the hedge mode is set to 2.
The function "BrokerSell" gets never called.
Even when setting AUTO=on, Zorro opens some trades but can not close them, since the NFA is "wrong".
I remember that the TradeTest script was working fine in previous versions; would be very helpful if the developers could fix this.
Edit: I even created a dedicated Accounts.csv entry where NFA compliance is explicitly turned off(0) with no success.
Zorro still says "Closing prohibited - check NFA flag!"

2) Semantics of function brokerCommand (int nCommand, DWORD dwParameter) is sometimes unclear.
The manual says that "they return 0 when they are not supported or no broker connection is established", so returning 0 is for signaling error.
But what about commands which can return 0 as a value? Take GET_NTRADES as an example.
It should return the number of open trades...but what if there are no open trades currently? What does a return of 0 mean here, an error or zero trades?

3) Again regarding brokerCommand: it is unclear for some commands if the value should stay fix for the entire trading session.
Take SET_ORDERTEXT as an example. Should I set the orderText for the next trade which gets opened or should it be set to every upcoming orders?
Or what about SET_LIMIT? To me this makes only sense for the next trade related command and not for every other.
So, I invalidate the limit after applying it and the script has to set a new value again.
The documentation should make it clear on the lifetime of the command values.

Thx for help and have nice holidays laugh
Juergen

Last edited by ibne; 12/26/18 11:03.
Re: Some questions for BrokerAPI(1.96.4) [Re: ibne] #475576
12/26/18 11:16
12/26/18 11:16
Joined: Sep 2003
Posts: 929
Spirit Offline

Moderator
Spirit  Offline

Moderator

Joined: Sep 2003
Posts: 929
I dont know why your Brokersell is not called, but when you set a variable or an ordertext it stays until you set another ordertext. It does not reset itself. NTRADES = 0 can mean not implemented or no trades, so use this command only when your broker plugin supports GET_NTRADES.

Re: Some questions for BrokerAPI(1.96.4) [Re: Spirit] #475579
12/26/18 11:37
12/26/18 11:37
Joined: Dec 2014
Posts: 56
I
ibne Offline OP
Junior Member
ibne  Offline OP
Junior Member
I

Joined: Dec 2014
Posts: 56
"NTRADES = 0 can mean not implemented or no trades"...yes it can mean both, which to me does not make much sense.
Anyway, then the script has to figure out if the comnmand is not supported or there are zero trades.
This is not very effictive nor clear I guess.
I already implemented this command and was wondering what the caller would expect here.

For not reseting values: this means that if the script user does not set a new value strange things can happen.
If SET_LIMIT is not set for every new order related command, then this limit price might stay for totally unrelated assets.
But Ok, if this is the desired behavior...

Re: Some questions for BrokerAPI(1.96.4) [Re: ibne] #475580
12/26/18 12:45
12/26/18 12:45
Joined: Sep 2003
Posts: 929
Spirit Offline

Moderator
Spirit  Offline

Moderator

Joined: Sep 2003
Posts: 929
I was anyway wondering for what NTRADES is needed in a script. it can return any number when more than one Zorro is trading or when someone trades manually, so its rather meaningless. SET_LIMIT is AFAIK outdated and not used anymore.

Re: Some questions for BrokerAPI(1.96.4) [Re: Spirit] #475587
12/27/18 08:59
12/27/18 08:59
Joined: Dec 2014
Posts: 56
I
ibne Offline OP
Junior Member
ibne  Offline OP
Junior Member
I

Joined: Dec 2014
Posts: 56
Luckily, the problem with NFA was on my side laugh
In general, I think the entire specification of the Broker API needs an update, specifically the brokerCommand part.
Mixing error codes with values is bad programming style IMHO.

Re: Some questions for BrokerAPI(1.96.4) [Re: ibne] #475592
12/27/18 13:18
12/27/18 13:18
Joined: Feb 2017
Posts: 1,725
Chicago
AndrewAMD Offline
Serious User
AndrewAMD  Offline
Serious User

Joined: Feb 2017
Posts: 1,725
Chicago
The documentation of any given plugin will clarify whether a certain broker command is supported. Thus, it is reasonable for any command to return zero, value or not.

Re: Some questions for BrokerAPI(1.96.4) [Re: AndrewAMD] #475604
12/27/18 21:12
12/27/18 21:12
Joined: Dec 2014
Posts: 56
I
ibne Offline OP
Junior Member
ibne  Offline OP
Junior Member
I

Joined: Dec 2014
Posts: 56
I disagree in a very general context.
Mixing different types of results is in general a bad programming style.
Btw, it would be very easy to change the API here with no drawbacks.

Further, returning 0 could also mean that the connection is lost.
So, one has to figure out if 0 means:
1) 0 open trades
2) Connection lost
3) Command not supported

Having to look up various other places what 0 could possibly mean defeates the purpose of pure function call.

Last edited by ibne; 12/27/18 21:17.
Re: Some questions for BrokerAPI(1.96.4) [Re: ibne] #475642
12/31/18 09:47
12/31/18 09:47
Joined: Dec 2014
Posts: 56
I
ibne Offline OP
Junior Member
ibne  Offline OP
Junior Member
I

Joined: Dec 2014
Posts: 56
Two more questions:
1) The testing script TradeTest.c does not show the button "Update Stop". Is there any setting in the script which makes this button appear again?
2) Regarding BrokerAsset call: if the asset data is available but the asset is currently not tradeable, which value should be returned? Docs say "1 when the asset is available and the returned data is valid", so does "available" mean "currently tradeable"?

Re: Some questions for BrokerAPI(1.96.4) [Re: ibne] #475645
12/31/18 11:32
12/31/18 11:32
Joined: Jul 2000
Posts: 27,982
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,982
Frankfurt
No, 'available' basically means that you spelled the name correctly. For adding an update stop button, edit the panel definition in line 252 in the tradetest script and change "9" to "10".

Re: Some questions for BrokerAPI(1.96.4) [Re: ibne] #475647
12/31/18 11:39
12/31/18 11:39
Joined: Feb 2017
Posts: 1,725
Chicago
AndrewAMD Offline
Serious User
AndrewAMD  Offline
Serious User

Joined: Feb 2017
Posts: 1,725
Chicago
2) Return 1 regardless of whether the asset is tradeable. You can optionally output asset tradability with GET_TRADEALLOWED.

Page 1 of 4 1 2 3 4

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