Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Partial close not updating stoploss set using ExitLongStopLimit

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

    Partial close not updating stoploss set using ExitLongStopLimit

    Hi. Within OnExecutionUpdate method, I've this code to set stop-loss and partial position sell at limit price when a long position is filled. Code executes fine, it sets the sell limit and stop-loss orders alright. The problem is when the partial sell happens it kills the stop-loss order altogether instead of updating its quantity only. From this code I expect stop-loss to stay with quantity = 1 once partial sell is done. Please advise how can I resolve this. Thank you.

    Code:
    //partial selling 1 contract
    ExitLongLimit(BarsInProgress, true, 1, High[1] + (16 * TickSize), "PartialSell", "LongPos");
    
    //stoploss - set for original quatity 2 
    ExitLongStopLimit(BarsInProgress, true, 2, execution.Order.AverageFillPrice - (32 * TickSize), execution.Order.AverageFillPrice - (32 * TickSize), "StopLoss", "LongPos");

    #2
    Hello singjay,

    NinjaTrader would not be changing the quantity of orders.

    The script logic would have to change the quantity of an exit order with the ChangeOrder() method, or by submitting the order again with the new quantity using the same signal name.


    You could choose to do that in OnExecutionUpdate() after the entry has part filled.


    If you are using Set methods such as SetStopLoss(), the quantity for these should update automatically as these order methods are managed by platform.
    Chelsea B.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by NullPointStrategies, Yesterday, 05:17 AM
    0 responses
    67 views
    0 likes
    Last Post NullPointStrategies  
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    142 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    76 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    47 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    51 views
    0 likes
    Last Post TheRealMorford  
    Working...
    X