Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Update stop loss quantity after taking half trade off

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

    Update stop loss quantity after taking half trade off

    Hi I seem to be having trouble with the stop losses after taking half the trade off. The stop loss is still set to the original quantity. For example, if the following calls are made in this order:

    SetStopLoss("A", CalculationMode.Ticks, 25, true);
    EnterLong(2, "A");

    //.... (and then some time passes and this happens when the conditions are right)

    SetStopLoss("A", CalculationMode.Price, XXX, true);

    // ... followed by some profit taking

    ExitLong(1, "Sell Half of A", "A");

    When the Stop Loss eventually gets triggered, it gets triggered with 2 contracts instead of 1, causing the net position to reverse instead of go flat.

    Am I missing something? Is it supposed to automatically update the position size and set the stop loss to 1 contract after half has been sold?

    Jeremy

    Note: I'm using NinjaTrader 7.0 Beta 17
    Jeremytang
    NinjaTrader Ecosystem Vendor - Shark Indicators

    #2
    Hello Jeremytang,

    Welcome to the NinjaTrader forums!

    The exit quantity will use the quantity of the signal it's tied to with the FromEntrySignal parameter. To scale out, you should first scale in with unique entry signal names. The reference sample below can help with setting this up:
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Thanks for the help, I managed to get something working. I take it when you submit two consecutive entry orders, I will get two separate orders submitted to the broker? Does NinjaTrader amalgamate the orders into one for the broker if they are identical orders (ie: 2 market orders).
      Jeremytang
      NinjaTrader Ecosystem Vendor - Shark Indicators

      Comment


        #4
        Yes, NinjaTrader would submit two separate orders in this case. It would not amalgamate the orders.
        Ryan M.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by argusthome, 03-08-2026, 10:06 AM
        0 responses
        85 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        48 views
        0 likes
        Last Post NabilKhattabi  
        Started by Deep42, 03-06-2026, 12:28 AM
        0 responses
        29 views
        0 likes
        Last Post Deep42
        by Deep42
         
        Started by TheRealMorford, 03-05-2026, 06:15 PM
        0 responses
        32 views
        0 likes
        Last Post TheRealMorford  
        Started by Mindset, 02-28-2026, 06:16 AM
        0 responses
        67 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Working...
        X