Several users have reported unexpected logoffs from the IB TWS at night. The TWS forces a logoff once per day, and the default seems to be 10PM. To set this logoff time in the TWS go to Configure->Global Configuration->Exit where you will be able to set the Auto Log Off Timer.
We do not know why the TWS forces you to select a logoff time. But the same dialog allows you to be prompted about the exit.
There are, however, other things that often happen at night that could affect your automatic trading, which you have some control over. Many of these can also affect long optimizations. These include but are not limited to:
1. Hibernation
2. Shutoffs of disks because of power options
3. The operating systems performing maintenance activities
4. Your virus detection performing scans and/or maintenance
5. Your ISP performing maintenance or timing you out
6. Problems with the exchange you are trading (usually reported by IB with a flashing red bar, but you may not be watching)
In view of all these things, please do not contact us about unexplained problems at night until you have completely researched all the above.