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 cyberpete76, 03-27-2023, 12:29 AM
        7 responses
        267 views
        1 like
        Last Post slightly  
        Started by renewsaltwater, Today, 01:15 AM
        0 responses
        2 views
        0 likes
        Last Post renewsaltwater  
        Started by slightly, Today, 12:49 AM
        0 responses
        4 views
        0 likes
        Last Post slightly  
        Started by sdauteuil, 09-23-2021, 10:16 AM
        4 responses
        1,210 views
        0 likes
        Last Post jacobpescaia44  
        Started by agclub, 04-21-2024, 08:57 PM
        5 responses
        37 views
        0 likes
        Last Post agclub
        by agclub
         
        Working...
        X