Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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 zstheorist, Today, 07:52 PM
    0 responses
    2 views
    0 likes
    Last Post zstheorist  
    Started by pmachiraju, 11-01-2023, 04:46 AM
    8 responses
    149 views
    0 likes
    Last Post rehmans
    by rehmans
     
    Started by mattbsea, Today, 05:44 PM
    0 responses
    5 views
    0 likes
    Last Post mattbsea  
    Started by RideMe, 04-07-2024, 04:54 PM
    6 responses
    33 views
    0 likes
    Last Post RideMe
    by RideMe
     
    Started by tkaboris, Today, 05:13 PM
    0 responses
    5 views
    0 likes
    Last Post tkaboris  
    Working...
    X