NinjaTrader Support Forum  
X

Attention!

This website will be down for maintenance from Friday May 24th at 6PM MDT until Saturday May 25th at 11AM 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 > Miscellaneous Support

Miscellaneous Support Miscellaneous support issues.

Reply
 
Thread Tools Display Modes
Old 04-21-2008, 07:15 PM   #1
afeuer
Junior Member
 
Join Date: Mar 2008
Posts: 3
Thanks: 0
Thanked 0 times in 0 posts
Default Over night trading with IB

I have two questions about IB connections.

First every night around midnight there is a server change and you loose the data feeds for a certain amount of time.

Second, there is an auto logout feature that can't be turned off.

If I want to run strategies that trade over more than one day, can ninjatrader handle this reliably? What happens when IB kicks you off or looses data feeds? can you manually restart TWS without restarting and loosing graphs and such from NT? If you have to restart NT will it automatically add open positions to a strategy?
afeuer is offline  
Reply With Quote
Old 04-21-2008, 07:26 PM   #2
NinjaTrader_Ray
Administrator
 
NinjaTrader_Ray's Avatar
 
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,163
Thanks: 6
Thanked 45 times in 32 posts
Default

You can not run NT overnight with IB. IB forces a disconnect which requires a restart of NT to reconnect.
NinjaTrader_Ray is offline  
Reply With Quote
Old 04-21-2008, 07:31 PM   #3
afeuer
Junior Member
 
Join Date: Mar 2008
Posts: 3
Thanks: 0
Thanked 0 times in 0 posts
Default

Thanks, I kinda figured that I would have to restart everything.

1) So then is it possible to run strategies that don't exit all trades at the end of the day?

2) Do you loose all the data and calculations that your strategy made that day?

3) When you reopen NT, does it automatically add open positions back into the strategy?
afeuer is offline  
Reply With Quote
Old 04-21-2008, 08:07 PM   #4
NinjaTrader_Ray
Administrator
 
NinjaTrader_Ray's Avatar
 
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,163
Thanks: 6
Thanked 45 times in 32 posts
Default

1) No, strategies terminate as NT is terminated. This will change later this year.

2) Yes as per #1

3) No as per #1
NinjaTrader_Ray is offline  
Reply With Quote
Old 04-30-2008, 08:22 AM   #5
nintra
Member
 
Join Date: Feb 2008
Posts: 48
Thanks: 0
Thanked 0 times in 0 posts
Default This year end?

Need to restart NT due to external middle tier applications connection issues is definitely "beta" feature for NT that supposed to run automated strategies 24/7. Are you saing this will be fixed only in version 7.0 that coming some time when the year changes??


Another question related to IB TWS connectivity.
Is the starting TWS AND logging in is the necessity and the prerequisite to successful connection attempt from NT menu? I'm asking because of this two things together:
1. IB connection has the option for user credentials (optional), so I would assume NT should be able to start TWS on its own.
2. After misseing with suggested stanalone TWS build 882, web beta 883 and web release 884 and then stanaolne TWS minor update to 882.2 lately, seems I can't start TWS from NT.
NT throws the dialog window titled as Message with OK button:
Login failed: Invalid user or password, or system not available
Optional user credentials are entered correctly and the only way to connect is manually login into TWS first (either stanalone 882 or web 884 work the same on my Vista w/out SP and NT 6.5 release).
If that supposed to work this way then why the user name and password boxes for IB connection in NT? Or what should I do to fix that? I tried re-install of TWS 882, reboots etc. One thing noticed that even disabling all IB Connection run-time handling dialogs and auto-login NT features, NT still tries to close TWS Login window that it brings forward... weird.
nintra is offline  
Reply With Quote
Old 04-30-2008, 09:35 AM   #6
NinjaTrader_Ray
Administrator
 
NinjaTrader_Ray's Avatar
 
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,163
Thanks: 6
Thanked 45 times in 32 posts
Default

What I am saying is that in NT7 you will have the ability for NT to automatically connect when started.

1) Correct
2) It should work on the supported TWS 882 version
NinjaTrader_Ray is offline  
Reply With Quote
Old 05-02-2008, 04:00 AM   #7
Aussie2
Member
 
Join Date: Oct 2007
Location: Sydney
Posts: 78
Thanks: 0
Thanked 0 times in 0 posts
Default NT work around for IB TWS overnight disconnection

I am able to run NT overnight using my IB TWS connection without being logged out.

Each day I have to open up IB TWS and select Configure>Misc>Exit and change the am/pm or time as required, and then repeat the process before the new logout time occurs.

