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 NullPointStrategies, Yesterday, 05:17 AM
    0 responses
    55 views
    0 likes
    Last Post NullPointStrategies  
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    132 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    73 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    45 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    49 views
    0 likes
    Last Post TheRealMorford  
    Working...
    X