I was wondering if any moderator or fellow member had developed a best practice or recommendation for dealing with the Connection Lost condition for your broker. This happens from time to time for various reasons. It recently happened to me which left me with an uncovered position. After reading up on the topic, I learned why it happened that way:
1. I had an active strategy running with an open position and associated profit target and stop loss orders (managed approach). StartBehavior was WaitUntilFlat
2. I had my disconnect delay setting set to 10 seconds
3. Connection Loss Handling was set to Recalculate
The connection to my broker was lost for more than 10 seconds (no apparent reason), and strategy was disabled (as designed per settings). When it was ReCalculated the WaitUntilFlat behavior cancelled all profit target and stop loss orders (also per the NinjaTrader manual documentation). While all this occurred how the program is designed, it was certainly an unintended situation (due to my ignorance and lack of foresight).
Other than the standard disclaimer that we should always monitor active strategies, which I did, I was wondering if anyone had a best practice in place to mitigate this situation?
Here are a few options I can think of:
1. Set the disconnect delay to a longer time period (on the order of minutes). I think the strategy would keep running for nuisance disconnects shorter than the designated time period. Is this correct?
2. Set the Start Behavior to Immediately Submit or Immediately Submit, Synchronize Account. Upon reconnection, and Strategy ReCalculation I think this would adopt the profit target and stop loss orders as long as they matched the historical calculated entry orders. The main risk I see here is that upon recalculation, the historical data does not exactly match and the orders may be cancelled. Any thoughts or lessons learned?
3. Set Connection Loss Handling to "Keep Running". While I'm sure this will keep the strategy running, strategy events have the potential to trigger in the disconnected time period. You may still have an out of sync position if the strategy submits orders while disconnected. Anybody had luck with this setting?
4. Keep a "backup" market data connection. Obviously this won't help if the root cause is your internet connection, but may help if the issue is with the primary market data connection. Do strategies auto-revert and/or calculate on the "next available" real-time and historical connection if the primary/preferred connection is lost? Or will the strategy be disabled per the Strategy disconnect delay settings on the connected data feed on which the strategy was activated?
Anything else you have found to mitigate nuisance lost connection errors?
Thanks in advance for your time,
Kevin

Comment