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
2 registered members (AndrewAMD, Nymphodora), 972 guests, and 8 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
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: 294
Netherlands
G
Grant Offline
Member
Grant  Offline
Member
G

Joined: Aug 2017
Posts: 294
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 | 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