Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

How do we trap an Overfill?

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

    How do we trap an Overfill?

    After receiving more Overfills that do not make sense: there was an Exit order to exit a short in one account, and an Entry order for a long in another, completely different account. They triggered at the same time, by the same condition, and I got an Overfill message.

    Therefore, I am exploring IgnoreOverfill, so that I can handle the situation on my own code. The problem is that looking through the log and the literature, I do not see how to trap the message of an Overfill. The only information seems to be, what the, obviously named, instruction does, and a dire warning to be careful. Where is the information on how my code will know that an Overfill has occurred, even as it ignores same?

    #2
    Hi koganam,

    If there has been an overfill on an order the IOrder handle will have an Overfill object that will be true.

    For example:

    private IOrder myOrder = null;

    myOrder = EnterLongLimit();

    if (myOrder.Overfill == true)
    // overfill detected
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_ChelseaB View Post
      Hi koganam,

      If there has been an overfill on an order the IOrder handle will have an Overfill object that will be true.

      For example:

      private IOrder myOrder = null;

      myOrder = EnterLongLimit();

      if (myOrder.Overfill == true)
      // overfill detected
      Thanks. Surprising that I did not see that when I RTFM: it is right in there, clear as day. Oops. Jeez.

      Comment


        #4
        Hi koganam,

        Very small oversight when compared to your level of mastery of NinjaScript-fu.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Hi ChelseaB,

          That way to detect an overfill, could it be done just in OnBarUpdate ? or does it go into OnOrderUpdate ?

          Thanks

          Comment


            #6
            Hi pstrusi,

            You can check an IOrder status from the IOrder.OrderState object to see if it is overfilled from OnBarUpdate or from any of the other real time methods. However, this would be slower than checking this in OnOrderUpdate.
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              Originally posted by NinjaTrader_ChelseaB View Post
              Hi koganam,

              If there has been an overfill on an order the IOrder handle will have an Overfill object that will be true.

              For example:

              private IOrder myOrder = null;

              myOrder = EnterLongLimit();

              if (myOrder.Overfill == true)
              // overfill detected
              How would it be if from a CancelOder ? where can I check that?

              I was given a great example in this forum:
              protected override void OnOrderUpdate(IOrder o)
              {
              if(o.OverFill)
              Print("Over fill");
              }
              Thanks


              NOTE: I'm sorry I've post this message after your quick answer :-)
              Last edited by pstrusi; 09-29-2015, 02:38 PM.

              Comment


                #8
                Hi pstrusi,

                If an order was cancelled the IOrder.OrderState will be cancelled.

                This again is faster to check in OnOrderUpdate but an be checked in OnBarUpdate.
                Chelsea B.NinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by pechtri, 06-22-2023, 02:31 AM
                9 responses
                122 views
                0 likes
                Last Post NinjaTrader_ChelseaB  
                Started by frankthearm, 04-18-2024, 09:08 AM
                16 responses
                66 views
                0 likes
                Last Post NinjaTrader_Clayton  
                Started by habeebft, Today, 01:18 PM
                1 response
                5 views
                0 likes
                Last Post NinjaTrader_ChelseaB  
                Started by benmarkal, Today, 12:52 PM
                2 responses
                14 views
                0 likes
                Last Post benmarkal  
                Started by f.saeidi, Today, 01:38 PM
                1 response
                8 views
                0 likes
                Last Post NinjaTrader_BrandonH  
                Working...
                X