Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

SetProfitTarget with Percent

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

    SetProfitTarget with Percent

    hi,
    i give you an example :

    my enter price is 10000 and i want to set a stop loss 9950 and to set trailing stop to 1%

    how i code it?
    Last edited by esignal; 08-31-2017, 03:11 PM.

    #2
    Hello esignal,

    Thanks for opening the thread.

    It would not be possible to use SetTrailStop() alongside SetStopLoss() on the same position, so the trailing stop will have to be programmed in as a dynamic stop loss. As it is a dynamic stop loss, it will have to programmed and cannot be created in the Strategy Builder.

    You could set an initial stop loss with SetStopLoss() at order submission, and then when you are in position and would like to update your stop loss, you can update it using a single tick data series. If the last price has gone up enough for you to adjust your stop loss, you can update it again with SetStopLoss().

    Adjusting the stop loss to 1 percent would be as follows and would need to be called whenever you wish to update the stop loss:
    SetStopLoss("EntrySignal", CalculationMode.Percent, 0.01, false);

    I will provide links to documentation on multi series NinjaScripts and SetStopLoss() as they contain direction for adding an additional data series as well as covering various notes for using the order method.

    Multi Series NinjaScripts - https://ninjatrader.com/support/help...nstruments.htm

    SetStopLoss() - https://ninjatrader.com/support/help...etstoploss.htm

    If you have any additional questions, please don't hesitate to ask.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    630 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    364 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    105 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    565 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    568 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X