Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

SampleOnOrderUpdate question

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    SampleOnOrderUpdate question

    I've been looking at SampleOnOrderUpdate and I've been trying to make some sense out of the following...

    Code:
    [COLOR="SeaGreen"]// Resets the entryOrder object to null after the order has been filled or [B][U]partially filled[/U][/B][/COLOR]
    [COLOR="RoyalBlue"]if [/COLOR](execution.Order.OrderState != OrderState.PartFilled)
    {
    	entryOrder 	= [COLOR="RoyalBlue"]null[/COLOR];
    }
    (Emphasis added.)

    Anyone want to help me out here?

    P.S. It would be lots nicer if we could post these comments (and requests for clarification) to the threads which describe the samples, where others could benefit from it as well instead of in an entirely new topic.

    #2
    Hello KBJ,

    The code block you posted is a generic example. That section of code is an example of checking for a non-partial fill order state. You may have a need to do this in your strategy. If you don't, you don't have to use.
    Last edited by NinjaTrader_RyanM1; 05-27-2011, 02:07 PM.
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_RyanM View Post
      Hello KBJ,

      Thanks for the post and welcome to the NinjaTrader forums. The code block you posted is a generic example. That section of code is an example of checking for a non-partial fill order state. You may have a need to do this in your strategy. If you don't, you don't have to use.
      Yes, I know what it does, but the comment says something completely opposite to what the code does.

      I was just posting because there's of this inconsistency between the comments and the code which is liable to confuse someone who's trying to learn what this is all about.

      It's no longer important to me, I've already figured out what's what here.

      I just thought it would be nice if someone fixed the file so that others who haven't been using NinjaTrader for 4+ years (like myself) won't get confused by this.

      You could assign it a number and someone will probably get to it by 2014 or so.

      Or just take the 2-minutes it would take to understand what I've written and just fix the example. Your choice.

      Comment


        #4
        Hi KBJ, thank you for posting this mistake :-) I'm a beginner, and i considered all day, am i wrong or is this a mistake?.. till i found your post. There are a lot of things i don't understand and with my knowledge, I often think this or that is inconsistent. :-)
        But what is the correct code? Is it:

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

        I hope, this is the only mistake in this sample.


        Thank you and regards
        cago2

        Comment


          #5
          Hi KBJ, cago2, we will look into this.
          AustinNinjaTrader Customer Service

          Comment


            #6
            The files have been updated.

            Cago2, the correct way to do this is as it is in the sample (reproduced below). The PartFilled scenario is dealt with if the order is cancelled after it is only partially filled.
            Code:
            if (execution.Order.OrderState != OrderState.PartFilled)
            {
                entryOrder     = null;
            }
            AustinNinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            650 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            370 views
            1 like
            Last Post Geovanny Suaza  
            Started by Mindset, 02-09-2026, 11:44 AM
            0 responses
            109 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by Geovanny Suaza, 02-02-2026, 12:30 PM
            0 responses
            574 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            577 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X