Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Overfill - how to read trace/log files to correct problem

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

    Overfill - how to read trace/log files to correct problem

    Hello,

    I'd like to learn how to track down and correct an overfill problem. If I understand right, only unmanaged strats can use the IgnoreOverFill feature.

    http://screencast.com/t/F3jxtASXhttp://screencast.com/t/F3jxtASX

    If you need, I can send files to support email. Otherwise, in the interest of training me or other intermediate coders how to find these problems, please list a couple suggestions to try to track down and correct the problem.

    Thanks,
    Kirk

    #2
    zeller4,

    I am happy to assist you,

    You can get overfills when you have a EnterLong() and ExitShort() occurring at the same time. To isolate the issue, you need to really look at your logic for doing either, and ensure that there isn't a logical state that would enable both to occur at the same time. Using a flag for example when one or the other is triggered that makes it so the other can't be triggered is a way of handling it.

    Otherwise, using the unmanaged approach here is the help guide entry :

    Over-Fills
    Over-Fills is a serious issue that can occur when using complex entry conditions that bracket the market in both directions end up with both entries being filled instead of one being cancelled. Over-Fills can also occur when you place a trade quickly hoping to close a position while a prior order to close the same position already had an in-flight execution. The exact scenarios in which an over-fill can occur is highly dependent on the specific strategy programming. By default, NinjaTrader will protect against over-fills even though you are using the Unmanaged approach by halting the strategy, but should you decide to custom program your own over-fill handling it is up to you to either prevent over-fills from being a possibility in your code or by introducing logic to address over-fills should one occur.

    Here is a link to information on handling overfills with unmanaged : http://www.ninjatrader.com/support/h...reoverfill.htm

    Please let me know if I may assist further.
    Adam P.NinjaTrader Customer Service

    Comment


      #3
      Thanks Adam,

      I think I isolated a potential problem...

      I'm running COBC false and managed approach.

      If I am moving a stop while the order is in place, I'm not sure if I need to cancel the stop first or if the new stopOrder will OCO or overwrite the previous location.

      Code:
      //original stop order is:
      stopOrder = ExitLongStop(0, true, 1, stopPrice, "stop", "long limit entry");
      
      //.............other order processing.............
      CancelOrder(stopOrder);
      stopOrder = ExitLongStop(0, true, stopOrder.Quantity, adjustedStopPrice, "MyStop", "");
      Because I'm still verifying the naming requirements of orders, I'm not sure if I need to add a if (FirstTickOfBar) or assign the names better. Possibly, I only need to name the new stop "stop" instead of "MyStop"???
      Thanks,
      kz

      Comment


        #4
        zeller4,

        It looks like you could possibly enter 2 stops if you have it this way, but Im not totally sure just from that little piece of code. Here are the tips from our help guide on using ExitLongStop().

        • This method is ignored if a long position does not exist
        • It is helpful to provide a signal name if your strategy has multiple exit points to help identify your exits on a chart
        • You can tie an exit to an entry by providing the entry signal name in the parameter "fromEntrySignal"
        • If you do not specify a quantity the entire position is exited rendering your strategy flat
        • If you do not specify a "fromEntrySignal" parameter the entire position is exited rendering your strategy flat

        The managed approach has more protections built in so you don't need to build them yourself usually. The only thing you need to be sure you aren't doing, at least to ensure there are no overfills, is exiting a long and entering a short at the same time (and vice verci) or submitting multiple stop / limit orders.

        Please let me know if I may assist further.
        Last edited by NinjaTrader_AdamP; 12-16-2011, 02:58 PM.
        Adam P.NinjaTrader Customer Service

        Comment


          #5
          To avoid an Over Fill exit ?

          simply make sure you reset your stop loss on the next bar update when flat.
          Over Fill happens a lot when a hanging stop rest pass a re-entry point.
          The system tries sometimes to re-enter on quick moves at a level between the entry and the stop loss.

          protected override void OnBarUpdate()
          {
          if (Position.MarketPosition == MarketPosition.Flat)
          {
          SetStopLoss("", CalculationMode.Ticks, 10, false);// make sure to reset stop @ 10 ticks from any entry and prevent over fill exits
          ---------
          ---------
          }
          }

          in this example, I make sure to reset a stop at 10 ticks which is my default stop loss on a strategy.
          I then change my stop strategy for a home made trailing stop. That's why I used to get the Over Fill window and strategy exit, leaving me with an open position.
          outch

          PiCoTrader
          Last edited by PiCoTrader; 01-16-2012, 02:34 PM.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          649 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          370 views
          1 like
          Last Post Geovanny Suaza  
          Started by Mindset, 02-09-2026, 11:44 AM
          0 responses
          109 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
          0 responses
          574 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          576 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X