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 burtoninlondon, Today, 12:38 AM
        0 responses
        5 views
        0 likes
        Last Post burtoninlondon  
        Started by AaronKoRn, Yesterday, 09:49 PM
        0 responses
        14 views
        0 likes
        Last Post AaronKoRn  
        Started by carnitron, Yesterday, 08:42 PM
        0 responses
        11 views
        0 likes
        Last Post carnitron  
        Started by strategist007, Yesterday, 07:51 PM
        0 responses
        13 views
        0 likes
        Last Post strategist007  
        Started by StockTrader88, 03-06-2021, 08:58 AM
        44 responses
        3,982 views
        3 likes
        Last Post jhudas88  
        Working...
        X