Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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 timko, Today, 06:45 AM
        1 response
        7 views
        0 likes
        Last Post gaz0001
        by gaz0001
         
        Started by Waxavi, 04-19-2024, 02:10 AM
        3 responses
        41 views
        0 likes
        Last Post gaz0001
        by gaz0001
         
        Started by Max238, Today, 01:28 AM
        2 responses
        26 views
        0 likes
        Last Post NinjaTrader_ChristopherJ  
        Started by Shansen, 08-30-2019, 10:18 PM
        25 responses
        949 views
        0 likes
        Last Post NinjaTrader_BrandonH  
        Started by JonesJoker, 04-22-2024, 12:23 PM
        8 responses
        42 views
        0 likes
        Last Post JonesJoker  
        Working...
        X