NinjaTrader Support Forum  

Go Back   NinjaTrader Support Forum > NinjaScript Development Support > Strategy Development

Strategy Development Support for the development of custom automated trading strategies using NinjaScript.

Reply
 
Thread Tools Display Modes
Old 03-24-2009, 03:11 PM   #1
DaveS
Senior Member
 
Join Date: Feb 2006
Location: London U.K.
Posts: 152
Thanks: 3
Thanked 2 times in 2 posts
Default SampleOnOrderUpdate

The following is a scrap of code from the OnExecution method.

// Resets the entryOrder object to null after the order has been filled or partially filled.
if (execution.Order.OrderState != OrderState.PartFilled)
{
entryOrder = null;
}

The comment does not seem to match the conditional logic.

In any event it seems to me that this conditional could never become true since it is contained within another conditional that has 'execution.Order.OrderState == OrderState.PartFilled' OR'd with other contitions.

Am I missing something?
DaveS is offline  
Reply With Quote
Old 03-24-2009, 03:23 PM   #2
NinjaTrader_Josh
NinjaTrader Product Manager
 
NinjaTrader_Josh's Avatar
 
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 107 times in 70 posts
Default

DaveS,

It works as intended as is. The overarching if-statement has many possible OrderStates. You want to reset the entryOrder to null on all OrderStates except the PartFilled one.
NinjaTrader_Josh is offline  
Reply With Quote
Old 03-24-2009, 03:28 PM   #3
DaveS
Senior Member
 
Join Date: Feb 2006
Location: London U.K.
Posts: 152
Thanks: 3
Thanked 2 times in 2 posts
Default

Yes, sorry, I misread the outer 'if' and that lead to a wrong expectation for the inner one - doh!
DaveS 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
On Cancel and Fill logic in SampleOnOrderUpdate binwang2 Strategy Development 1 02-12-2009 10:50 AM
SampleOnOrderUpdate Mike Winfrey Strategy Development 2 12-29-2008 08:27 AM


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