I trade using Ninjascript strategies that send trades to Interactive Brokers. Recently, Interactive Brokers advised me to log off and back on to TWS daily to ensure TWS stability. Since I have started doing this, my Ninjascript strategies appear to have lost some functionality as soon as I reconnect. When I reconnect, everything appears normal, and the strategies restart where they left off and make no syncing adjustments to my positions or orders. However, the following stops working:
1) A piece of code that writes strategy status info to an external text file every hour
2) A piece of code that adjusts the stoploss as the position becomes more profitable, through SetStopLoss()
Both of these pieces of code execute as long as Position.MarketPosition is Long or Flat, which is pretty much every hour the strategy is turned on.
My NinjaScript options have "Disconnect delay seconds" = 240, and Handling = KeepRunning, and I can easily reconnect within 240 seconds.
Can you advise what might cause the loss of functionality, or what else might be going on?
Thanks,
Ian
Comment