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 fx.practic, 10-15-2013, 12:53 AM
                5 responses
                5,406 views
                0 likes
                Last Post Bidder
                by Bidder
                 
                Started by Shai Samuel, 07-02-2022, 02:46 PM
                4 responses
                98 views
                0 likes
                Last Post Bidder
                by Bidder
                 
                Started by DJ888, Yesterday, 10:57 PM
                0 responses
                8 views
                0 likes
                Last Post DJ888
                by DJ888
                 
                Started by MacDad, 02-25-2024, 11:48 PM
                7 responses
                160 views
                0 likes
                Last Post loganjarosz123  
                Started by Belfortbucks, Yesterday, 09:29 PM
                0 responses
                9 views
                0 likes
                Last Post Belfortbucks  
                Working...
                X