Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

AtmStrategyChangeStopTarget Not working

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

    AtmStrategyChangeStopTarget Not working

    I am trying to change a Stop order for but the AtmStrategyChangeStopTarget is not working. In the Long I keep getting:

    AtmStrategyChangeStopTarget() method error: OrderName 'STOP1' does not exist

    I am using this call:

    AtmStrategyChangeStopTarget(0,Open[0] +1 * TickSize, "STOP1", atmOrderId);

    Any idea's?

    At the point i am trying to change the Stop, the order has been filled.


    Thanks!
    B

    #2
    Hi bsamani,
    Please post more code so we can take a look at it, did you use the AtmStrategyCreate() beforehand to start the ATM strategy to that your call refers?



    You can also open 'SampleATMStrategy' in the NinjaScript editor to see a reference how to use those calls in combination.

    Comment


      #3
      Here is the entire section of code. I pretty much copied the code from the sample.





      string OrderId = GetAtmStrategyUniqueId();
      string atmOrderId = GetAtmStrategyUniqueId();
      if ( !AtmStrategyCreate(Action.Sell,OrderType.Limit,Clo se[0]- 1* TickSize, Open[0] + 1 * TickSize, TimeInForce.Day,
      OrderId,
      "BahramBreakout", atmOrderId) )
      {
      Print(
      "Order Not Accepted RED ===[" + OrderId + "], [" +atmOrderId + "]");
      }
      else
      {

      Print(
      "Order Accepted RED ===[" + OrderId + "], [" +atmOrderId + "]");
      AtmStrategyChangeStopTarget(Close[
      0] +12 * TickSize,Open[0] +1 * TickSize, "Stop1", atmOrderId);

      Print (
      " Storing Order Values Short Orders Before ["+ hashShortOrderIds.Count.ToString() + "]");
      hashShortOrderIds.Add(OrderId, atmOrderId);
      allOrderIds.Add(atmOrderId);
      Print (
      " Values Short Orders After ["+ hashShortOrderIds.Count.ToString() + "]");
      }

      Comment


        #4
        Hi, please try to use this changed snippet in the code...

        Code:
        AtmStrategyChangeStopTarget(Close[[SIZE=2][COLOR=#800080]0[/COLOR][/SIZE][SIZE=2]] +[/SIZE][SIZE=2][COLOR=#800080]12[/COLOR][/SIZE][SIZE=2] * TickSize,Open[[/SIZE][SIZE=2][COLOR=#800080]0[/COLOR][/SIZE][SIZE=2]] +[/SIZE][SIZE=2][COLOR=#800080]1[/COLOR][/SIZE][SIZE=2] * TickSize, [/SIZE][SIZE=2][COLOR=#800000]"STOP1"[/COLOR][/SIZE][SIZE=2], atmOrderId);[/SIZE]
        [SIZE=2][/SIZE]


        Comment


          #5
          I changed it and still I get the "Stop1" not found msg.

          Comment


            #6
            Did you create an ATM strategy template in the SuperDOM or ChartTrader named 'BahramBreakout' for reference for the strategy?

            Comment


              #7
              Yes. The order gets placed and using the ATM strategy with the correct Stop/Profit targets defined by the ATM strategy.

              But when I try to change the Stop, i get that error.

              Comment


                #8
                Could be that you are stopped out before you get a chance to adjust it, because you place the stop too tight with Open[0] + a tick.

                Comment


                  #9
                  No. The order is sill alive. I can see the order on the DOM.

                  Comment


                    #10
                    Do you try placing the trade manually and then changing the stop and target from NinjaScript?

                    Please also enable TraceOrders in your strategy to debug further - http://www.ninjatrader-support.com/H...aceOrders.html

                    Comment


                      #11
                      I placed the traceorder command and i still have the same issue.
                      Ninja keeps says Invalid name.

                      Comment


                        #12
                        Hi, then you may be checking too early in your code, before the actual ATM was started...you will see the checks in the SampleATMStrategy like

                        Code:
                        if (atmStrategyId.Length > 0)
                        {
                        change stop / target 
                        }
                        Please keep the relative position also in your own code intact...Thanks!

                        Comment


                          #13
                          in the code on the bottom, you can see that the Change happens after the create.
                          Also, the Stratgey ID is created right before the CreateStrategy call.

                          are those steps wrong?

                          Comment


                            #14
                            Hi, please check for this one, too - just like in the SampleATMStrategy

                            Code:
                            if (GetAtmStrategyMarketPosition(atmStrategyId) != MarketPosition.Flat)
                            It's a two step check with the previous post combined...

                            Comment


                              #15
                              Well, the Market Position says that the position is flat. So, Is there an event that gets triggered that I can access when an order gets filled or its status changes? other then OnBarUpdate?

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                              0 responses
                              631 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
                              566 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