Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

my stop doesn't work

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

    my stop doesn't work

    I send a strategy. Why doesn´t work my stop order??
    Thanks.
    Attached Files

    #2
    Hello Parmenides48,

    Enable TraceOrders in State.Configure and print the order object in OnOrderUpdate() to get more information about what is happening to orders.
    https://ninjatrader.com/support/help...raceorders.htm
    https://ninjatrader.com/support/help.../nt8/print.htm
    https://ninjatrader.com/support/foru...121#post791121


    I see that your ExitLongStopMarket() call does not have isLiveUntilCancelled set to true, so this order would be automatically cancelled when the submission bar closes unless the order is re-submitted.
    https://ninjatrader.com/support/foru...374#post836374

    Enable TraceOrders to see if orders are being automatically expired when the submission bar closes.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Thanks for your answer,
      but, sorry,
      I can't see in my strategy script
      how to code isLiveUntilCancelled set to true.

      Comment


        #4
        Hello Parmenides48,

        Please review the forum post on isLiveUntilCancelled linked in post #2.


        ExitShortStopMarket(1, true, 1, execution.Order.AverageFillPrice + 20*TickSize, string.Empty, string.Empty);
        ExitLongStopMarket(int barsInProgressIndex, bool isLiveUntilCancelled, int quantity, double stopPrice, string signalName, string fromEntrySignal)
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Ok, I understand that the only way to mantain the stop order is adding all this parameters,
          because if I only use the stop order of my code, with only quantity and price parameters:


          else if ( mp== MarketPosition.Long)

          { ep= Position.AveragePrice;
          sp= ep-10*TickSize;


          if( Close[0] > sp)
          ExitLongStopMarket(1, sp);
          else
          ExitLong(1);



          it will work only with the first bar, and won´t be re-submitted on the next bars.
          Is like that?

          Comment


            #6
            Hello Parmenides48,

            Yes, you would need to use the overload with the isLiveUntilCancelled parameter set to true.

            Alternatively, your logic could resubmit the order re-using the same price on every bar to keep it alive.
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              I changed the stop order , with all this parameters,
              and in my logic I resubmit the order with the same price on every bar, but the stop order is still not working.
              The new codef or the stop order:


              else if ( mp== MarketPosition.Long)

              { ep= Position.AveragePrice;
              sp= ep-10*TickSize;


              if( Close[0] > sp)
              ExitLongStopMarket(0,true,1, sp, string.Empty, string.Empty );
              else
              ExitLong(1);

              }


              What is wrong ?




              Attached Files

              Comment


                #8
                Hello Parmenides48,

                It would be necessary to review the output from TraceOrders to understand when the order is being submitted, rejected, ignored, or cancelled.

                May I have the output from the output window?
                Chelsea B.NinjaTrader Customer Service

                Comment


                  #9
                  TraceOrders is set to true,
                  and that is the output window:
                  Attached Files

                  Comment


                    #10
                    Hello Parmenides48,

                    Is TraceOrders set to true in State.Configure?

                    From the forum post linked in post #2 on using print and trace orders:
                    "For a strategy and orders specifically, the next step is to set TraceOrders = true; in Initialize() for NinjaTrader 7 or in State.Configure within OnStateChange() of NinjaTrader 8.
                    If TraceOrders is set to true in State.SetDefaults instead of State.Configure, the change will not take effect until a new instance of the script is added. Defaults are only pulled for new instances.
                    In the Strategy Builder TraceOrders is set in the Defaults (and requires removing and adding a new instance).

                    TraceOrders will print to the output window when orders are being submitted (so we can see if they are being submitted) and also provides information if orders are being ignored or cancelled.

                    TraceOrders NT7 - https://ninjatrader.com/support/help...raceorders.htm
                    TraceOrders NT8 - https://ninjatrader.com/support/help...raceorders.htm

                    Further, print the order object within OnOrderUpdate.
                    Print(order.ToString());
                    These will provide information about when orders are being submitted, and provide the updates of orders as they become accepted, working, filled/cancelled.
                    OnOrderUpdate() NT7 - https://ninjatrader.com/support/help...rderupdate.htm
                    OnOrderUpdate() NT8 - https://ninjatrader.com/support/help...rderupdate.htm"
                    Chelsea B.NinjaTrader Customer Service

                    Comment


                      #11
                      I will to do it later.
                      thanks

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by NullPointStrategies, Yesterday, 05:17 AM
                      0 responses
                      62 views
                      0 likes
                      Last Post NullPointStrategies  
                      Started by argusthome, 03-08-2026, 10:06 AM
                      0 responses
                      134 views
                      0 likes
                      Last Post argusthome  
                      Started by NabilKhattabi, 03-06-2026, 11:18 AM
                      0 responses
                      75 views
                      0 likes
                      Last Post NabilKhattabi  
                      Started by Deep42, 03-06-2026, 12:28 AM
                      0 responses
                      45 views
                      0 likes
                      Last Post Deep42
                      by Deep42
                       
                      Started by TheRealMorford, 03-05-2026, 06:15 PM
                      0 responses
                      50 views
                      0 likes
                      Last Post TheRealMorford  
                      Working...
                      X