Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Stop loss doesn't have correct quantity.

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

    Stop loss doesn't have correct quantity.

    Hello

    The position has 2 entries: FA1 and FA2
    Stop loss submitted with correct quantity but in fact is doesn't have correct quantity. So, the position (1 contract) remains opened.
    See attached log.


    ​​

    #2
    Hello ren37,

    I have removed the log from your post as this may contain sensitive information. Moving forward, if you would like a log analyzed, please send this in an email to support [at] ninjatrader.com.

    I'm only seeing one stop loss was submitted.

    May I confirm you are calling SetStopLoss() twice? Once using 'FA1' as the 'From entry signal' and the second using 'FA2' as the 'From entry signal'?
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Hey

      All senstive information has been replaced or removed from the log. I supposed you saved it for review.

      Here are 2 stop loss orders

      2024-09-10 14:54:00:811|1|32|Order='5616037947/1234567' Name='Stop loss' New state='Submitted' Instrument='MNQ SEP24' Action='Sell' Limit price=0 Stop price=18817 Quantity=2 Type='Stop Market' Time in force=GTC Oco='' Filled=0 Fill price=0 Error='No error' Native error=''

      2024-09-10 14:54:00:831|1|32|Order='5616037951/1234567' Name='Stop loss' New state='Change submitted' Instrument='MNQ SEP24' Action='Sell' Limit price=0 Stop price=18817 Quantity=2 Type='Stop Market' Time in force=GTC Oco='' Filled=0 Fill price=0 Error='No error' Native error=''

      Comment


        #4
        Hello ren37,

        I'm not seeing where 5616037951 was submitted.

        Was this removed from the log or submitted on a previous day?

        Are you connected to Rithmic?

        From the log I am only showing 1 stop order and 1 limit order were submitted after the two entry orders filled. The 5616037951 order appears to have been submitted sometime previous to the two entry orders filling.

        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Code:
          if (stopLossOrder == null)
          {
          if (Position.Direction == SignalDirection.Long)
          stopLossOrder = ExitLongStopMarket(0, true, Filled, value, Strategy.ORDER_NAME_STOPLOSS, SignalName);
          else
          stopLossOrder = ExitShortStopMarket(0, true, Filled, value, Strategy.ORDER_NAME_STOPLOSS, SignalName);
          }
          else
          ChangeOrder(stopLossOrder, Filled, 0, value);

          Comment


            #6
            Hey

            I don't see 5616037951 in the log. I'm sending the log to support@

            Comment


              #7
              It's a data connection from Ninja Brokerage.

              Comment


                #8
                Hello ren37,

                As a heads up, assign orders to variables from OnOrderUpdate() only and not from the order method call.

                From the help guide:
                "OnOrderUpdate() will run inside of order methods such as EnterLong() or SubmitOrderUnmanaged(), therefore attempting to assign an order object outside of OnOrderUpdate() may not return as soon as expected. If your strategy is dependent on tracking the order object from the very first update, you should try to match your order objects by the order.Name (signal name) from during the OnOrderUpdate() as the order is first updated."


                Seeing as these are not from SetStopLoss(), may I confirm the signal names of both exit stop orders are different and using the different From entry signals of the entries?
                Chelsea B.NinjaTrader Customer Service

                Comment


                  #9
                  No, the name for stop loss is a read only static member Strategy.ORDER_NAME_STOPLOSS for all entries.
                  Entry names a unique.

                  Comment


                    #10
                    Hello ren37,

                    That would cause the existing stop order to be modified and would not submit a new order.

                    Use unique signal names for the exit orders and use the from entry signal's of each entry.
                    Chelsea B.NinjaTrader Customer Service

                    Comment


                      #11
                      I will try. Thank you.

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by NullPointStrategies, Today, 05:17 AM
                      0 responses
                      39 views
                      0 likes
                      Last Post NullPointStrategies  
                      Started by argusthome, 03-08-2026, 10:06 AM
                      0 responses
                      124 views
                      0 likes
                      Last Post argusthome  
                      Started by NabilKhattabi, 03-06-2026, 11:18 AM
                      0 responses
                      64 views
                      0 likes
                      Last Post NabilKhattabi  
                      Started by Deep42, 03-06-2026, 12:28 AM
                      0 responses
                      41 views
                      0 likes
                      Last Post Deep42
                      by Deep42
                       
                      Started by TheRealMorford, 03-05-2026, 06:15 PM
                      0 responses
                      46 views
                      0 likes
                      Last Post TheRealMorford  
                      Working...
                      X