Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

SL+TP using Unmanaged Approach

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

    SL+TP using Unmanaged Approach

    Hello

    1. Can you please give an example of the unmanaged approach for entering a market long position with a SL and TP.

    In the managed approach it would look something like that:

    private void EnterMarketLong(double SL, double TP)
    {
    SetStopLoss(CalculationMode.Price, SL);
    SetProfitTarget(CalculationMode.Price, TP);
    EnterLong("MyLongPosition");
    }

    2. Is there a way to automatically cancel the SL and TP orders when I disable my strategy (but keeping my long position running).

    Thanks
    Last edited by kiss987; 08-17-2017, 02:47 PM.

    #2
    Hello kiss987,

    Thanks for opening the thread.

    Here is a copy of our Unmanaged Template strategy that you can use as an example for writing a strategy that uses bracketed orders for entry as well as profit targets and stop losses for long and short positions.

    If you have any questions on the sample code, please don't hesitate to ask.
    Attached Files

    Comment


      #3
      Is there a way to automatically cancel the SL and TP orders when I disable my strategy but keeping my long position running, the same way it's working in the managed approach?

      Thanks

      Comment


        #4
        Hello kiss987,

        Thanks for your question.

        The Order handling rules in the Strategies\NinjaScript tabs of the Options menu will define the behavior for cancelling exit orders when you disable the strategy.

        I added some null checks to aid in resuming a position so an IOrder can be resumed if it already exists, the modified script is attached.

        Strategies tab - https://ninjatrader.com/support/help...tegies_tab.htm

        I look forward to being of further assistance.
        Attached Files
        Last edited by NinjaTrader_Jim; 08-23-2017, 09:58 AM.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by charlesugo_1, 05-26-2026, 05:03 PM
        0 responses
        47 views
        0 likes
        Last Post charlesugo_1  
        Started by DannyP96, 05-18-2026, 02:38 PM
        1 response
        141 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 05-11-2026, 05:56 AM
        0 responses
        160 views
        0 likes
        Last Post CarlTrading  
        Started by CarlTrading, 05-10-2026, 08:12 PM
        0 responses
        96 views
        0 likes
        Last Post CarlTrading  
        Started by Hwop38, 05-04-2026, 07:02 PM
        0 responses
        275 views
        0 likes
        Last Post Hwop38
        by Hwop38
         
        Working...
        X