Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Name of stoploss or profit target for multiple entry orders?

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

    Name of stoploss or profit target for multiple entry orders?

    I have a strategy that submits 3 entry orders with 3 different order names. For example, I may submit one long entry with name "LONG ENTRY 1", a second with name "LONG ENTRY 2" and a third with name "LONG ENTRY 3". I submit these using EnterLongStopMarket(Pos1Size, longEntryPrice, LONG_ENTRY_1_NAME) etc.

    Inside OnOrderUpdate I can set the proper Order object based on the order entry name. So now I have

    Order longEntry1, longEntry2, longEntry3, shortEntry1, shortEntry2, shortEntry3

    When the order is filled, inside OnOrderUpdate I can detect that by checking if (execution.Order.OrderState == OrderState.Filled) for each of my orders.
    When that happens, I want to set the stoploss and profit targets for those orders using SetStopLoss and SetProfitTarget functions. These acceptthe name of the ENTRY order. There seems to be no way to set the name of the stoploss or profit target order itself.

    Inside OnOrderUpdate, I also wantto check to see if a stoploss order or take profit order was rejected. For example, if a stoploss order is rejected, I should exit everything. The problem is that the only way I know of to check if the current order is a stoploss order is to use the order name. I knw that NT hardcodes the stoploss order name for single entries as "Stop loss" and "Profit target". But what if I have multiple entry orders? Are all stoploss and profit target orders just given the name "Stop loss" and "Profit target"? How can I differentiate between the stoploss for a given entry order?

    #2
    Hello westofpluto,

    When the order is filled, inside OnOrderUpdate
    just as a note here, any filled logic that generates orders (entry fills, stops submit) generally should be placed in OnExecututionUpdate.
    https://ninjatrader.com/support/help...ghtsub=onorder
    •For triggering actions such as the submission of a stop loss order and target order using custom OCO logic when your entry order is filled, we recommend working directly in OnExecutionUpdate() instead.

    For finding the rejected orders in OnOrderUpdate you could check if the orders name equals Stop loss and its FromEntrySignal == "theEntryName" to determine which stop or target it was.
    https://ninjatrader.com/support/help...lightsub=order



    Please let me know if I may be of additional assistance.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by CarlTrading, 03-31-2026, 09:41 PM
    1 response
    47 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    23 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    33 views
    1 like
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    50 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    42 views
    0 likes
    Last Post CarlTrading  
    Working...
    X