Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

verification of successfull order entry

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

    verification of successfull order entry

    Hello,
    what is the best way, how to verify that the order entry was successfull?
    If I use for example EnterLong() or EnterLongLimit() function for opening position I would like to be sure the position was openned without error. If I have some strategy and I want to open some position I think it is neccessary to use some cycle : while the position was not openned successfully (without error) then try to open it.... for example 10 times and if some error occur 10 times then I will do something - for example end the strategy or ..... I did not find any example in help how to verify the position was successfully openned. Every example in help expect successfull position openning. What is you opinion about it?
    Thanks for your help.
    Mira

    #2
    Originally posted by Mira123456789 View Post
    Hello,
    what is the best way, how to verify that the order entry was successfull?
    If I use for example EnterLong() or EnterLongLimit() function for opening position I would like to be sure the position was openned without error. If I have some strategy and I want to open some position I think it is neccessary to use some cycle : while the position was not openned successfully (without error) then try to open it.... for example 10 times and if some error occur 10 times then I will do something - for example end the strategy or ..... I did not find any example in help how to verify the position was successfully openned. Every example in help expect successfull position openning. What is you opinion about it?
    Thanks for your help.
    Mira
    https://ninjatrader.com/support/help...tionupdate.htm

    Comment


      #3
      Hello Mira123456789,

      Thank you for writing in and welcome to the NinjaTrader Support Forum!

      Just to clarify, are you trying to check if an entry order has filled?

      You can use OnExecution() to check for this.

      As an example:
      Code:
      protected override void OnBarUpdate()
      {
           EnterLong("Entry");
      }
      
      protected override void OnExecution(IExecution e)
      {
           if (e.Order.Name == "Entry" && e.Order.OrderState == OrderState.Filled)
                Print("Entry filled.");
      }
      More about OnExecution() can be found here: https://ninjatrader.com/support/help...nexecution.htm
      Zachary G.NinjaTrader Customer Service

      Comment


        #4
        Yes, I would like to know if the order from strategy was filled or some error occur.
        My question is what possibilities can happend? And from the answer I will know what is neccessary to check in the strategy.
        So I will check if the order was filled .... what can happend? Only filled or is it possible the order is only partial filled? And what to do if the order is only partial filled or not filled?
        It means some error occur and I have to try to set next EnterLong() or not? If the order is only partial filled does it mean the EnterLong() function ended and it is not possible the order will be fully filled after some ticks or not?
        In other words..... does it mean it is neccessary to use some loop? While the order is not fully filled set EnterLong()???
        If yes, how to do that? Is it ok below?


        protected override void OnBarUpdate()
        {
        EnterLong("Entry");
        }

        protected override void OnExecution(IExecution e)
        {
        if (e.Order.Name == "Entry"){
        if (e.Order.OrderState != OrderState.Filled){ // order isn't filled, I have to try it again
        EnterLong("Entry");
        }
        }
        }

        Comment


          #5
          Hello Mira123456789,

          Thank you for your response.

          I would use the OnOrderUpdate() method and pull the status of the order from there. You can pull it's OrderState to see if it is filled, cancelled, part-filled, etc.

          For information on OnOrderUpdate() please visit the following link: http://ninjatrader.com/support/helpG...rderupdate.htm

          Please let me know if you have any questions.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by argusthome, 03-08-2026, 10:06 AM
          0 responses
          64 views
          0 likes
          Last Post argusthome  
          Started by NabilKhattabi, 03-06-2026, 11:18 AM
          0 responses
          41 views
          0 likes
          Last Post NabilKhattabi  
          Started by Deep42, 03-06-2026, 12:28 AM
          0 responses
          22 views
          0 likes
          Last Post Deep42
          by Deep42
           
          Started by TheRealMorford, 03-05-2026, 06:15 PM
          0 responses
          25 views
          0 likes
          Last Post TheRealMorford  
          Started by Mindset, 02-28-2026, 06:16 AM
          0 responses
          52 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Working...
          X