Gamestudio Links
Zorro Links
Newest Posts
Wolfram Mathematica with Zorro
by TipmyPip. 07/30/26 02:07
ZorroGPT
by TipmyPip. 07/30/26 00:36
Fun Arcade Car Physics (nfs style)
by rayp. 07/25/26 00:35
What are you working on?
by rayp. 07/24/26 22:58
Z9 getting Error 058
by madpower2000. 07/22/26 14:01
New Zorro version 3.11
by jcl. 07/21/26 13:42
AUM Magazine
Latest Screens
Dorifto samurai
Shadow 2
Rocker`s Revenge
Stug 3 Stormartillery
Who's Online Now
0 registered members (), 9,543 guests, and 10 spiders.
Key: Admin, Global Mod, Mod
Newest Members
riggi89, shuhari, KD1990, Ephraim, Student_64151
19223 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Trading 100 instruments with IB #486933
11/19/22 03:35
11/19/22 03:35
Joined: Nov 2022
Posts: 4
Sydney, Australia
D
DavidK Offline OP
Guest
DavidK  Offline OP
Guest
D

Joined: Nov 2022
Posts: 4
Sydney, Australia
I would like to monitor and trade say 100 instruments using two IB accounts. What sort of Zorro configurations of would enable me to do it efficiently?
How would the code inside the run() and tick() functions know which of the assets triggered the call? It seems quite inefficient to have to loop through many assets to
see which assets caused the calls.

Last edited by DavidK; 11/19/22 03:50.
Re: Trading 100 instruments with IB [Re: DavidK] #486934
11/19/22 10:27
11/19/22 10:27
Joined: Aug 2017
Posts: 318
Netherlands
G
Grant Offline
Senior Member
Grant  Offline
Senior Member
G

Joined: Aug 2017
Posts: 318
Netherlands
Originally Posted by DavidK
I would like to monitor and trade say 100 instruments using two IB accounts. What sort of Zorro configurations of would enable me to do it efficiently?


By either using:

1) A 'for(used_assets)' loop, see https://zorro-project.com/manual/en/fortrades.htm

or

2) A 'while(asset(loop(...' , see https://zorro-project.com/manual/en/loop.htm (examples below) when you want to run optimizations.

Quote

How would the code inside the run() and tick() functions know which of the assets triggered the call? It seems quite inefficient to have to loop through many assets to
see which assets caused the calls.


Always use tock() instead of tick() for a multi-asset script.

Quote:

"Trading with different assets in a tick function can cause backtest snooping bias. When historical price ticks for assets A and B have the same time stamps, the tick function will first run with asset A, then with asset B. In the first run, asset A has the current price, but asset B still the previous price. This can be used to snoop the next B price especially when it strongly depends on the A price. To prevent this effect, use the tock function for trading multiple assets when required, and set TockTime to the tick resolution of the used historical data, or to TickTime in live trading." (https://zorro-project.com/manual/en/tick.htm)


You need to loop this, but c-lite is pretty fast.

Re: Trading 100 instruments with IB [Re: DavidK] #487104
01/16/23 20:18
01/16/23 20:18
Joined: Dec 2022
Posts: 6
G
Gheo Offline
Newbie
Gheo  Offline
Newbie
G

Joined: Dec 2022
Posts: 6
After reading the posts above I built this script to run a statagy on several currancy pairs.

seems to work well.

Code
///////////// MultiPair Live Trade /////////////

#include <profile.c>
#define	run strategy
#include	"AnyAlgo.c"	// <= your script here!!
#undef	run

function run()
{
	set(PRELOAD|COMMONSTART|PLOTNOW|LOGFILE); // reload prices after any cycle
	brokerCommand(SET_AMOUNT,0.01);
	setf(PlotMode,PL_FINE+PL_DIFF+PL_ALLTRADES+PL_LONG+PL_ALL+PL_BENCHMARK);  //PL_FILE+
	PlotScale = 8;
	asset("EUR/USD");
	asset("AUD/USD");
	
#endif
	for(used_assets) {
	strategy();	
	
	}
}

Last edited by Gheo; 01/16/23 20:45.

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