Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Error on Reconnecting and Dom templates

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

    Error on Reconnecting and Dom templates

    After running all day I disconnected data feed with the intent of exporting templates. The reason being my Dom Templates stopped working. I Changed my mind and then reconnected. When I did so I got the following in my log and trace files. Notice it does reference ATMStrategy. So How do I rectify this problem. I cannot reproduce. I cannot save or load Dom Templates new or old.

    2016-11-21 15:32:47:154|3|4|Error on executing DB changes: name='AtmStrategy' id=90959229 System.Data.SqlServerCe.SqlCeException (0x80004005): A foreign key value cannot be inserted because a corresponding primary key value does not exist. [ Foreign key constraint name = FK__Strategy2Execution__00000000000003D3 ] at System.Data.SqlServerCe.SqlCeCommand.ProcessResult s(Int32 hr) at System.Data.SqlServerCe.SqlCeCommand.ExecuteComman dText(IntPtr& pCursor, Boolean& isBaseTableCursor) at System.Data.SqlServerCe.SqlCeCommand.ExecuteComman d(CommandBehavior behavior, String method, ResultSetOptions options) at System.Data.SqlServerCe.SqlCeCommand.ExecuteNonQue ry() at NinjaTrader.NinjaScript.StrategyBase.DbAdd() at NinjaTrader.NinjaScript.StrategyBase.DbUpdate() at NinjaTrader.Cbi.DB.DBThread()
    2016-11-21 15:32:47:155|3|4|Error on executing DB changes: name='AtmStrategy' id=90959229 System.Data.SqlServerCe.SqlCeException (0x80004005): A foreign key value cannot be inserted because a corresponding primary key value does not exist. [ Foreign key constraint name = FK__Strategy2Execution__00000000000003D3 ] at System.Data.SqlServerCe.SqlCeCommand.ProcessResult s(Int32 hr) at System.Data.SqlServerCe.SqlCeCommand.ExecuteComman dText(IntPtr& pCursor, Boolean& isBaseTableCursor) at System.Data.SqlServerCe.SqlCeCommand.ExecuteComman d(CommandBehavior behavior, String method, ResultSetOptions options) at System.Data.SqlServerCe.SqlCeCommand.ExecuteNonQue ry() at NinjaTrader.NinjaScript.StrategyBase.DbAdd() at NinjaTrader.NinjaScript.StrategyBase.DbUpdate() at NinjaTrader.Cbi.DB.DBThread()

    #2
    Hello JerryWar,

    Thanks for posting today.

    This error can be caused when NinjaTrader recognizes an older order that it can not locate a Primary ID for. This can be caused by a corrupted database file.

    As a test, please follow the instructions below to repair the NinjaTrader database.

    1. Disconnect NinjaTrader from any open connections via File > Disconnect
    2. From the NinjaTrader Control Center window select the menu Tools > Database
    3. Press "Repair DB"
    4. Press the "Repair" button

    Comment


      #3
      Drew
      It did not work. I repaired, rebooted and I created a new template. Loaded a New Dom and applied the template. The only thing it did was rename the tab. It did not apply the other tabs or any strategies even on the one it renamed. Now your probably going to tell me I have to Replace my database. and loose ALL my chart templates and ATM's

      Comment


        #4
        Hello Jerry,

        Thanks for your post.

        Correct, if this error persists after repairing the database, the next step would be to shut down the platform and rename the database. Please rename your database with the following steps :

        1. Shutdown NinjaTrader and Go to the Start Menu
        2. Select My Documents--> NinjaTrader 8--> DB--> NinjaTrader.SDF.
        3. Right click on NinjaTrader.SDF and select "Rename." *Name it "OLDNinjaTrader.SDF."
        4. Then restart the software and NinjaTrader will create a fresh database file to use

        Unfortunately the following items stored in the old database will be lost: Session templates, Instrument Lists / Custom Instruments, historical trade execution data, and saved Strategy Analyzer backtest results.

        To prevent running into situations where you can potentially lose important data, we advise to run regular backups via our inbuild backup feature in NinjaTrader:

        Comment


          #5
          Creating a New Database did not work. I still cannot Save and Reload the Dom Template including
          Tabs.

          Comment


            #6
            Hello,

            Thanks for getting back to me.

            To clarify, does this error persist or are the items you mentioned separate from this error ?

            Comment


              #7
              I currently get no error but I cannot Save and Load a Dom Template.
              to get back to where I was before I entered this Dom Atm rabbit hole.

              Comment


                #8
                Hello,

                Thank you for your reply.

                Sine this would likely be an item caused by something else, I would ask that you contact me by email at PlatformSupport [AT] NinjaTrader [DOT] com. In your message please include a link to this forum thread and a copy of today's trace files. You will find these diagnostic file in the Documents > NinjaTrader 8 > Trace folder. I will need to review a copy of the files which are named 'trace.20161121.XXXXX.txt'.

                Comment


                  #9
                  Drew
                  Email Sent with trace files.

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by argusthome, 03-08-2026, 10:06 AM
                  0 responses
                  68 views
                  0 likes
                  Last Post argusthome  
                  Started by NabilKhattabi, 03-06-2026, 11:18 AM
                  0 responses
                  41 views
                  0 likes
                  Last Post NabilKhattabi  
                  Started by Deep42, 03-06-2026, 12:28 AM
                  0 responses
                  24 views
                  0 likes
                  Last Post Deep42
                  by Deep42
                   
                  Started by TheRealMorford, 03-05-2026, 06:15 PM
                  0 responses
                  27 views
                  0 likes
                  Last Post TheRealMorford  
                  Started by Mindset, 02-28-2026, 06:16 AM
                  0 responses
                  54 views
                  0 likes
                  Last Post Mindset
                  by Mindset
                   
                  Working...
                  X