Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

define execution.Order

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

    define execution.Order

    Can you please give me a description of what NinjaTrader is reading when it comes across

    Code:
    LongEntry == execution.Order
    Does this mean that the order has been placed or the order has been executed and filled? Or does it mean something completely different?

    Thanks for your help!

    #2
    Hi jg123,

    Thanks for your post.

    The execution is usually used with OnExecution(). If OnExecution() is running that means that the order has filled.

    The line of code you posted will take the order from that execution and save the IOrder object to a variable named LongEntry.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Okay, that helps to clear things up. Thanks

      There is a purpose to the question, in that I am trying to make a couple of adjustments to my already existing code. In OnExecution I have the following:

      Code:
      				if (LongEntry != null
      					&& LongEntry == execution.Order)
      				{
      					LongStop = ExitLongStop(0, true, positionSize, LongStopPrice,"LongStop", "BreakoutLong");
      					Print("Long Stop = " + LongStopPrice);
      					LongTarget = ExitLongLimit(0, true, positionSize, LongTargetPrice, "LongTarget", "BreakoutLong");
      					Print("Long Target = " + LongTargetPrice);
      					restrictTrade = true;
      					LongEntry = null;
      				}
      But I want to change when LongEntry is set to null. Instead of being set to null when LongEntry is filled, I would like to set it to null when either LongStop or LongTarget are filled.

      Therefore, based on if I am understanding you correctly, I should be able to write the following, correct?

      Code:
      if (LongEntry != null
           && LongEntry == execution.Order)
      {
           LongStop = ExitLongStop(0, true, positionSize, LongStopPrice, "LongStop", "BreakoutLong");
           LongTarget = ExitLongLimit(0, true, positionsize, LongTargetPrice, "LongTarget", "BreakoutLong");
      }
      
      if (LongStop != null
          && LongStop == execution.Order
          || LongTarget == exeuction.Order)
      {
           LongEntry = null;
      }
      If that is not correct, could you point me in the right direction to set LongEntry to null only after LongStop OR LongTarget are filled?

      Comment


        #4
        Originally posted by jg123 View Post
        Okay, that helps to clear things up. Thanks

        There is a purpose to the question, in that I am trying to make a couple of adjustments to my already existing code. In OnExecution I have the following:

        Code:
                        if (LongEntry != null
                            && LongEntry == execution.Order)
                        {
                            LongStop = ExitLongStop(0, true, positionSize, LongStopPrice,"LongStop", "BreakoutLong");
                            Print("Long Stop = " + LongStopPrice);
                            LongTarget = ExitLongLimit(0, true, positionSize, LongTargetPrice, "LongTarget", "BreakoutLong");
                            Print("Long Target = " + LongTargetPrice);
                            restrictTrade = true;
                            LongEntry = null;
                        }
        But I want to change when LongEntry is set to null. Instead of being set to null when LongEntry is filled, I would like to set it to null when either LongStop or LongTarget are filled.

        Therefore, based on if I am understanding you correctly, I should be able to write the following, correct?

        Code:
        if (LongEntry != null
             && LongEntry == execution.Order)
        {
             LongStop = ExitLongStop(0, true, positionSize, LongStopPrice, "LongStop", "BreakoutLong");
             LongTarget = ExitLongLimit(0, true, positionsize, LongTargetPrice, "LongTarget", "BreakoutLong");
        }
        
        if (LongStop != null
            && LongStop == execution.Order
            || LongTarget == exeuction.Order)
        {
             LongEntry = null;
        }
        If that is not correct, could you point me in the right direction to set LongEntry to null only after LongStop OR LongTarget are filled?
        You are missing brackets for the logic, but it will likely work correctly anyway.
        Code:
        if (LongStop != null
            && [B][COLOR=Red]([/COLOR][/B]LongStop == execution.Order
            || LongTarget == exeuction.Order[B][COLOR=Red])[/COLOR][/B]) ...

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        571 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        330 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        101 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        548 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        549 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X