Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

existing orders

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

    existing orders

    in my output window i keep getting repeat orders sent as conditions keep being met.

    as such i get Ignored PlaceOrder() method: ' Reason='There already is a matching order with same prices and quantity'

    is there a condition i can put in the code to check for existing order so that only unique orders presented in the output window

    #2
    Hello fiddy,

    Thank you for your inquiry.

    What you can do to prevent this message from continuously occurring in your output is by utilizing a boolean, for example, to prevent the order from being called again.

    As an example:
    Code:
    private bool alreadySubmitted = false;
    
    protected override void OnBarUpdate()
    {
         if (/*some entry condition*/ && alreadySubmitted == false)
         {
              EnterLongLimit(0, true, 1, 1000, "TheEntryOrder");
              alreadySubmitted = true;
         }
    }
    By setting the alreadySubmitted boolean to true, the if condition will not be true and EnterLongLimit(), with the same parameters, will not be called again.
    Zachary G.NinjaTrader Customer Service

    Comment


      #3
      thanks Zachary, how would you suggest resetting it to false once the position has been exited so multiple trades can be done.
      i cannot use Position.MarketPosition == MarketPosition.Flat as if the order hasnt been filled yet i will start to get output again

      Comment


        #4
        Originally posted by fiddy View Post
        thanks Zachary, how would you suggest resetting it to false once the position has been exited so multiple trades can be done.
        i cannot use Position.MarketPosition == MarketPosition.Flat as if the order hasnt been filled yet i will start to get output again
        Use the OnPositionUpdate() handler, and reset the bool if Position.Quantity is zero.

        Comment


          #5
          Hello fiddy,

          koganam provides a great way to check if you are out of the position.

          More about OnPositionUpdate() can be found in the NinjaTrader help guide here: http://ninjatrader.com/support/helpG...tionupdate.htm

          Please, let us know if we may be of further assistance.
          Zachary G.NinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          646 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          367 views
          1 like
          Last Post Geovanny Suaza  
          Started by Mindset, 02-09-2026, 11:44 AM
          0 responses
          107 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
          0 responses
          569 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          573 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X