![]() |
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
|
|||||||
| Strategy Development Support for the development of custom automated trading strategies using NinjaScript. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Senior Member
Join Date: Sep 2008
Posts: 185
Thanks: 20
Thanked 2 times in 2 posts
|
Hello,
I'm using various print statements to check orderstates in my custom strategy using Unmanaged = true. I continue to get error messages:specifically "Object reference not set to an instance of an object". Is this a valid print statement? Code:
Print("longOrder.OrderState:\t"+longOrder.OrderState);
Or do I first need to check for null? Code:
if (longOrder != null) Print("longOrder.OrderState:\t"+longOrder.OrderState);
Thanks, Kirk |
|
|
|
|
|
#2 |
|
NinjaTrader Customer Service
Join Date: Sep 2008
Location: Germany
Posts: 22,419
Thanks: 252
Thanked 981 times in 963 posts
|
Kirk, correct you should add a != null check before attempting to access the IOrder objects in your prints.
http://www.ninjatrader.com/support/f...ead.php?t=4226
Bertrand
NinjaTrader Customer Service |
|
|
|
|
|
#3 |
|
Senior Member
Join Date: Sep 2008
Posts: 185
Thanks: 20
Thanked 2 times in 2 posts
|
Thanks Bertrand,
I appreciate the link. Kirk |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| 'If' statements with BarColor comand | KLG08 | General Programming | 3 | 01-24-2010 11:46 PM |
| Statements if/true/false | skikg | General Programming | 2 | 12-09-2009 01:45 PM |
| Live Print statements | jerimac2 | Automated Trading | 2 | 09-29-2009 10:42 AM |
| IF Statements | bologc | NinjaScript File Sharing Discussion | 3 | 09-03-2009 08:48 AM |
| statements ignored | Burga1 | General Programming | 8 | 06-30-2008 10:36 PM |