On this page
NinjaTrader can lose its connection to your broker or data feed, for a few seconds or for longer. Its connection loss settings decide what your running strategies do then. Check them before you trade live. They are NinjaTrader's own settings: QuantVPS cannot see or change them for you.
Step 1: Open the Strategy Settings
- Connect to your VPS and open NinjaTrader 8.
- In the Control Center, click Tools, then Settings. Older versions of NinjaTrader 8 call it Options.
- Click Strategies.
- Expand On connection loss.
Step 2: Choose the Handling
Handling has three choices:
- Keep Running: the strategy keeps running, and NinjaTrader logs the disconnection. When the connection comes back, the strategy goes on as if nothing happened.
- Recalculate: NinjaTrader stops the strategy in the cases below. When the connection comes back, it recalculates the strategy's position. If the connection comes back before the strategy stops, the strategy keeps running and does not recalculate. This is NinjaTrader's default for a strategy.
- Stop Strategy: NinjaTrader stops the strategy when the disconnection lasts longer than the disconnect delay, and logs it. It does nothing when the connection comes back.
With Recalculate, NinjaTrader stops the strategy when:
- The data feed is disconnected for longer than the disconnect delay.
- The order feed is disconnected and the strategy sends an order action.
- Both feeds are disconnected for longer than the disconnect delay.
Step 3: Set the Delay and the Restarts
- Disconnect delay seconds: how long a disconnection must last before NinjaTrader acts on it.
- Number of restart attempts and Restarts within x minutes: when the connection comes back, NinjaTrader restarts the strategy only if it made fewer attempts than this number within these minutes. If not, the strategy stays stopped, and NinjaTrader makes no more attempts.
NinjaTrader's help gives these defaults for a strategy: a 10-second disconnect delay, and 4 restart attempts within 5 minutes. Then save your changes.
The Strategy's Orders
In the same window, under NinjaScript:
- Cancel entry orders when a strategy is disabled: NinjaTrader cancels the strategy's entry orders when the strategy is disabled.
- Cancel exit orders when a strategy is disabled: NinjaTrader cancels the strategy's exit orders when the strategy is disabled.
How your positions are protected while NinjaTrader is disconnected depends on your strategy and your broker. Ask your strategy's developer and your broker.
Strategies From a Developer
A strategy's own code can set these values. In NinjaScript they are ConnectionLossHandling, DisconnectDelaySeconds, NumberRestartAttempts and RestartsWithinMinutes. If you bought or rent a strategy, ask its developer which values it uses, and what it does with open positions and orders after a disconnection. QuantVPS cannot see inside your strategy.
After NinjaTrader or the VPS Restarts
After NinjaTrader or the VPS restarts, your strategies can be disabled. Open the Strategies tab in the Control Center and enable each strategy again. To keep Windows from restarting while you trade, see How to Configure Windows Updates on Your VPS.
Get an Email When NinjaTrader Disconnects
QuantVPS Detect+ can email you on a Windows VPS with Detect+ 1.1.23 or later. In your dashboard, click Detect+, then Alerts. Turn on the alerts you want and click Save.
- NinjaTrader disconnected: NinjaTrader loses its connection to Tradovate, Rithmic, CQG, Lucid Trading or Funded Futures Family, and it does not come back within the time you choose: 30 seconds, 1, 2 or 5 minutes. The email says how long it was gone, and whether our network and the VPS's internet looked fine at that moment. Off until you turn it on.
- NinjaTrader disabled a strategy: NinjaTrader disables one of your strategies after an order error or an error in the strategy's code. A restart that NinjaTrader makes after a connection loss never sends this email. To turn it on, you agree that Detect+ reads NinjaTrader's log on the VPS. It sends only these events, never the log.
Every alert and its setting: Set up Detect+ monitoring and alerts.
Find Out What Happened
- NinjaTrader logs each disconnection. To send us its log and trace files, see How to Send NinjaTrader Log and Trace Files to Support.
- Detect+ shows whether the VPS and its network were fine at that time. See How to Diagnose VPS Issues: Network, Crashes, and Stability.
- Use each broker login on one device at a time. If the same login signs in somewhere else, for example in NinjaTrader on your own computer or in the mobile app, the VPS can be disconnected.
Related
- How to Send NinjaTrader Log and Trace Files to Support
- How to Enable Multi-Provider Mode in NinjaTrader 8
- Common NinjaTrader Errors and How to Fix Them
- Set up Detect+ monitoring and alerts
Need Assistance?
Our support team is available 24/7. If you have any questions or run into issues, open a support ticket from your QuantVPS dashboard and we'll get back to you as quickly as possible.
