I am currently dealing with the following issue: I am trading a strategy using daily bars, where I hold positions over several days.
My problem is the following: Since I am trading over IB it can happen that IB TWS shuts down and my strategies are disabled automatically. When I reconnect to IB TWS once again and enable my strategies I cannot reproduce my old position size and get wrong new positions sizes.
My position size in real-time trading is calculated based on My Trading Equity available through IB (GetAccountValue ()). However this works only in real-time. When I enable my strategies once again after a shutdown of TWS some days later the bar, where my original real-time order got produced is already historical and I cannot use GetAccountValue anymore. In my logic a simulated equity value (calculated by the logic) is then used instead.
The consequence is that the positionsize between my strategy and my account does not match anymore. Since I am using SyncAccount = True; immidiately submit orders my Account gets always updated with the new orders produced by the strategy.
Any ideas how I can handle this when I get one of those interruptions through IB??
Thx,
Peter
Comment