Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Target (SL, TP) issue with DOM

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

    Target (SL, TP) issue with DOM

    Greetings to all ninjas,

    I've developed a strategy that places pending orders (EnterShortLimit and EnterLongLimit) at certain prices and I place SL and TP using SetStopLoss and SetProfitTarget methods.

    The problem is that once pending order becomes market and SL/TP are placed, I want to be able to move SL and TP using DOM, but when I do that, both SL and TP reset to the same price they were initialized no matter how many times I try to move them. Is this some kind of limitation or is there a workaround for this? Or maybe I'm just being stupid and I've set to refresh SL/TP somewhere (I've checked it many many times, I swear).

    #2
    Hello,

    Thank you for your post and welcome to our forums!

    If you would like this sort of dynamic stop and target where you can manually move once in position, you would need to call an ATM Strategy method.

    Please see our Help Guide on ATM Strategy methods for more information:



    You can also see a working example of calling an ATM Strategy under Tools--> Edit NinjaScript--> Strategy--> SampleATMStrategy
    MatthewNinjaTrader Product Management

    Comment


      #3
      Thank you for your warm welcome, Matthew.

      Judging from your reply, I assume that there's no workaround for this issue except using ATM methods.

      After reviewing sample strategy, most things are clear to me apart one:
      Code:
                  // Submits an entry limit order at the current low price to initiate an ATM Strategy if both order id and strategy id are in a reset state
                  // **** YOU MUST HAVE AN ATM STRATEGY TEMPLATE NAMED 'AtmStrategyTemplate' CREATED IN NINJATRADER (SUPERDOM FOR EXAMPLE) FOR THIS TO WORK ****
                  if (orderId.Length == 0 && atmStrategyId.Length == 0 && Close[0] > Open[0])
                  {
                      atmStrategyId = GetAtmStrategyUniqueId();
                      orderId = GetAtmStrategyUniqueId();
                      AtmStrategyCreate(Cbi.OrderAction.Buy, OrderType.Limit, Low[0], 0, TimeInForce.Day, orderId, "AtmStrategyTemplate", atmStrategyId);
                  }
      Is creation of "AtmStrategyTemplate" necessary? Won't it be attached to certain instrument because of that? I want to keep all stops, BEs, order cancellation and so on in the ninjascript itself.

      Comment


        #4
        Hello,

        There is no workaround if you would like to manually manage these orders. Your code will reset the price value when the script is reevaluated.

        Yes, you would have to create a ATM Strategy Template.

        You can create multiple ATM Strategies and reference them individuality from the strategy. They will not necessarily be tied to a single instrument.
        MatthewNinjaTrader Product Management

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        649 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        370 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        109 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        573 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        576 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X