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 Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        600 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        347 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        103 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        558 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        558 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X