Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strategy Trailing Stop

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

    Strategy Trailing Stop

    I am new to coding. I painfully built a strategy in the strategy builder, but now the remaining part of the strategy is beyond the capabilities of the strategy builder. I am wanting to code a break even and a trailing stop, but I haven't a clue how to do it. Can someone please share the code needed and also where to add the code in the existing strategy? Please find below my idea:

    Move "stop loss" +3 ticks for every +1 tick the market moves in the right direction. Stop "stop loss" advancement once breakeven (entry level) is reached.
    Then, once the market moves to +25 ticks, move to +5 ticks.
    Then, once the market moves to +40 ticks, move to +25 ticks.
    Then, once the market moves to +75 ticks, move to +50 ticks and then trail the market by 25 ticks thereafter.

    I would also like to be able to adjust these settings in the parameters screen of the strategy.

    Thank you tremendously for your help!!!

    #2
    Hello gregorious13,

    Thanks for your post.

    You could use Exit order methods and add coding logic in the Strategy Builder to accomplish creating a breakeven or trailing stop.

    Please note that you would not be able to use the Exit methods and the Set methods in the Stop and Targets window as that creates a violation of the Managed Approach Internal Order Handling Rules, linked here: https://ninjatrader.com/support/help...d_approach.htm

    See the educational reference sample scripts in the forum thread below that my colleague Chelsea has created regarding Strategy Builder breakeven and trailing stop in the Strategy Builder.
    https://ninjatrader.com/support/foru...der#post806596

    Please let us know if we may assist further.
    <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

    Comment


      #3
      Sounds complicated...lol. I will give it a try.

      Comment


        #4
        Ok, this is above my pay grade. Can someone walk me through how I would set this up in the strategy tester? I looked at the two examples given, but I can't make sense of the logic, and the strategy builder guide doesn't help at all. Thank you.

        Comment


          #5
          Hello gregorious13,

          Thanks for your note.

          Unfortunately, in the support department at NinjaTrader it is against our policy to create, debug, or modify, code or logic for our clients. Further, we do not provide C# programming education services in our support. This is so that we can maintain a high level of service for all of our clients as well as our partners.

          Something you could consider is contacting a professional NinjaScript Consultant who would be eager to create or modify this script at your request or assist you with your script. The NinjaTrader Ecosystem has affiliate contacts who provide educational as well as consulting services. If you would like our NinjaTrader Ecosystem team follow up with you with a list of affiliate consultants who would be happy to create this script or any others at your request, please reach out to vendorsupport[AT]ninjatrader.com.

          Let us know if we may assist further.
          <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by NullPointStrategies, Yesterday, 05:17 AM
          0 responses
          61 views
          0 likes
          Last Post NullPointStrategies  
          Started by argusthome, 03-08-2026, 10:06 AM
          0 responses
          134 views
          0 likes
          Last Post argusthome  
          Started by NabilKhattabi, 03-06-2026, 11:18 AM
          0 responses
          75 views
          0 likes
          Last Post NabilKhattabi  
          Started by Deep42, 03-06-2026, 12:28 AM
          0 responses
          45 views
          0 likes
          Last Post Deep42
          by Deep42
           
          Started by TheRealMorford, 03-05-2026, 06:15 PM
          0 responses
          50 views
          0 likes
          Last Post TheRealMorford  
          Working...
          X