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 louiseruch, Today, 01:11 AM
    0 responses
    1 view
    0 likes
    Last Post louiseruch  
    Started by kujista, Today, 12:39 AM
    0 responses
    3 views
    0 likes
    Last Post kujista
    by kujista
     
    Started by tonynt, 05-21-2019, 06:27 AM
    11 responses
    536 views
    1 like
    Last Post NinjaTrader_Jason  
    Started by fitspressotablettry, Today, 12:36 AM
    0 responses
    1 view
    0 likes
    Last Post fitspressotablettry  
    Started by Lancer, 01-29-2020, 10:15 PM
    7 responses
    469 views
    1 like
    Last Post NinjaTrader_Jason  
    Working...
    X