Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Trailing Stop based off an indicator line

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

    Trailing Stop based off an indicator line

    I'd like my strategy to have a trailing stop based on a user defined amount from a particular EMA indicator line.
    I've got 3 indicator lines in the strategy defined as EMA1, EMA2 and EMA3

    Engage once I've gained X ticks past BreakEven, then I'd like to trail as Y ticks away from EMA3.

    I'm not sure how to point the trailing stop to tie itself to EMA3 instead of doing what it does now which trails the closest EMA line to the entry price.

    Any tips on how to tie the Trailing Stop to a particular EMA line (i.e. EMA3) no matter if it is short or long?

    I looked here and could not see my answer: https://ninjatrader.com/support/help...ttrailstop.htm

    #2
    Hello RonnieB, thanks for your post.

    You can call SetStopLoss within OnBarUpdate to dynamically change your stop. Set Calculation mode to CalculationMode.Price and then pass in the EMA value for the current bar, so that would be something like:

    SetStopLoss(CalculationMode.Price, EMA3[0]);

    One thing to note will be if you are long or short. If you are long you would want to make sure you are placing the sell stop below the market price and opposite that for short positions.

    Please let me know if I can assist any further with this.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    627 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    359 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    105 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    562 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    567 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X