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

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.
    JimNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by algospoke, 04-17-2024, 06:40 PM
    6 responses
    48 views
    0 likes
    Last Post algospoke  
    Started by arvidvanstaey, Today, 02:19 PM
    4 responses
    11 views
    0 likes
    Last Post arvidvanstaey  
    Started by samish18, 04-17-2024, 08:57 AM
    16 responses
    61 views
    0 likes
    Last Post samish18  
    Started by jordanq2, Today, 03:10 PM
    2 responses
    9 views
    0 likes
    Last Post jordanq2  
    Started by traderqz, Today, 12:06 AM
    10 responses
    19 views
    0 likes
    Last Post traderqz  
    Working...
    X