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 Mindset, 04-21-2026, 06:46 AM
    0 responses
    44 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by M4ndoo, 04-20-2026, 05:21 PM
    0 responses
    54 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by M4ndoo, 04-19-2026, 05:54 PM
    0 responses
    34 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by cmoran13, 04-16-2026, 01:02 PM
    0 responses
    95 views
    0 likes
    Last Post cmoran13  
    Started by PaulMohn, 04-10-2026, 11:11 AM
    0 responses
    57 views
    0 likes
    Last Post PaulMohn  
    Working...
    X