Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

IgnoreOverFill = true; is still shutting down the strategy

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

    IgnoreOverFill = true; is still shutting down the strategy

    I have IgnoreOverFill = true; in initialize section but when the instance occurs, I still get an error. The strategy manages the position until it's closed, but then terminates it. How do I keep the strategy running?

    #2
    Hello Tdschulz,

    Are you using the Managed or Unmanaged approach for your Order Methods?

    http://www.ninjatrader.com/support/h...er_methods.htm

    Happy to be of further assistance.
    JCNinjaTrader Customer Service

    Comment


      #3
      Unmanaged. I've attached the strategy. To generate the overfill quickly, apply the strategy on a 1R CL 01-13 chart. It may work for awhile but usually within 10 - 15 minutes of active morning trading should result in an overfill.
      Attached Files
      Last edited by Tdschulz; 12-06-2012, 10:43 AM.

      Comment


        #4
        Upon further reading, I see that I am still using the managed approach. I thought using IOrder was considered "unmanaged." Is there a Sample script using unmanaged approach?

        Comment


          #5
          I now am using Unmanaged although I'm not sure how to cancel orders. when the position is open initially, "stopOrderlong" and "targOrderlong" are placed. When the position is added to, I need to cancel the previous "stopOrderlong" and "targetOrderlong" as new orders are being placed with the new quantity. Can you give me some hints about cancelling them, where to insert the code, etc?
          Code:
           protected override void OnExecution(IExecution execution)
                  {
          			/* We advise monitoring OnExecution to trigger submission of stop/target orders instead of OnOrderUpdate() since OnExecution() is called after OnOrderUpdate()
          			which ensures your strategy has received the execution which is used for internal signal tracking. */
          			{
          			if (entryOrderlong != null && entryOrderlong == execution.Order)
          			{
          				if (execution.Order.OrderState == OrderState.Filled || execution.Order.OrderState == OrderState.PartFilled || (execution.Order.OrderState == OrderState.Cancelled && execution.Order.Filled > 0))
          				{	
          //					
          					// Stop-Loss order
          					stopOrderlong 	= SubmitOrder(0, OrderAction.Sell, OrderType.Stop, Position.Quantity, 0, Position.AvgPrice - Instrument.MasterInstrument.Round2TickSize(stoploss*(int)quantity1/(Math.Max(Position.Quantity,1))*TickSize/tickValue), "LongEntry", "LongStop");
          					//ExitLongStop(0, true, Position.Quantity, Position.AvgPrice - Instrument.MasterInstrument.Round2TickSize(stoploss*(int)quantity1/(Math.Max(Position.Quantity,1))*TickSize/tickValue) , "LongStop", "LongEntry");
          					
          					// Target order 
          					targetOrderlong = SubmitOrder(0, OrderAction.Sell, OrderType.Limit, Position.Quantity, Position.AvgPrice + (target * TickSize),0, "LongEntry", "LongTarget");
          					//ExitLongLimit(0, true, Position.Quantity, Position.AvgPrice + (target * TickSize), "LongTarget", "LongEntry");
          										
          					// Resets the entryOrder object to null after the order has been filled
          					if (execution.Order.OrderState != OrderState.PartFilled)
          					{
          						entryOrderlong 	= null;
          					}
          										
          				}

          Comment


            #6
            Please let us know if the help we provided via email did not work or if you have any questions on that.
            MatthewNinjaTrader Product Management

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            653 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
            577 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X