Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

OCO orders

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

    OCO orders

    I am using EnterLongStop() to place an order. As soon as that order gets filled, I need to place both an ExitLongStop and an ExitLongLimit such that as soon as one of these exit orders are executed, the other is canceled. Additionally, both of these exit orders will depend on the real price of the EnterLong order which is only known after this order is executed.

    Whats is the best way to place such an OCO-exit-order?

    #2
    Hello,
    You can submit logic for when an order is filled by placing the order submission logic into the OnExecution() event method. In addition to having logic entered into this method you can use IExecution to get information such as price which you could use to set a variable to submit your exit orders based off of.
    You would need to use the Unamanaged Approach to submit OCO orders, this would not be possible using the Managed Approach.
    In addition to the help guide sections hyperlinked about I would recommend that you review our reference sample on Using OnOrderUpdate() and OnExecution() methods to submit protective orders

    If you have any further questions please let us know.
    Last edited by NinjaTrader_CodyB; 06-16-2016, 02:02 PM.
    Cody B.NinjaTrader Customer Service

    Comment


      #3
      In the sample you mentioned:

      What happens to the targetOrder if the stopOrder is executed and what happens to the stopOrder if the targetOrder gets executed? There is no explicit CancelOrder in the sampleCode. Does one of these orders implicitely cancel the other?

      Comment


        #4
        Hello,
        Once a managed position is closed any pending Exit order method(ExitLongLimit, ExitLongStop, SetStopLoss, SetProfitTarget, etc) is cancelled.
        Cody B.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by CommonWhale, Today, 09:55 AM
        1 response
        2 views
        0 likes
        Last Post NinjaTrader_Erick  
        Started by Gerik, Today, 09:40 AM
        2 responses
        7 views
        0 likes
        Last Post Gerik
        by Gerik
         
        Started by RookieTrader, Today, 09:37 AM
        2 responses
        11 views
        0 likes
        Last Post RookieTrader  
        Started by alifarahani, Today, 09:40 AM
        1 response
        7 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Started by KennyK, 05-29-2017, 02:02 AM
        3 responses
        1,285 views
        0 likes
        Last Post NinjaTrader_Clayton  
        Working...
        X