Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to trail stoploss with supertrend

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

    How to trail stoploss with supertrend

    Hello,
    I trying to develop Strategy with supertrend indicator, the thing i can't understand how to add supertrend line as my trailing stop-loss as market trend up/down in code.
    Secondly, how can i plot profit target viewer on charts.
    say share price is @50. Supertrend change to green and price start moving up, i want to plot and achieve 3-targets at 52-54-55 on chart and trail stop-loss as supertrend line
    Last edited by Dev1005; 11-16-2016, 12:18 PM.

    #2
    Hello Dev1005,

    Is your indicator returning a value?

    Set this value as the price for a stop loss.

    for example to set the stop loss to the price of the SMA:

    if (Position.MarketPosition == MarketPosition.Long && SMA(14)[0] < GetCurrentBid())
    {
    SetStopLoss(CalculationMode.Price, SMA(14)[0]);
    }

    This would set the stop loss to the value of the SMA as long as the sma value is below the current price and the position is a long position.

    Below I am providing a link to an example of a strategy that does trailing.


    Your profit target you could represent by drawing a line at the price of the target.
    Last edited by NinjaTrader_ChelseaB; 11-16-2016, 12:58 PM.
    Chelsea B.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    558 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    324 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    101 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    545 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    547 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X