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 charlesugo_1, 05-26-2026, 05:03 PM
    0 responses
    67 views
    0 likes
    Last Post charlesugo_1  
    Started by DannyP96, 05-18-2026, 02:38 PM
    1 response
    149 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 05-11-2026, 05:56 AM
    0 responses
    162 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 05-10-2026, 08:12 PM
    0 responses
    99 views
    0 likes
    Last Post CarlTrading  
    Started by Hwop38, 05-04-2026, 07:02 PM
    0 responses
    286 views
    0 likes
    Last Post Hwop38
    by Hwop38
     
    Working...
    X