Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

'AtmStrategyChangeStopTarget' method error: Order name 'STOP1' is invalid

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

    'AtmStrategyChangeStopTarget' method error: Order name 'STOP1' is invalid

    Hello.
    I made my first ATM strategy.

    This line:
    PHP Code:
    AtmStrategyChangeStopTarget(0Stop_Loss_Price"STOP1"Atm_Strategy_Id); 
    caused this error message in OutputWindow:
    'AtmStrategyChangeStopTarget' method error: Order name 'STOP1' is invalid

    Code was copied from SampleAtmStrategy.cs.
    Need help.
    Thank You.
    fx.practic
    NinjaTrader Ecosystem Vendor - fx.practic

    #2
    Hello fx.practic,

    Thank you for your note.

    If you replace, "STOP1" with fx.practic "Stop1", do you no longer receive the error?

    https://ninjatrader.com/support/help...stoptarget.htm

    I look forward to your reply.
    Alan P.NinjaTrader Customer Service

    Comment


      #3
      It's work.
      Will it work same way on other systems if I will share strategy to some other peoples?
      fx.practic
      NinjaTrader Ecosystem Vendor - fx.practic

      Comment


        #4
        Hello fx.practic,

        If the strategy runs correctly on your machine it should run correctly on any other machine, assuming all else being equal.

        Please let us know if you need further assistance.
        Alan P.NinjaTrader Customer Service

        Comment


          #5
          Can I change StopLoss and Target price in AtmStrategyCreate call back function, like this:

          PHP Code:
                                  AtmStrategyCreate(OrderAction.BuyOrderType.Market0Sit_Long.Order_Price_ActualTimeInForce.DaySit_Long.Atm_Order_IdC.Atm_Slected_NameSit_Long.Atm_Strategy_Id, (atmCallbackErrorCodeatmCallBackId) => 
                                  { 
                                      
          //check that the atm strategy create did not result in error, and that the requested atm strategy matches the id in callback
                                      
          if (atmCallbackErrorCode == ErrorCode.NoError && atmCallBackId == Sit_Long.Atm_Strategy_Id)
                                      {                                
                                          
          Sit_Long.Atm_Is_Created true;
                                          
          Sit_Long.Atm_Error_Code atmCallbackErrorCode;
                                          
          //Print( Sit_Long.Atm_Error_Code );
                                                                      
                                          
          double sl_price GetCurrentBid() -TickSize;
                                          for( 
          int i 0<= 2i++ ) if( sl_price Low[i] ) sl_price Low[i];
                                          Print( 
          Time[0] +" ; "+   GetCurrentBid() +" ; "sl_price );
                                  
                                          
          AtmStrategyChangeStopTarget(0sl_price"Stop1"Sit_Long.Atm_Strategy_Id  );
                                      }
                                  }); 


          This code giver error on both names: "STOP1" and "Stop1" (please, look at screenshot in attachment)
          Attached Files
          fx.practic
          NinjaTrader Ecosystem Vendor - fx.practic

          Comment


            #6
            Hello fx.practic,

            It may be that you are attempting to call the order before it is in a working state.

            May I confirm the entry order has filled before this line is called?
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              I try to change stop ASAP after strategy successfully created.
              I want strategy to work with Calculate.OnBarClose() - and wait for next bar to change stop is dangerous.

              As for I understand, I have 2 ways:
              1) to use Calculate.OnEachTick() (and to change stop on next tick after order filled
              2) to use usual orders (SetStopLoss(), EnterLong())

              Is it right?
              fx.practic
              NinjaTrader Ecosystem Vendor - fx.practic

              Comment


                #8
                Hello fx.practic,

                That would not be possible.

                When the entry order is created, it hasn't filled yet and the stop loss and profit targets will not yet have been submitted.

                You will need to wait until these orders exist to modify them.

                If the initial settings are incorrect, you may need to create a new Atm Strategy template.


                Yes, you can wait for the next tick and then check that the entry has filled and then check the state of those orders to be working and then modify them if you would like.

                Or yes, you can choose to not use Atm Strategy methods and instead use methods internal to NinjaScript Strategies.
                Chelsea B.NinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by muratb35, Today, 03:36 AM
                0 responses
                3 views
                0 likes
                Last Post muratb35  
                Started by fernlicht, Today, 02:16 AM
                2 responses
                12 views
                0 likes
                Last Post fernlicht  
                Started by fernlicht, 04-12-2021, 06:01 PM
                1 response
                29 views
                0 likes
                Last Post NinjaTrader_PaulH  
                Started by memonolog, Today, 02:10 AM
                3 responses
                8 views
                0 likes
                Last Post memonolog  
                Started by orenytz, Today, 12:25 AM
                0 responses
                10 views
                0 likes
                Last Post orenytz
                by orenytz
                 
                Working...
                X