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 TraderBCL, Today, 04:38 AM
    2 responses
    11 views
    0 likes
    Last Post TraderBCL  
    Started by martin70, 03-24-2023, 04:58 AM
    14 responses
    105 views
    0 likes
    Last Post martin70  
    Started by Radano, 06-10-2021, 01:40 AM
    19 responses
    606 views
    0 likes
    Last Post Radano
    by Radano
     
    Started by KenneGaray, Today, 03:48 AM
    0 responses
    4 views
    0 likes
    Last Post KenneGaray  
    Started by thanajo, 05-04-2021, 02:11 AM
    4 responses
    471 views
    0 likes
    Last Post tradingnasdaqprueba  
    Working...
    X