Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

SetStopLoss() in OnBarUpdate if position flat?

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

    SetStopLoss() in OnBarUpdate if position flat?

    Do I need to call SetStopLoss() to reset the stop whenever OnBarUpdate runs and position is flat?
    My strategy does a trailing stop.

    #2
    Hello iantriestrading,

    Thank you for your post.

    If you want to dynamically change/modify the price of the stop loss and profit target, the method should be called from within OnBarUpdate() and the price should always be reset when the strategy becomes flat again.

    Please note that SetStopLoss() cannot be used with SetTrailingStop(). This is noted in the Help Guide:

    SetStopLoss() - https://ninjatrader.com/support/help...etstoploss.htm

    "The SetStopLoss() method can NOT be used concurrently with the SetTrailStop() or SetParabolicStop() method for the same position, if any methods are called for the same position (fromEntrySignal) the SetStopLoss() will always take precedence. You can however, use all three methods in the same strategy if they reference different signal names.​"

    Please let us know if you have any further questions.

    Comment


      #3
      Thank you!

      Comment

      Latest Posts

      Collapse

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