I would much prefer to have NT manage this and applaud the proposed version 7 changes. Thanks Ray!
Last edited by Aussie2; 05-02-2008 at 04:04 AM. Reason: Grammar
Aussie2 is offline  
Reply With Quote
Old 05-02-2008, 09:21 AM   #8
nintra
Member
 
Join Date: Feb 2008
Posts: 48
Thanks: 0
Thanked 0 times in 0 posts
Question Still problems to start TWS from NT...

Quote:
Originally Posted by Aussie2 View Post
I am able to run NT overnight using my IB TWS connection without being logged out.

Each day I have to open up IB TWS and select Configure>Misc>Exit and change the am/pm or time as required, and then repeat the process before the new logout time occurs.

I would much prefer to have NT manage this and applaud the proposed version 7 changes. Thanks Ray!
TWS shutdown is probably the sanity measure against JVM+TWS memory leaks. I think NT can have an option to flip/flop TWS shutdown time by 12h just changing a setting in some property file, no need to imitate user menu interactions (or I might be wrong if the property file has no watcher for its changing) - anyway, I guess this is the extra feature request for IB connection setup then... 1+

As to starting TWS by NT I got mixed and unreliable results (it works sometimes, but usually TWS Login dialog filled and then just disappears with eventual Login failure log, tried TWS 882 and current 884 standalone both). Have no idea how to make it work reliably. Maybe there is too short timeout for NT to login into TWS? Can it be adjusted somewhere?


Also, does NT uses newest IB TWS API available as extra AX_install.exe or it just utilizes API dll that is build into TWS distribution?
nintra is offline  
Reply With Quote
Old 05-02-2008, 06:55 PM   #9
Aussie2
Member
 
Join Date: Oct 2007
Location: Sydney
Posts: 78
Thanks: 0
Thanked 0 times in 0 posts
Default IB TWS Configure>Misc>Exit AM/PM "flip flop"

Hi Nintra

Used TotalUninstall to capture changes during a IB TWS Configure>Misc>Exit AM/PM "flip flop"

Two files were modified. Namely:
1. C:\Jts\dfjbqkvss\tws.tmp.xml
2. C:\Jts\log.Thu.txt

Had a peek at these - not sure how to determine if the .xml file is monitored by TWS.

Instead ......

If away from my computer rather than trying to get NT to auto login to IB TWS, I log in remotely using VNC and do the flip flop.

As a back up if I miss a flip flop I also use a strategy I wrote to monitor the IB connection status, and sms me on disconnection. I then log in using VNC and restart IB TWS.

My strategy code follows:

