Gamestudio Links
Zorro Links
Newest Posts
Camera always moves upwards?
by NeoDumont. 02/17/26 15:40
Hedge on FXCM, 4 or 5?
by Martin_HH. 02/16/26 16:09
Zorro version 3.0 prerelease!
by jcl. 02/12/26 14:05
MarginCost discrepancy?
by jcl. 02/12/26 14:02
AUM Magazine
Latest Screens
Dorifto samurai
Shadow 2
Rocker`s Revenge
Stug 3 Stormartillery
Who's Online Now
1 registered members (clint000), 9,087 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
alx, ApprenticeInMuc, PatrickH90, USER0328, Sfrdragon
19199 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 2 of 2 1 2
Re: Zorro not reconnecting to IB gateway after restart [Re: opm] #488958
10/24/25 00:23
10/24/25 00:23
Joined: Dec 2023
Posts: 12
Paddington
O
opm Offline OP
Newbie
opm  Offline OP
Newbie
O

Joined: Dec 2023
Posts: 12
Paddington
Hi, no. Its on my list to investigate again

Re: Zorro not reconnecting to IB gateway after restart [Re: opm] #489020
12/17/25 15:18
12/17/25 15:18
Joined: Jan 2021
Posts: 7
Austin, TX, USA
J
Jack_Zodiac Offline
Newbie
Jack_Zodiac  Offline
Newbie
J

Joined: Jan 2021
Posts: 7
Austin, TX, USA
Hi, is this still the state of things? I am wondering about trying to programmatically issue the re-connect commands to Zorro.

I'm using TWS, and it accepts connection fine after its daily re-start -- but Zorro has to be given 'stop', 'don't close trades', 'do stop trading', and then 'trade' button clicks, load prices, run through the lookback, and then everything works.

Re: Zorro not reconnecting to IB gateway after restart [Re: opm] #489021
12/18/25 08:43
12/18/25 08:43
Joined: Jul 2000
Posts: 28,074
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 28,074
Frankfurt
We'll soon do a new IB plugin version and will attempt a workaround of the problem on that occasion, although I cannot promise a perfect solution.

Re: Zorro not reconnecting to IB gateway after restart [Re: opm] #489059
12/31/25 21:11
12/31/25 21:11
Joined: Jan 2021
Posts: 7
Austin, TX, USA
J
Jack_Zodiac Offline
Newbie
Jack_Zodiac  Offline
Newbie
J

Joined: Jan 2021
Posts: 7
Austin, TX, USA
I made a work-around for this that seems to be working reliably enough for me. (I consider it a convenience rather than mission-critical.)

It involves using the system() command to kick off another Zorro instance shortly after the TWS restart, and quit() to kill the original one.

My implementation is likely sub-optimal, so comments welcomed. (But, no need to lecture me about global variables.)

I am running 64-bit Zorro C++ scripts on a Windows 11 machine, with an S-level license.

The following code is pieced together from the various functions where it actually resides and hasn't been tested in this exact form, so consider it just a sketch of concept. The core commands are in the last few lines, the rest is infrastructure.

(Edit: oops, I left out showing where Last_Started_Day is written to the state file. In practice I update the state file every 15th minute based on a tod(0) check.)

-----------------------

// Globals
int Last_Started_Day, UTC_offset;
bool SOD_Business, SOD_Business Done, EOD_Business, EOD_Business_Done; // SOD = start of day, EOD = end of day
string State_File;

DLLFUNC void main()
{
// Delay to ensure previous Zorro instance has ended
if (is(TRADEMODE) && is(COMMAND))
{
printf("10 second delay for Zorro instance handoff...");
wait(10000);
}

State_File = "Data\\My_State_File.csv";

// other main() stuff....

}

DLLFUNC void run()
{
if (Bar == StartBar)
{
printf("\n");
printf("\nLoading State File...");

// Script-wide variables
Last_Started_Day = (int)(getvar(State_File, "Last_Started_Day"));
EOD_Business_Done = (bool)(getvar(State_File, "EOD_Business_Done"));

// other state stuff....
}

// TIME ZONE OFFSET
if (dst(EST,0)==1)
{
UTC_offset = -4;
}
else
{
UTC_offset = -5;
}

start_time = 0400 - UTC_offset*100;

// Daily business
SOD_Business_Done = day(0) == Last_Started_Day;
SOD_Business = tod(0) >= start_time && tod(0) < 2300 && !SOD_Business_Done;

if (SOD_Business)
{
Last_Started_Day = day(0);
SOD_Business_Done = true;
EOD_Business_Done = false;

// other start of day stuff ...
}

int EOD_time;
bool EOD_Window;
if (dst(EST,0)==1)
{
EOD_time = 2350;
EOD_Window = tod(0) >= EOD_time;
}
else
{
EOD_time = 50;
EOD_Window = tod(0) >= EOD_time && tod(0) < 200;
}

// TWS daily restart should be set for slightly before the EOD_time. E.g. currently I use 00:30 GMT

EOD_Business = EOD_Window && !EOD_Business_Done;

if (EOD_Business)
{
if (is(TRADEMODE) && Bar > StartBar && !EOD_Business_Done)
{
login(4);
EOD_Business_Done = true;
putvar(State_File, "EOD_Business_Done", (var)(EOD_Business_Done));
wait(10000);
system("Zorro64.exe -trade My_Script.cpp");
quit("!Restarting Zorro session to cope with IBKR lockout.");
}
}

}

Last edited by Jack_Zodiac; 01/01/26 05:07.
Re: Zorro not reconnecting to IB gateway after restart [Re: jcl] #489194
2 hours ago
2 hours ago
Joined: Nov 2025
Posts: 4
C
clint000 Online
Guest
clint000  Online
Guest
C

Joined: Nov 2025
Posts: 4
Hi, are there any furthe news on this, or suggested workarounds?
I am facing the same issue with the IB Gateway and Zorro. I am using IBC to keep the Gateway logged in after the daily restart, but once the Gateway has been restarted once, Zorro seems to lose the connectivity to it, even if the Gateway is back on line.

Thanks

Page 2 of 2 1 2

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