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 Taddypole, 04-26-2024, 02:47 PM
        2 responses
        14 views
        0 likes
        Last Post Taddypole  
        Started by futtrader, 04-21-2024, 01:50 AM
        6 responses
        58 views
        0 likes
        Last Post futtrader  
        Started by sgordet, Today, 11:48 AM
        0 responses
        4 views
        0 likes
        Last Post sgordet
        by sgordet
         
        Started by Trader146, Today, 11:41 AM
        0 responses
        5 views
        0 likes
        Last Post Trader146  
        Started by jpapa, 04-23-2024, 07:22 AM
        2 responses
        22 views
        0 likes
        Last Post rene69851  
        Working...
        X