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

AtmStrategyChangeStopTarget

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

    AtmStrategyChangeStopTarget

    I am trying to use this method in a strategy I've written to adjust my stop orders. However, no matter what I use as the orderName parameter, the code is changing the profit target order. How do I change the stop order with this method?

    #2
    toptrader,

    You need to use the order name of the entry order. Please post exact code snippet of what you currently have. Thank you.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      This code creates the ATM strategy...

      Code:
      atmStrategyId = GetAtmStrategyUniqueId();
      orderId = GetAtmStrategyUniqueId();
      AtmStrategyCreate(Cbi.Action.Buy, OrderType.Market, 0, 0, TimeInForce.Day, orderId, atmtemplate, atmStrategyId);
      This code is what I am using to try and change the stop...

      Code:
      AtmStrategyChangeStopTarget(0, stop, "STOP1", atmStrategyId);
      I see a parameter in AtmStrategyChangeStopTarget that allows me to define an order name, but I don't see where to define this name in the ATM strategy above.

      Comment


        #4
        Please try the atmStrategyId as string...i.e.

        Code:
         
        AtmStrategyChangeStopTarget(0, stop, "STOP1", "atmStrategyId");
        BertrandNinjaTrader Customer Service

        Comment


          #5
          The AtmStrategyId is a string, however it is a user input parameter so I can select which ATM template I want to use.

          Comment


            #6
            Not sure I follow you here, atmStrategyTemplate (the one you call from the SuperDOM / ChartTrader templates collection created) is not the same as the atmStrategyId to reference the active one in your script.
            BertrandNinjaTrader Customer Service

            Comment


              #7
              My mistake. AtmStrategyId is retrieved by calling GetAtmStrategyUniqueId(). AtmTemplate is a user input parameter. They are both strings.

              Comment


                #8
                toptrader,

                Please run through your code and debug the string for atmStrategyId. Make sure you are not changing it to something else while that current ATM is active. I suspect this to be the case.
                Josh P.NinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by sofortune, Yesterday, 11:48 AM
                2 responses
                22 views
                0 likes
                Last Post NinjaTrader_BrandonH  
                Started by Zach55, 02-19-2024, 07:22 PM
                2 responses
                52 views
                0 likes
                Last Post lbadisa1  
                Started by JGriff5646, Today, 05:47 PM
                1 response
                9 views
                0 likes
                Last Post NinjaTrader_BrandonH  
                Started by AlphaOptions, 06-18-2013, 08:24 AM
                9 responses
                2,199 views
                0 likes
                Last Post NinjaTrader_Manfred  
                Started by ttrader23, Today, 09:33 AM
                3 responses
                22 views
                0 likes
                Last Post NinjaTrader_BrandonH  
                Working...
                X