Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to cancel an order that is not filled?

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

    How to cancel an order that is not filled?

    Hi!

    This is where I am:

    If (my condition)
    {
    atmStrategyId = GetAtmStrategyUniqueId();
    orderId = GetAtmStrategyUniqueId();
    AtmStrategyCreate(Cbi.OrderAction.Buy, OrderType.Limit, entryPrice, 0, TimeInForce.Day, orderId, "Str1", atmStrategyId);
    }
    And it's all ok. But...
    How can I cancel an order that is not filled? I would like to cancel that order, if not filled, after a number (decided by me) of bars.

    Any idea? Thanks!

    #2
    mirkocero,

    You can use AtmStrategyCancelEntryOrder() : http://www.ninjatrader.com/support/h...entryorder.htm

    You would need to keep track of the condition for doing so separately.

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

    Comment


      #3
      Thanks for the quick reply!

      I made this change:

      {
      barNumberOfOrder = CurrentBar;
      atmStrategyId = GetAtmStrategyUniqueId();
      orderId = GetAtmStrategyUniqueId();
      AtmStrategyCreate(Cbi.OrderAction.Buy, OrderType.Limit, entryPrice, 0, TimeInForce.Day, orderId, "Prova6E", atmStrategyId);
      }

      else if (CurrentBar > barNumberOfOrder + 10)
      {
      AtmStrategyCancelEntryOrder("Here???");
      }

      But in the Output window I've got this message: "Here???" does not exist. What I have to insert as "orderIdValue"?

      Thanks a lot!

      Comment


        #4
        Hi mirkocero,

        You will need to get the order from the Atm strategy. I suggest to become familiar with the sample atm strategy available. It's available in all NinjaTrader installation under Tools menu > Edit NinjaScript > SampleAtmStrategy, and you can then see how orderId is used.
        Ryan M.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by argusthome, 03-08-2026, 10:06 AM
        0 responses
        65 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        41 views
        0 likes
        Last Post NabilKhattabi  
        Started by Deep42, 03-06-2026, 12:28 AM
        0 responses
        23 views
        0 likes
        Last Post Deep42
        by Deep42
         
        Started by TheRealMorford, 03-05-2026, 06:15 PM
        0 responses
        26 views
        0 likes
        Last Post TheRealMorford  
        Started by Mindset, 02-28-2026, 06:16 AM
        0 responses
        52 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Working...
        X