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 kujista, Today, 06:23 AM
        4 responses
        13 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by traderqz, Yesterday, 09:06 AM
        2 responses
        15 views
        0 likes
        Last Post traderqz  
        Started by traderqz, Today, 12:06 AM
        3 responses
        6 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Started by RideMe, 04-07-2024, 04:54 PM
        5 responses
        28 views
        0 likes
        Last Post NinjaTrader_BrandonH  
        Started by f.saeidi, Today, 08:13 AM
        1 response
        8 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Working...
        X