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 CarlTrading, 03-31-2026, 09:41 PM
        1 response
        81 views
        1 like
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 04-01-2026, 02:41 AM
        0 responses
        42 views
        0 likes
        Last Post CarlTrading  
        Started by CaptainJack, 03-31-2026, 11:44 PM
        0 responses
        64 views
        2 likes
        Last Post CaptainJack  
        Started by CarlTrading, 03-30-2026, 11:51 AM
        0 responses
        66 views
        0 likes
        Last Post CarlTrading  
        Started by CarlTrading, 03-30-2026, 11:48 AM
        0 responses
        54 views
        0 likes
        Last Post CarlTrading  
        Working...
        X