PHP Code:
protected override void OnConnectionStatus(ConnectionStatus orderStatusConnectionStatus priceStatus
  { 
  
string msgA "";
      if(
orderStatus==ConnectionStatus.ConnectionLost)
   {
   
msgA "Ninja Trader: ConnectionLost ";
   }
  if(
orderStatus==ConnectionStatus.Connected)
   {
   
msgA "Ninja Trader: Connected ";
   }
  if(
orderStatus==ConnectionStatus.Disconnected)
   {
   
msgA "Ninja Trader: Disconnected ";
   }
  if(
Position.MarketPosition == MarketPosition.Short)msgA=msgA+"- Short";
  else if(
Position.MarketPosition == MarketPosition.Long)msgA=msgA+"- Long";
  else 
msgA=msgA+"- Flat";
  
SendMail("xxxx""xxxxxx""Ninja Trader Connection"msgA); 
Typically I blank out the lines with ".ConnectionLost" or ".Connected" as IB often has many of these each day.

This is a simple work around that may assist pending NT v7 changes.

Regards
Last edited by Aussie2; 05-02-2008 at 07:47 PM. Reason: Correction
Aussie2 is offline  
Reply With Quote
Old 05-03-2008, 04:08 AM   #10
nintra
Member
 
Join Date: Feb 2008
Posts: 48
Thanks: 0
Thanked 0 times in 0 posts
Lightbulb NT Controller

Hi Aussie2

This script is a good feedback reminder. Maybe we should try to go one step further and run some controller application from it (instead of just sending email/SMS in hope someone would react)? Can we run an executable from NT strategy? Sure that might be C# too.

As for the TWS shutdown flip switch, the file seems to be temporary all-in-one TWS configuration file and that would be look more like hacking TWS internals, unfortunately. As I still can't get TWS started from NT, mybe the solution would be to write TWS & NT controller application/service that will watch and control both NT & TWS, i.e. (re)start them, login to TWS, connect NT to IB, flip TWS shutdown, report problems by email/SMS. Maybe someone already did this??

As to IB NT connection, I would assume one will want to make connection to paper account 1st, then to live trading one 2nd (to mitigate the limits of IB data feed streaming), correct? I have no idea whether the paper accounts feed match the live accounts exactly.
nintra is offline  
Reply With Quote
Old 05-13-2008, 04:53 AM   #11
Aussie2
Member
 
Join Date: Oct 2007
Location: Sydney
Posts: 78
Thanks: 0
Thanked 0 times in 0 posts
Default Paper Trading

Hello again,

Been away.

Not sure what others are doing or what is recommended, however I generally do not connect to IBs paper trading account.

When I want to carry out some backtesting I usually disconnect from IB (ie File>Disconnect) and rely on price data stored in the NT data base (ie I have Tools>Options>Data>General>Miscellaneous set to Store realtime bar data) This way I do not have to poll IB for data repeately.

When I want to carry out paper trading with say Chart Trader or the Super DOM then I simply put NT into simulation mode (ie File>Global Simulation Mode) All trades are then put through to a SIM101 NT account.

If you want to explore slippage impact then I suppose you could try IBs paper trading account although the above NT DOM/Chart method captures current market prices.
Last edited by Aussie2; 05-13-2008 at 04:54 AM. Reason: Grammar
Aussie2 is offline  
Reply With Quote
Old 02-22-2009, 04:19 PM   #12
r2kTrader
Senior Member
 
Join Date: Sep 2008
Posts: 483
Thanks: 0
Thanked 2 times in 2 posts
Default

Right on!

Check this out:
http://www.ninjatrader-support2.com/...8264#post78264


Quote:
Originally Posted by nintra View Post
Hi Aussie2

This script is a good feedback reminder. Maybe we should try to go one step further and run some controller application from it (instead of just sending email/SMS in hope someone would react)? Can we run an executable from NT strategy? Sure that might be C# too.

As for the TWS shutdown flip switch, the file seems to be temporary all-in-one TWS configuration file and that would be look more like hacking TWS internals, unfortunately. As I still can't get TWS started from NT, mybe the solution would be to write TWS & NT controller application/service that will watch and control both NT & TWS, i.e. (re)start them, login to TWS, connect NT to IB, flip TWS shutdown, report problems by email/SMS. Maybe someone already did this??

As to IB NT connection, I would assume one will want to make connection to paper account 1st, then to live trading one 2nd (to mitigate the limits of IB data feed streaming), correct? I have no idea whether the paper accounts feed match the live accounts exactly.
r2kTrader is offline  
Reply With Quote
Old 02-23-2009, 09:43 PM   #13
spinalwiz
Member
 
Join Date: Oct 2008
Posts: 60
Thanks: 0
Thanked 0 times in 0 posts
Default

Hi, there is a simple program you can get for free called IBController. its a really simple program that basically just keeps IB from logging off overnight - it works fairly reliably but i havent exactly tested it extensively. still need to restart it over the weekend it, but still a step forward from restarting every day!
spinalwiz is offline  
Reply With Quote
Old 02-24-2009, 06:12 AM   #14
r2kTrader
Senior Member
 
Join Date: Sep 2008
Posts: 483
Thanks: 0
Thanked 2 times in 2 posts
Default

1. Please refer to the following thread:
http://www.ninjatrader-support2.com/...ad.php?p=78590

2. The idea behind using an "autokey" type solution is complete flexibility. For example, if you restart your connection, what about your strategy? Also, what about non-IB accounts?



Quote:
Originally Posted by spinalwiz View Post
Hi, there is a simple program you can get for free called IBController. its a really simple program that basically just keeps IB from logging off overnight - it works fairly reliably but i havent exactly tested it extensively. still need to restart it over the weekend it, but still a step forward from restarting every day!
r2kTrader 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
Pair trading / Spread trading HelloHello Automated Trading 8 09-18-2010 08:55 PM
Accessing Globex instrument's last N night session's Min and Max prices Jim W. Indicator Development 4 06-01-2008 12:35 PM
backtesting vs. forward testing like night vs. day andrewbee Strategy Development 15 01-04-2008 10:48 PM
auto trading vs discretionary trading and limit orders John Sanders Automated Trading 3 11-07-2007 08:03 AM
is there a way to see if NT got disconnected at night HelloHello Automated Trading 1 10-03-2007 03:03 PM


All times are GMT -6. The time now is 07:58 PM.