Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Moving stop to breakeven after first profit target then changing stop to trailing

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

    Moving stop to breakeven after first profit target then changing stop to trailing

    Hi,

    I am coding a strategy in the editor and I want to have an exit strategy whereby after the first profit target is reached the stop moves to breakeven, I then want to change the stop type from a static stop to a trail stop.

    Using the SamplePriceModification strategy on the Ninjatrader documentation for modifying the price of stop loss and profit target orders (https://ninjatrader.com/support/help...of_stop_lo.htm) I am able to complete the first part (move stop to breakeven once first profit target is hit) but I don't know how to change the order to a trail stop.

    Can you help?

    Thanks,

    Neil

    #2
    Hello Neil,

    Thanks for your post.

    With the Set methods, you cannot use both a trailing stop and a set stop in the same entry order, the trailing stop would be ignored.

    You can use your own logic to create a trailing stop with the SetStopLoss(). You would need to add a few bool variables to control the logic flow. For example, once you have moved the stop to breakeven you would set a bool variable so that it cannot be moved to breakeven again (until the bool is reset), then your logic could again compare the current price to some trail value and adjust the set stop to that next level.

    You may want to download and review an example of a trailing stop by NinjaTrader_Chelsea in this thread: https://ninjatrader.com/support/foru...ing#post802269 Look specifically for the ProfitChaseTrailSetMethodsExample.
    Last edited by NinjaTrader_PaulH; 09-16-2021, 01:22 PM. Reason: Replaced link

    Comment


      #3
      Hi NinjaTrader_PaulH - thanks for the reply, however the link you posted doesn't take me to Chelsea's example - it links back to this post.

      Can you resubmit the post?

      Comment


        #4
        Hello Neil,

        Thanks for your reply.

        I have corrected the link in post #2.

        Comment

        Latest Posts

        Collapse

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