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 Mindset, 04-21-2026, 06:46 AM
        0 responses
        101 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by M4ndoo, 04-20-2026, 05:21 PM
        0 responses
        144 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by M4ndoo, 04-19-2026, 05:54 PM
        0 responses
        69 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by cmoran13, 04-16-2026, 01:02 PM
        0 responses
        125 views
        0 likes
        Last Post cmoran13  
        Started by PaulMohn, 04-10-2026, 11:11 AM
        0 responses
        78 views
        0 likes
        Last Post PaulMohn  
        Working...
        X