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 cmoran13, 04-16-2026, 01:02 PM
    0 responses
    43 views
    0 likes
    Last Post cmoran13  
    Started by PaulMohn, 04-10-2026, 11:11 AM
    0 responses
    26 views
    0 likes
    Last Post PaulMohn  
    Started by CarlTrading, 03-31-2026, 09:41 PM
    1 response
    163 views
    1 like
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    98 views
    1 like
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    158 views
    2 likes
    Last Post CaptainJack  
    Working...
    X