Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Receiving Errors on executing DB command

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

    Receiving Errors on executing DB command

    Receiving a number of DB errors when executing strategies how can these be resolved:
    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__Strategy2Order__0000000000000403 ] and Error on executing DB command: System.Data.SqlServerCe.SqlCeException (0x80004005):

    A duplicate value cannot be inserted into a unique index. [ Table name = Executions,Constraint name = PK__Executions__0000000000000300 ]

    #2

    Welcome to the forums yazclin!

    Is this a strategy you have written or a third party has written?

    Do you see this behavior using the SampleMACrossover strategy? From a clean database? (Please see below)

    If this is caused and reproducible through a 3rd party strategy, we suggest contacting the developer so they are aware of the matter. If they are not doing anything database related with their code, they may reach out to scriptingsupport [at] ninjatrader [dot] com with an example script that can reproduce the database errors so we can have a look on our end.

    If you have written the strategy, there is no unsupported database reading and writing happening in the script, and the issue is reproducible from a clean database, we would be very interested to get steps and the script that reproduces this issue.

    Creating a new database file will be free of errors and could help avoid further database errors if the existing database file is damaged.

    This can be done by taking the steps below:
    • Shutdown NinjaTrader and Go to the Start Menu
    • Select My Documents--> NinjaTrader 8--> db--> "NinjaTrader.sdf" file (may only say 'NinjaTrader' depending on your Windows File Explorer settings)
    • Right click on NinjaTrader.sdf and select "Rename" *Name it "OLDNinjaTrader.sdf"
    • 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 - Trading Hours templates, Instrument Lists / Custom Instruments, historical trade execution data, saved Strategy Analyzer backtest results
    To prevent running into situations where you can potentially lose important data, we advise running regular backups via our inbuilt backup feature in NinjaTrader - https://ninjatrader.com/support/help...up_archive.htm

    We look forward to hearing from you.
    JimNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by JonesJoker, 04-22-2024, 12:23 PM
    6 responses
    32 views
    0 likes
    Last Post JonesJoker  
    Started by GussJ, 03-04-2020, 03:11 PM
    12 responses
    3,239 views
    0 likes
    Last Post Leafcutter  
    Started by AveryFlynn, Today, 04:57 AM
    0 responses
    5 views
    0 likes
    Last Post AveryFlynn  
    Started by RubenCazorla, 08-30-2022, 06:36 AM
    3 responses
    79 views
    0 likes
    Last Post PaulMohn  
    Started by f.saeidi, Yesterday, 12:14 PM
    9 responses
    25 views
    0 likes
    Last Post f.saeidi  
    Working...
    X