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 cmtjoancolmenero, Yesterday, 03:58 PM
    6 responses
    28 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by gbourque, Today, 06:39 AM
    2 responses
    14 views
    0 likes
    Last Post gbourque  
    Started by rexsole, Today, 08:39 AM
    0 responses
    6 views
    0 likes
    Last Post bltdavid  
    Started by trilliantrader, Yesterday, 03:01 PM
    3 responses
    31 views
    0 likes
    Last Post NinjaTrader_Clayton  
    Started by Brevo, Today, 01:45 AM
    1 response
    14 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Working...
    X