Error with multi-broker scripts

Posted By: hatten

Error with multi-broker scripts - 12/17/18 18:38

The following issues are encountered when using assets from multiple brokers (recent release 1.96.4 zorro S):

1. When terminating the trade script, the user is asked whether the open trades should be closed or not. Only trades from one broker are closed, presumably the one associated with the last asset command. For the other trades, a "can't close" error message is received.

2. If one resumes trading and you have chosen the option not to close the open trades upon interrupting the trade script, only trades from one broker will be resumed. For the trades of the other broker one receives a "not found" error.

This appears to be a bug as it is not related to any specific broker. The important consequence of this bug is that it is not possible to resume trading after interrupting the script. Very annoying.

It is obvious from the trade log in MTR4 that for the trades that were not closed, zorro does not switch to the proper broker, since there are additional entries in the trade log of the first broker for the unsuccesful close orders of the second broker. These close orders are however nonsense as it states closed at price 0.0000.
Posted By: jcl

Re: Error with multi-broker scripts - 12/18/18 08:35

We can confirm this problem. It will be fixed in one of the next updates. Until then, when terminating a broker arbitrage session with open trades, close the trades manually.
Posted By: hatten

Re: Error with multi-broker scripts - 12/20/18 19:44

The following issue when using multiple brokers has been raised before:
#include <profile.c>

function run()
{
BarZone = WET;
BarPeriod = 1;
LookBack = 0;

asset("USDCHF_Broker1");
printf("n BALANCE %f",Balance);
asset("USDCHF_Broker1");
printf("n BALANCE %f",Balance);
}

The Balance that is printed is in both cases the one of the broker account selected in the zorro window. When inserting a trade command, trades are opened with broker1 and broker2, so I am sure that the Accounts.csv as well as the asset file are correct.

I received the feedback that this issue has been solved, but I can not confirm this. My results contradict this.
Posted By: jcl

Re: Error with multi-broker scripts - 12/21/18 10:23

What exactly is the problem with your script? Aside from printing the same balance twice, it should work as coded.
Posted By: hatten

Re: Error with multi-broker scripts - 12/22/18 17:45

Well the script that I typed in here was wrong. I apologize. The second asset command should have read as follows:
asset("USDCHF_Broker2");
and the result is however that I always get the Balance of the broker in the zorro scroll window and not the Balance on the account of Broker2. That is why I claim that changing to an asset, which involves a change in the broker, does not change the account parameters to that broker of the current asset.

Support has suggested me to use the function accountBroker instead. However this does not work either for me. I still get the same result.

The use of the accountBroker function also raises a number of questions:

1. The manual says that the function accountBroker calls the function AccountBroker (with capital first letter). There is however a discrepancy
in the number of parameters of the functions accountBroker and the API function AccountBroker. There is an additional string subaccount in the accountBroker function, the meaning of which is not explained. It says this subaccount parameter is optional. Not using it however yields an error. I suspect that this subaccount parameter is related to the account entry in the Accounts.csv, a parameter that is also not used at present and is therefore put to zero in the Accounts.csv (but please note the use of different terms: account versus subaccount. That is confusing). What does this mean now? Should the subaccount string in the accountBroker function call be set equal to "0" or ""? Trying either way, yields the same wrong result, namely I always get the account parameters of the broker selected in the scroll down window.

2. I would also like to point out that the accountBroker function is not present in the zorro functions overview list:
https://zorro-project.com/manual/en/funclist.htm

3. BrokerAccount differs also from brokerAccount because the first function returns a value that allows to check whether there is a connection to the broker. Unfortunately brokerAccount does not return a value (at least it is not described in the manual). So one can not perform the check.

4. Is it possible to use BrokerAccount (instead of brokerAccount) from within a zorro script? I have the same question for all the other useful API functions like BrokerSell, BrokerStop, .... I get an undeclared identifier error, so presumably I would have to use some #include <...>? I guess I don't understand why the Broker API functions are not accessible from within the zorro trade engine script and instead one has to use assetBroker, accountBroker, commandBroker rather than AssetBroker, AccountBroker, .... There are many more of these API functions than there are equivalent functions one can use in a zorro script. It would be nice to be able to use all of the API functions.















© 2024 lite-C Forums