![]() |
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
|
|||||||
| 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. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Junior Member
Join Date: May 2011
Posts: 3
Thanks: 0
Thanked 0 times in 0 posts
|
Is there a way I can generate error events to test my error handling code?
I'm primarily interested in testing my code for handling Order Rejected events due to such things and Market Closed errors from Interactive Brokers. |
|
|
|
|
|
#2 |
|
NinjaTrader Customer Service
Join Date: Dec 2011
Location: India
Posts: 3,286
Thanks: 580
Thanked 546 times in 541 posts
|
Hello itsnotme,
You can simply use the TraceOrders function to print out the values in the Output window. http://www.ninjatrader.com/support/h...raceorders.htm For more debugging tips please refer to this post http://www.ninjatrader.com/support/f...ead.php?t=3418 Please let me know if I can assist you any further.
Joydeep M.
NinjaTrader Customer Service |
|
|
|
|
|
#3 | |
|
Junior Member
Join Date: May 2011
Posts: 3
Thanks: 0
Thanked 0 times in 0 posts
|
Thank you for responding, but how to debug is not the question I asked.
I wish to exercise my code for handling errors before letting in run autonomously on a live market, to do this I need a way of generating ninjatrader error events. What is the recommended method of doing this type of testing? Quote:
|
|
|
|
|
|
|
#4 | |
|
Senior Member
|
Quote:
The other method would be to use a Try/Catch block and generate your own exception. Heck, you could even just use a code block/function to throw your own exceptions at will if you want.
Last edited by koganam; 06-05-2012 at 07:26 PM.
|
|
|
|
|
|
|
#5 |
|
NinjaTrader Customer Service
Join Date: Dec 2011
Location: India
Posts: 3,286
Thanks: 580
Thanked 546 times in 541 posts
|
Hello itsnotme,
As koganam said you have to submit some invalid orders (like buy stop at below current market close etc). You can use the OnOrderUpdate event to capture the order state. http://www.ninjatrader.com/support/h...rderupdate.htm Code:
protected override void OnOrderUpdate(IOrder order)
{
if (order.OrderState == OrderState.Rejected)
{
//do something
}
}
Please let me know if I can assist you any further.
Joydeep M.
NinjaTrader Customer Service |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| error generating indicator | dee50 | Installation and Licensing | 13 | 06-09-2011 10:46 AM |
| Error on generating Strategy | chakriare | Strategy Analyzer | 3 | 10-03-2010 04:42 PM |
| Error on Generating Strategy | andrgm | Strategy Development | 1 | 06-18-2010 02:13 PM |
| Error on generating Strategy | philotrader | ATM Strategies (Discretionary Trading) | 6 | 05-21-2010 09:15 PM |
| Error generating strategy | jbhansen7 | Strategy Development | 3 | 02-04-2009 07:24 AM |