NinjaTrader Support Forum  
X

Attention!

This website will be down for maintenance from Friday May 24th at 6PM MDT until Sunday May 26th at 12PM MDT. We apologize for the inconvenience. If you need assistance during this time, please email sales@ninjatrader.com


Go Back   NinjaTrader Support Forum > Application Technical Support > Automated Trading

Automated Trading Support for automated trading systems using NinjaScript. Support for our ATI (Automated Trading Interface) used to link an external application such as TradeStation and eSignal to NinjaTrader.

Reply
 
Thread Tools Display Modes
Old 06-04-2012, 10:08 AM   #1
JezzaNT
Junior Member
 
Join Date: Jun 2012
Posts: 9
Thanks: 0
Thanked 1 time in 1 post
Default Loss of connection preventing any further signals from strategy

I have been testing an automated tradig strategy on a paper account at IB using NT and it seems that when there is a loss of connection, the strategy never "syncs" back to the data to take any further signals.

This has happened twice and the scenario was more or less identical. Today's scenario was exactly as follows:

1- Run a strategy with NT connected to IB. Everything works fine and orders are triggered as expected.
2- unplug the ethernet cable to simulate a loss of connection (log messages in NT Control Centre show loss of connection/data farm connection broken, but also indicate that the strategy will keep running as per my strategy setting).
3- Close the lid of the laptop - computer goes to sleep.
4- When I plug the ethernet cable back (after waking up the computer), the connection comes back but any further signals in the strategy as monitored from the charts are not taken (not also that the chart does not automatically fill back the "holes" in the bars (ie it seems to catch up from where it left off by aggregating all price moves during that time in one bar?).

The strategy still says that it is running but it does not seem to be.
What is the normal procedure to ensure that the strategy simply picks up from where it left off after a connection interruption?
(ps I tried the different "sync" options in the settings but that does not seem to fix it)
JezzaNT is offline  
Reply With Quote
Old 06-04-2012, 10:30 AM   #2
NinjaTrader_PatrickH
NinjaTrader Customer Service
 
NinjaTrader_PatrickH's Avatar
 
Join Date: Jul 2011
Location: Denver, CO, USA
Posts: 1,694
Thanks: 116
Thanked 193 times in 188 posts
Default

Hello JezzaNT,

Thank you for your post and welcome to the NinjaTrader Support Forum.

NinjaTrader does not support sleep modes or restoring from sleep modes.

A computer going to sleep shuts down critical Windows processes, your network connection, and other files required by NinjaTrader.

Once the sleep mode is restored, not all of these are restarted, and in your case the live market data connection is not restored.

If you plan on using Sleep mode, please close NinjaTrader before entering a sleep state.

Please let me know if I may be of further assistance.
NinjaTrader_PatrickH is offline  
Reply With Quote
Old 06-04-2012, 10:47 AM   #3
JezzaNT
Junior Member
 
Join Date: Jun 2012
Posts: 9
Thanks: 0
Thanked 1 time in 1 post
Default

Hi Patrick,

Thanks for the quick and useful answer.

I cant be 100% sure but I seem to remember that the previous case of such scenario happening, I'd left my computer running/trading overnight. When checking the chart upon waking up (me not my computer!), I noticed that the there was an open position that was left open and should have been closed hours before. The only thing that seemed to happen in between the entry and the "would-have-been" exit is a loss of connection.
If I have "Keep Running" as an option for the strategy, should this behaviour occur? (ie I would expect that if the computer does not go into sleep mode, the strategy should keep executing signals when the connection comes back?)
Thanks
JezzaNT is offline  
Reply With Quote
Old 06-04-2012, 12:34 PM   #4
NinjaTrader_PatrickH
NinjaTrader Customer Service
 
NinjaTrader_PatrickH's Avatar
 
Join Date: Jul 2011
Location: Denver, CO, USA
Posts: 1,694
Thanks: 116
Thanked 193 times in 188 posts
Default

Hello JezzaNT,

Thank you for your response.

During a disconnect from your data feed there are options you can set on how the NinjaScript Strategy performs.

Please go to Tools > Options > Strategies > NinjaScript > On Connection Loss... Here you are given four options:
  • Disconnect delay seconds - This will determine how many seconds must pass before a disconnect is considered a disconnect for the Handling options.
  • Number of restart attempts - This will set the number of times NinjaTrader will attempt to restart a strategy on a reestablished connection.
  • Restarts within x minutes - This is amount of time in minutes that the Number of restart attempts will use.
  • Handling - You have three options here; KeepRunning, Recalculate, and StopStrategy.
The above settings will determine how a Strategy performs during a disconnect. You can find additional information at the following link: http://www.ninjatrader.com/support/h...tegies_tab.htm

Please let me know if I may be of further assistance.
NinjaTrader_PatrickH is offline  
Reply With Quote
Old 06-04-2012, 12:54 PM   #5
JezzaNT
Junior Member
 
Join Date: Jun 2012
Posts: 9
Thanks: 0
Thanked 1 time in 1 post
Default

Patrick,

Thanks for that. I did look at that help page and I think it could be clarified with a few examples.

If the Handling is set to "Keep Running" what happens if:
1- an entry order is executed
2- a disconnection occurs
3- the market price action generates an exit signal (while NT still being disconnected)
4- NT reconnects

Upon the reconnection, would the strategy in NT close the position (this does not seem to be what I am seeing)?
Or do I need "recalculate" for this?
JezzaNT is offline  
Reply With Quote
Old 06-04-2012, 01:56 PM   #6
NinjaTrader_PatrickH
NinjaTrader Customer Service
 
NinjaTrader_PatrickH's Avatar
 
Join Date: Jul 2011
Location: Denver, CO, USA
Posts: 1,694
Thanks: 116
Thanked 193 times in 188 posts
Default

Hello JezzaNT,

Thank you for your response.

Correct, as KeepRunning would continue on once connection was reestablished as if there was no disconnect and would not take into account the information during the disconnect.

However, Recalculate would take this into account but the recalculation would only occur based on the three factors detailed below:
  • If data feed disconnects for longer than the time specified in "Disconnect delay seconds", the strategy is stopped and the disconnect is logged.
  • If the order feed disconnects and the strategy places an order action while disconnected, the strategy is stopped and the disconnect is logged.
  • If both the data and order feeds disconnect for longer than the time specified in "Disconnect delay seconds", the strategy is stopped and the disconnect is logged.
Please let me know if I may be of further assistance.
NinjaTrader_PatrickH is offline  
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Strategy Signals JerryA Charting 9 03-21-2012 10:55 AM
Loss of connection optimuss Connecting 9 11-15-2011 01:07 PM
Strategy signals JerryA Automated Trading 2 09-09-2011 01:15 AM
Preventing Multiple ATM Entries daven Automated Trading 1 08-06-2011 06:04 PM
Preventing Two Strategies From Taking The Same Position The Big D Strategy Development 1 01-19-2011 03:12 AM


All times are GMT -6. The time now is 01:32 AM.