NinjaTrader Support Forum  

Go Back   NinjaTrader Support Forum > Application Technical Support > Connecting

Connecting Support for establishing connections to your broker or market data service provider.

Reply
 
Thread Tools Display Modes
Old 10-10-2011, 12:14 PM   #1
KBJ
Senior Member
 
Join Date: Mar 2007
Location: , Florida, USA
Posts: 663
Thanks: 36
Thanked 7 times in 6 posts
Default Auto Reconnect to CQG At End of Weekend & Replay Connect Errors in Custom Plot Method

I did a Disconnect then Connect to solve an issue I was having with CQG this morning.

When I did this Connect, I also noticed that the NinjaTrader bug still exists where either FirstBarIndexPainted and/or LastBarIndexPainted ends up with a value of -1 in the first call (after the Connect) to an indicator's custom GetMinMaxValues method or its custom Plot method.

This will in general cause an error for any indicators that use custom Plot/GetMinMaxValues methods that reference these values.

This is a long-standing bug for 7.0. (Sorry I thought I'd reported this before, but I must not have completed the posting.)

This also used to affect custom indicator use when connecting to Replay (I haven't used Replay in a while, so I'm not sure this is still an issue there, but I suspect it is, as I'd guess the problem is probably in Ninja's Connect code which gets called in either case.)

As a workaround I had been using code similar to the following in my indicators with custom Plot/GetMinMaxValues methods:

Code:
#if NT7									// For V7.0...
if ((FirstBarIndexPainted < 0) || (LastBarIndexPainted < 0))
{
	string errMsg = String.Format( "{0} = {1} - GetMinMaxValues - Negative bar number error(s) - FirstBarIndexPainted={2} LastBarIndexPainted={3}", 
					base.Name, DateTime.Now, FirstBarIndexPainted, LastBarIndexPainted );
	Print( errMsg );						// Display an error message in the Output window.
	Log( errMsg, LogLevel.Warning );		// Also display the error message in the Control Center's Log tab.
	return;	// Compensate for Replay slider bug in Ninja 7.0.1000.2 & earlier; error also seen on Connect after Disconnect done Monday morning 7.0.1000.7 (10-Oct-2011).
}
#else									// For V6.5...
int		FirstBarIndexPainted = ChartControl.LastBarPainted - ChartControl.BarsPainted + 1;	// First bar index painted wasn't defined in V6.5.
int		LastBarIndexPainted  = ChartControl.LastBarPainted;							// Last  bar index painted wasn't defined in V6.5.
#endif
KBJ is offline  
Reply With Quote
Old 10-10-2011, 01:50 PM   #2
NinjaTrader_Brett
NinjaTrader Customer Service
 
NinjaTrader_Brett's Avatar
 
Join Date: Dec 2009
Location: Denver, CO, USA
Posts: 6,498
Thanks: 109
Thanked 291 times in 280 posts
Default

Thanks for the post.

This could be the case, unfortuantely FirstBarIndexPainted and/or LastBarIndexPainted are not supported and are not listed in our help guide. Therefor these may or may not work as expected unfortunately. Thanks for sharing your workaround however, this may be useful to someone else that is using these unsupported methods.

Let me know if I can be of further assistance.
NinjaTrader_Brett is offline  
Reply With Quote
Old 10-14-2011, 09:27 PM   #3
KBJ
Senior Member
 
Join Date: Mar 2007
Location: , Florida, USA
Posts: 663
Thanks: 36
Thanked 7 times in 6 posts
Default

Quote:
Originally Posted by NinjaTrader_Brett View Post
This could be the case, unfortuantely FirstBarIndexPainted and/or LastBarIndexPainted are not supported and are not listed in our help guide. Therefor these may or may not work as expected unfortunately. Thanks for sharing your workaround however, this may be useful to someone else that is using these unsupported methods.

Let me know if I can be of further assistance.
Brett,

You might want to drop that last little bit -- at least in certain instances.

I know it's good manners (and possibly company policy) to ask if you can help. But (at least for me) when someone asks if there's some further way they can help me, and I don't feel like I've been helped (as in this case), for some strange reason this just tends to piss me off.

Maybe it's just me ... just semantics, possibly.

One of my problems is that I keep offering NinjaTrader help, and it's mostly not accepted. (You did accept my help and and were gracious about it -- so thank you for that.)

But do a forum search for "KBJ" and see how many suggestions I've made. I believe them to be well-thought-out and well written-up - I know you guys are busy so I've tried to make my suggestions easy to follow and easy to implement. Many of them are very small items possibly requiring as little as 5-10 minutes to complete. Collectively I feel my suggested changes would make the product much more usable and user-friendly. I have put literally hundreds of hours into these suggestions. And they've mostly just been ignored. And some of them for 2 or 3 years or more. (Sigh.)

Anyway, thanks for your offer.
KBJ 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
Auto Reconnect to CQG at the End of a Weekend KBJ Connecting 3 10-17-2011 07:06 AM
CQG Errors jasterm Connecting 4 07-08-2011 01:45 PM
Just installed 7.0.1000.5. Unable to connect to CQG (AMP) drecio Connecting 3 05-19-2011 09:53 AM
custom Plot() method AutoScale and PriceMarkers shawnj Indicator Development 0 06-08-2008 02:55 PM
Custom Plot colors & Thresholds & Price marker colors higler General Programming 5 06-22-2007 07:47 AM


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