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 TheMarlin801, 10-13-2020, 01:40 AM
        20 responses
        3,913 views
        0 likes
        Last Post Bidder
        by Bidder
         
        Started by timmbbo, 07-05-2023, 10:21 PM
        3 responses
        150 views
        0 likes
        Last Post grayfrog  
        Started by Lumbeezl, 01-11-2022, 06:50 PM
        30 responses
        805 views
        1 like
        Last Post grayfrog  
        Started by xiinteractive, 04-09-2024, 08:08 AM
        3 responses
        11 views
        0 likes
        Last Post NinjaTrader_Erick  
        Started by Johnny Santiago, 10-11-2019, 09:21 AM
        95 responses
        6,194 views
        0 likes
        Last Post xiinteractive  
        Working...
        X