Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Calling AtmStrategyCancelEntryOrder() terminates my strategy

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

    Calling AtmStrategyCancelEntryOrder() terminates my strategy


    Hi,


    Whenever I call AtmStrategyCancelEntryOrder() within my Ninjascript strategy to cancel an ATM created entry order, my entire strategy is immediately terminated. I need the strategy to continue analaysing for entries after cancelling the ATM strategy as it does after cancelling ordinary non-ATM managed entry orders.

    The ATM cancelling code is below, is there something that I doing wrong or is this the expected behaviour?


    string[] entryOrder;
    foreach (string atmStrategyId in ATMStratagyIDs)
    {
    entryOrder = GetAtmStrategyEntryOrderStatus(atmStrategyId);

    // checks if the entry order exists
    // and the order state is not already cancelled/filled/rejected
    if (entryOrder.Length > 0 && entryOrder[2] == "Working")
    {
    Print("Cancelling ATM Strategy Order");
    if(AtmStrategyCancelEntryOrder(atmStrategyId))
    ATMStratagyIDs.Remove(atmStrategyId);
    }
    }




    #2
    Hello dowtrader,

    Are there errors appearing on the Log tab of the Control Center?
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Hi Chelsea,

      There are no errors appearing on the Log tab of the Control Center.

      dowtrader

      Comment


        #4
        Hello dowtrader,

        A strategy will only become disabled if there is an error, or CloseStrategy() / SetState() is called, or if the Close button in a trade window or Flatten position is manually clicked.

        Just to confirm, if you comment out that one line the behavior stops? (I'm suspicious the attempt to remove the element from the collection is causing an error)
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Yes, if I comment out that one line the behavior definitely stops.

          Comment


            #6
            Hello dowtrader,

            I am not able to reproduce.


            Using the attached simple test script are you able to reproduce?
            AtmStrategyCancelEntryOrderTest_NT8.zip
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              Hi Chelsea,

              Thank you for going to the effort of producing such a detailed video - much appreciated. I’ll look into this further and get back to you as soon as possible.

              Many thanks,
              dowtrader

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by NullPointStrategies, Yesterday, 05:17 AM
              0 responses
              65 views
              0 likes
              Last Post NullPointStrategies  
              Started by argusthome, 03-08-2026, 10:06 AM
              0 responses
              139 views
              0 likes
              Last Post argusthome  
              Started by NabilKhattabi, 03-06-2026, 11:18 AM
              0 responses
              75 views
              0 likes
              Last Post NabilKhattabi  
              Started by Deep42, 03-06-2026, 12:28 AM
              0 responses
              45 views
              0 likes
              Last Post Deep42
              by Deep42
               
              Started by TheRealMorford, 03-05-2026, 06:15 PM
              0 responses
              50 views
              0 likes
              Last Post TheRealMorford  
              Working...
              X