Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Need help in designing OCO

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

    Need help in designing OCO

    My current design: when my entry is executed, I will submit a pair or takeprofit and stoploss orders as part of my OCO bracket orders

    In a perfect example where all my entry got filled (qty=10) at a single go, i will submit takeprofit order with qty=10 and stoploss order qty=10.

    Say market moves slowly and my entry got filled in batches (3, 3 and 4), do i create/submit 3 x takeprofit order objects and 3 x stoploss order objects ?

    example:
    1) entry filled (qty3)
    takeprofitA = ExitLongLimit(qty=3) and stoplossA=ExitLongStopMarket(qty=3)

    2) entry filled (qty3)
    takeprofitB = ExitLongLimit(qty=3) and stoplossB=ExitLongStopMarket(qty=3)

    3) entry filled (qty4)
    takeprofitC = ExitLongLimit(qty=4) and stoplossC=ExitLongStopMarket(qty=4)

    Or am i looking it wrongly ? Or should i be using SubmitOrderUnmanaged() for my oco?


    Last edited by elirion; 10-02-2024, 03:34 AM.

    #2
    Hello elirion,

    With the managed approach you don't need to manage OCO at all, that is handled internally. You just need to specify the from entry signal names for the exits to link to the entries.

    For part fills you can see an example of how to handle that here: https://ninjatrader.com/support/help...and_onexec.htm

    Comment


      #3
      Thanks much for the advice.

      Can I say managed approach will handle all the complexities of partials fills?

      Comment


        #4
        Hello elirion,

        To handle partial fills with how you are submitting exits you would need to see the sample that I linked. That shows the logic required to update the orders to the correct quantities. The OCO part of your question will be handled internally, that is done by using the FromEntrySignal name when you submit the exits, that ties the exit to a specific position.

        Comment


          #5
          will do...thanks again NinjaTrader_Jesse

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by NullPointStrategies, Today, 05:17 AM
          0 responses
          48 views
          0 likes
          Last Post NullPointStrategies  
          Started by argusthome, 03-08-2026, 10:06 AM
          0 responses
          126 views
          0 likes
          Last Post argusthome  
          Started by NabilKhattabi, 03-06-2026, 11:18 AM
          0 responses
          66 views
          0 likes
          Last Post NabilKhattabi  
          Started by Deep42, 03-06-2026, 12:28 AM
          0 responses
          42 views
          0 likes
          Last Post Deep42
          by Deep42
           
          Started by TheRealMorford, 03-05-2026, 06:15 PM
          0 responses
          46 views
          0 likes
          Last Post TheRealMorford  
          Working...
          X