Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strategy Error from ATM

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

    Strategy Error from ATM

    I get this error in my Log file: AtmStrategyClose() method error: AtmStrategyId 'AtmStrategyTemplate' does not exist.

    Here is an example exit condition...

    if (CrossAbove(DM(10).DiPlus, ADX(10), 1))
    {
    atmStrategyId = GetAtmStrategyUniqueId();
    orderId = GetAtmStrategyUniqueId();
    AtmStrategyClose("AtmStrategyTemplate");
    }

    #2
    Hello brucelevy,
    Thanks for posting today.

    The AtmStrategyClose() method calls for the string AtmStrategyId. The item you have listed is a template, not the ID that is submitted as parameter. You must call the original AtmStrategyId from when the order was placed. You will need to call AtmStrategyClose(string AtmStrategyId); with the original AtmStrategyId to trigger the close routine for the original ATM strategy you are trying to close. Here is a link to documentation on this method.
    http://www.ninjatrader.com/support/h...ategyclose.htm

    Currently, you are resetting the atmStrategyId to a new value and can not be use this directly as the desired ID.

    If you wish to reset this value for exiting, please refer to the sample atm strategy that we have pre-built in the NinjaTrader platform; Tools -> Edit NinjaScript -> Strategies -> SampleAtmStrategy

    Please let us know if we may be of further assistance for anything NinjaTrader.
    Alex G.NinjaTrader Customer Service

    Comment


      #3
      if (CrossAbove(DM(10).DiPlus, ADX(10), 1))

      {
      AtmStrategyClose(string AtmStrategyId);


      }

      I get the error in the programming: string does not contain a definition for atmstrategyid

      Comment


        #4
        Hello brucelevy,
        Thanks for the reply.

        If you use the the line of code as written a compile error is going to be thrown.
        Code:
        AtmStrategyClose(string AtmStrategyId);
        In the AtmStrategyClose() method will not use the AtmStrategyId because of the string variable type in front of AtmStrategyId. It should be written where AtmStrategyId is a string variable representing an ATM strategy ID.
        Code:
        AtmStrategyClose(AtmStrategyId); 
        AtmStrategyClose("idValue");
        Reference the SampleAtmStrategy and see how the private string atmStrategyId variable is used.
        Alex G.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        630 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        364 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        105 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        565 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        568 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X