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 Mindset, 04-21-2026, 06:46 AM
          0 responses
          88 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by M4ndoo, 04-20-2026, 05:21 PM
          0 responses
          134 views
          0 likes
          Last Post M4ndoo
          by M4ndoo
           
          Started by M4ndoo, 04-19-2026, 05:54 PM
          0 responses
          68 views
          0 likes
          Last Post M4ndoo
          by M4ndoo
           
          Started by cmoran13, 04-16-2026, 01:02 PM
          0 responses
          119 views
          0 likes
          Last Post cmoran13  
          Started by PaulMohn, 04-10-2026, 11:11 AM
          0 responses
          67 views
          0 likes
          Last Post PaulMohn  
          Working...
          X