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

Over fill was detected on order

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

    Over fill was detected on order

    Hi
    I'm running a system since many months in live trading, and today, don't why, i have "an over fill was detected".

    Can you help ?
    you can see the print screen of the log

    thx
    Attached Files

    #2
    Hello Thomas79,

    Thanks for your message.

    NinjaTrader uses the following definition for over fills: "An overfill is categorized as when an order returns a "Filled" or "PartFilled" state after the order was already marked for cancellation. The cancel request could have been induced by an explicit CancelOrder() call, from more implicit cancellations like those that occur when another order sharing the same OCO ID is filled, or from things like order expirations."

    Over fills are often due to race conditions where a cancellation is sent, but the order gets filled before the cancellation gets processed at the exchange. OverFills can be ignored in NinjaScript strategies using the Unmanaged Approach, and the strategy can then take action on the overfill by looking at the order states to see if an order has come back as Filled or PartFilled after a PendingCancel, or by checking if an IOrder's OverFill property is true. Managed Approach strategies cannot handle overfills and will terminate.

    Below is some documentation on the Unmanaged Approach (so we can use IgnoreOverfill,) IgnoreOverfill (so we can keep the strategy running,) and OnOrderUpdate (where you can check for IOrder.OverFill or specific order states (orders filling before a cancellation is processed.)

    Unmanaged Approach — https://ninjatrader.com/support/helpGuides/nt7/unmanaged_approach.htm
    IgnoreOverFill — https://ninjatrader.com/support/help...reoverfill.htm
    OnOrderUpdate() — https://ninjatrader.com/support/help...rderupdate.htm
    Order State definitions — https://ninjatrader.com/support/help...efinitions.htm

    Let me know if there is anything else we can do to help.
    Last edited by NinjaTrader_Jim; 01-05-2022, 09:21 AM.
    JimNinjaTrader Customer Service

    Comment


      #3
      Hi Jim,

      thank you for your reply, i changed my script and add the unmanaged Approach and IgnoreOverFill Method. Concerning the OnOrderUpdate, it was already the case.

      When i run the strategy on backtest, i don't have any trade and in realtime, the strategy cannot be launched, on the Log i have "Error calling 'OnBarUpdate" method for strategy ..."EnterLongLimit" method can't be called on unmanaged strategies.

      Here the part of my script with the Initialize, OnbarUpdate with the EnterLongLimit order, OnbarUpdate with the EnterShortLimit order and the OnOrderUpdate (Iorder order)

      Can you help ?
      Attached Files

      Comment


        #4
        Hello Thomas79,

        Enter/Exit/Set methods are part of the Managed Approach. If you you want to make an Unmanaged strategy, you have to use SubmitOrder instead of these methods. My last Unmanaged link did not point to the Unmanaged Approach documentation so I corrected that link, also can be found below.



        I have also attached an example Unmanaged strategy that you can use to reference how unmanaged order methods are used.

        To identify an overfilled order, you may check:

        if (order.OverFill)

        in OnOrderUpdate.
        Attached Files
        JimNinjaTrader Customer Service

        Comment


          #5
          Hello Jim
          Thx a lot for your response, i made the modifications on my script, i'm going to run it in sim in the next few days.
          if i have a problem, i will ask you again.

          Thank you !

          Comment


            #6
            Hi Jim

            I tested last week on demo the unamaged order and it is working perfectly.

            Today i running it in realtime (my broker is AMP) and the buy or sell entries remained on "PendingSubmit" and there are not executed, weird.

            Can you help ?

            Regards,
            Thomas

            Comment


              #7
              Hello Thomas,

              Do you see this behavior with the Unmanaged Template script, or with your script?

              If you you only see the symptom with your script, there may be an issue with how the order submission methods are set up. You could then compare how the order submission methods are used between the two strategies to check for differences.

              If you have questions on some specific differences, please test just those modifications in the Unmanaged Template script.

              If that part is still unclear, you could show my that modification to the Unmanaged Template and I could review and test if needed.

              JimNinjaTrader Customer Service

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by yertle, Today, 08:38 AM
              3 responses
              10 views
              0 likes
              Last Post NinjaTrader_BrandonH  
              Started by NinjaTrader_ChelseaB, 01-08-2017, 06:59 PM
              80 responses
              19,667 views
              5 likes
              Last Post NinjaTrader_ChelseaB  
              Started by adeelshahzad, Today, 03:54 AM
              2 responses
              16 views
              0 likes
              Last Post adeelshahzad  
              Started by dappa, Today, 09:18 AM
              1 response
              6 views
              0 likes
              Last Post NinjaTrader_ChelseaB  
              Started by bill2023, Yesterday, 08:51 AM
              6 responses
              27 views
              0 likes
              Last Post NinjaTrader_Erick  
              Working...
              X