Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Moving from a SetStopLoss to SetTrailStop

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

    Moving from a SetStopLoss to SetTrailStop

    Hello NT Support,

    I'm developing a strategy that is looking to catch large intraday moves. When entering a trade, I have a SetStopLoss at a reasonable level and a goal price with SetProfitTarget (typically, many points away). After the trade moves enough in my favor, I would like cancel the SetStopLoss and then use SetTrailStop so that some profits are locked in but still allow the trade to "breathe" to make larger profit moves.

    I'm not seeing any means to do this. The CancelOrder routine needs an order but the SetStopLoss routine doesn't return any Order object.

    If I'm understanding correctly and am able to cancel the SetStopLoss order, I would need to do the following:
    1. Cancel SetStopLoss order
      1. NOTE: Because of the OCO connection, the SetTargetPrice order is automatically cancelled, too.
    2. Call SetTrailStop AND call SetTargetPrice at the same level I had before.
    I'm using these method calls, so I'm connecting the order with the fromEntrySignal.
    SetStopLoss(string fromEntrySignal, CalculationMode mode, double value, bool isSimulatedStop)
    SetProfitTarget(string fromEntrySignal, CalculationMode mode, double value, bool isMIT)


    Is this possible?

    Thanks!
    Matt

    #2
    Hello StealthM93,

    The Set method orders cannot be cancelled, you would need to use the other order methods like ExitLongStopMarket so you have an order object that can be used with CancelOrder.

    Alternatively you would just not cancel the order and add logic in OnBarUpdate to call SetStopLoss to update its price, you can create a trailing stop with SetStopLoss by calling it each time you want to change its price.

    Comment


      #3
      Hello NinjaTrader_Jesse,

      Thank you for the quick response. I'm aware that I could code a trailing stop and update SetStopLoss as appropriate, but I'm looking to avoid coding that logic. However, I didn't think about using Exit_StopMarket order instead of SetStopLoss. I'll look at that.

      Thanks!
      Matt

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by NullPointStrategies, Today, 05:17 AM
      0 responses
      53 views
      0 likes
      Last Post NullPointStrategies  
      Started by argusthome, 03-08-2026, 10:06 AM
      0 responses
      130 views
      0 likes
      Last Post argusthome  
      Started by NabilKhattabi, 03-06-2026, 11:18 AM
      0 responses
      70 views
      0 likes
      Last Post NabilKhattabi  
      Started by Deep42, 03-06-2026, 12:28 AM
      0 responses
      44 views
      0 likes
      Last Post Deep42
      by Deep42
       
      Started by TheRealMorford, 03-05-2026, 06:15 PM
      0 responses
      49 views
      0 likes
      Last Post TheRealMorford  
      Working...
      X