• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.


No announcement yet.

Partner 728x90


OCA workaround ??

  • Filter
  • Time
  • Show
Clear All
new posts

    OCA workaround ??

    I was recently informed that when using NT, it's a good practice to restart NT @ least
    once per day. By doing so, I normally have to "sync" existing (overnite) positons.
    When re-starting NT automated strategy with TWS, I choose to execute live and therefore submit an OCA order to an existing positon (at broker). When running live each OCA submits a unique Tag # (identifier) or "OCA group" The problem is when you manually re-sync, NT submits "OCA Group" number like 0002, 0003. Where
    0002 = 2 historical trades in the chart that you chose to trade from, 0003 is 3 trades etc.

    Now the real problem is that if you have say 5 charts, with 5 strategies that by chance have say 5 historical trades, then you will have= 5 positions at IB each with OCA orders but your "OCA Group" will have 5 OCA's = 10 orders all with the same number
    0005. If any one one those orders is filled, then all orders will cancel.

    The workaround presented to me 5 months ago was to simply go to a chart Format data series and change "days back" to different settings, in hopes of the number of historical trades would be different.

    This works but now I need to trade 2 accounts under my advisor. By by resyncing everyday, how can you turn on a strategy on 2 seperate accounts without duplicating "OCA group". ty

    Hello rightcoast,

    Can you please tell me what NinjaTrader version you have installed. You can check this at Control Center-->Help-->About. Please let me know what TWS version you have as well.

    Could you please clarify the following: "When re-starting NT automated strategy with TWS, I choose to execute live". Do you refer to 'Immediately submit live working historical orders' at Tools-->Options-->Strategies-->NinjaScript-tab?

    Do you recall who assisted you 5 months ago. Is this reflected on the forum or did you correspond by email?

    Since you trade different accounts, does it still use one 'OCA group' for the ATM orders the strategies submit? As far as I know each running strategy is a separate instance, so it should not conflict with each other. Since you trade different accounts, I would assume that each OCO order set operates independent since you trade two different accounts as well.

    In addition, please note that NinjaTrader 7 is improved in regards to running automated strategies and disconnections. More information can be found at the following link under 'Understanding the NinjaScript tab'.
    JasonNinjaTrader Customer Service


      Hi Jason,

      NT 6.5 .16

      'Immediately submit live working historical orders' Yes

      Do you recall who assisted you 5 months ago. Is this reflected on the forum or did you correspond by email? http://www.ninjatrader.com/support/forum/showthread.php?t=25316

      I am running in paper account now IB, NT DOES submit Identical "OCA group" number regardless of which account it's in.

      I cannot say if the issue still occurs with NT7, but it did occur back in January.


        We suggested to run your strategies with 'WaitUntilFlat' as per post #4 to avoid the issue you reported. Does the issue persist if you have this option selected and your strategy trades two IB accounts?
        JasonNinjaTrader Customer Service


          That would work, yes..
          However, since (NT) told me that it's best pratice to reboot application @ least 1 time per day, we can agree that re-syncing is a necessity, that is if your intent is to replicate what your strategy is doing.

          My problem is in the case of strategies, where it's always in the market. So if you "wait until flat" and already have say a long 100 share position with broker and an existing OCA.

          1. scenerio(resync) ......Cancel strategy orders = Checked
          ......Wait until flat = Checked

          result after restart = strategy existing long gets a reverse(short) signal
          .......strategy sells 100 shares
          ........broker position is now flat

          2. scenerio(resync).......Cancel strategy orders = Unchecked
          ......Wait until Flat = Checked

          result after restart = Strategy existing long gets a reverse(short) signal
          ..........Strategy sells 100 shares
          ..........Broker position is flat
          ..........AND since we did not cancel orignal OCO before resync
          we will have 2 OCA groups consisting of 2 stops 2 targets
          and zero positon W/ IB.

          So unless I am doing something wrong here it seems that ANY event based strategy that leaves you in the market all of the time, requires that you must "Submit Live"?
          I learned from this site that stop and reverse type of strategies were only
          required to code "Enter long" to get long and to reverse simply add "Enter short".
          Last edited by rightcoast; 09-10-2010, 10:40 AM.


            Hello rightcoast,

            Ok, if you enable 'Cancel strategy orders' there are no duplicate OCO groups. You can submit a manual market order to synch your account position with the strategy position. Please see the link below for more information.
            JasonNinjaTrader Customer Service


              So I guess it would be good to know.

              1. Unfortunately after 8 months of doing the workaround, it seems evident that NT
              is not going to fix the 6.5 OCA issue with IB?

              2. Is NT7 yet capable to live autotrade several strategies?

              3. Will NT7 be able to Run Without minimum 1 per day restart?

              4. If not and resync is required everyday, will OCA groups be segregated?

              5. Does NT plan on supporting "Allocation profiles" w/ IB?

              Sorry guys, but I have been pretty patient on this one.


                1. Yes, unfortunately you will need to use the workaround as mentioned on the other forum thread.

                2. Yes, the issue is fixed in NinjaTrader 7.

                3. Yes, NinjaTrader 7 will run without a daily restart.

                4. -

                5. Unfortunately, IB allocation is not supported in our software. More information can be found at the forum thread below.
                JasonNinjaTrader Customer Service



                  So I need some help here, this OCA is beeing addressed in NT7 and not in 6.5
                  but since NT7 is still Beta, leaves me in a vulnerable position. If 25 people say hey,
                  I want you to trade your strategy for me Under your advisor @ IB. I say great but
                  I need to resync 6.5 1 per day and it's a strategy thats always in market, so because we cancel our existing OCA's on reboot, restart will generate 25 identical OCA group #'s.

                  So Should I just switch here to NT7 all out let it run "live trading" at this point.



                    I don't mean to back you into a corner here. But please, if there is no answer you can give, then have someone there call me to discuss what can be done, ASAP. I have had a few instances where my concerns on a Friday are not responded too until
                    quitting time.


                      Hello Rightcoast,

                      This issue is adressed in version 7. We do not plan to address for version 6.5. All development efforts are in getting 7 out of beta and into a production release. Thank you for understanding.
                      Ryan M.NinjaTrader Customer Service



                        Issue?? there are a few here, and I think I clearly asked more then once what I need to
                        do? and you give me the "being addressed" c'mon. You guys send me e-mail everyday for 2 years asking me to become a lifetime subscriber, well I have 2 licenses which are both lifetime. Point is you know who I am, you can't pick up a phone and give me some much needed help? I should have dropped NT 8 months ago when I discovered this bug.



                          At this point in time we need to internally sync with Jason to ensure everyone is on the same page. After we do this when he gets in on Monday we will be able to assist you. Thank you for your patience.
                          Josh P.NinjaTrader Customer Service


                            Ok I took the bait, understood that NT has no intention of fixing a MAJOR FLAW in NT 6.5. After several attempts I got NT7 v.21 installed. I ran 7 strategies and it did well, however, in attempt to re-sync I was trying to cancel strategies but I wanted to leave existing positions as well as stops and targets (OCA's). Where after Turning strategy back on, I could then manually cancel old OCA's as new ones are submitted (ie submit live orders). As you can see... however, upon cancelling each strategy that had positions in both strategy and broker, each OCA per strategy cancelled?

                            Point is I cannot even get to the point of seeing if NT7 submits identical OCA's after resync?
                            Attached Files


                              Hello rightcoast,

                              Can you please go to Control Center-->Tools-->Options-->Strategies-->NinjaScript-tab. Make sure you disable 'Cancel exit orders when a strategy is disabled'.

                              Does it still cancel your OCO orders when you cancel the strategy?
                              JasonNinjaTrader Customer Service


                              Latest Posts


                              Topics Statistics Last Post
                              Started by JuanPabloQuevedo, Today, 01:04 PM
                              0 responses
                              1 view
                              Last Post JuanPabloQuevedo  
                              Started by augustfay, Today, 10:46 AM
                              1 response
                              Last Post NinjaTrader_Kate  
                              Started by neilzep, Today, 11:16 AM
                              3 responses
                              Last Post NinjaTrader_PaulH  
                              Started by thebanik, Today, 10:18 AM
                              1 response
                              Last Post NinjaTrader_ChristopherS  
                              Started by Hyper, Yesterday, 09:45 AM
                              11 responses
                              Last Post bltdavid