Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

stoplosses

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

    stoplosses

    Hi

    If I have 2 orders and corresponding 2x stoploss, 2x profit target.

    Do the stoplosses and profit targets close in the order they were placed on the market or is it like last in first out.

    so if
    sl1 and pt1 enter the market first THEN
    sl2 and pt2 enter the market.

    if pt1 is hit then based on the signal names / signal from fields it should be sl1 which is cancelled or is there any way sl2 could be cancelled first?

    #2
    Hello fishbed,

    Thank you for your post.

    If you are using the Set methods (SetProfitTarget, SetStopLoss, etc.) then the associated Stop Loss by entrySignalName will be cancelled - so to your example; if pt1 is hit then sl1 is cancelled.

    If you use specific Exit order methods (ExitLongStopMarket, ExitLongLimit, etc.) then you will need to ensure the orders are associated to the correct entrySignalName - and then the case would be the same as using the Set methods.

    If your orders are not specific to entrySignalNames (the entry orders) then to change this you would use Order objects specifically for each order and check for the fill of an order in the OnOrderUpdate() method and then use CancelOrder() to cancel the order you want.
    Please let me know if you have any questions.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by MarianApalaghiei, Today, 10:49 PM
    1 response
    7 views
    0 likes
    Last Post NinjaTrader_Manfred  
    Started by love2code2trade, Yesterday, 01:45 PM
    4 responses
    28 views
    0 likes
    Last Post love2code2trade  
    Started by funk10101, Today, 09:43 PM
    0 responses
    8 views
    0 likes
    Last Post funk10101  
    Started by pkefal, 04-11-2024, 07:39 AM
    11 responses
    37 views
    0 likes
    Last Post jeronymite  
    Started by bill2023, Yesterday, 08:51 AM
    8 responses
    46 views
    0 likes
    Last Post bill2023  
    Working...
    X