I get the following error messages when running strategy in playback mode in max over a couple of weeks and without fail always get this for a particular strategy i am running.
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 ] at System.Data.SqlServerCe.SqlCeCommand.ProcessResults(Int32 hr) at System.Data.SqlServerCe.SqlCeCommand.ExecuteCommandText(IntPtr& pCursor, Boolean& isBaseTableCursor) at System.Data.SqlServerCe.SqlCeCommand.ExecuteCommand(CommandBehavior behavior, String method, ResultSetOptions options) at System.Data.SqlServerCe.SqlCeCommand.ExecuteNonQuery() at NinjaTrader.Cbi.Execution.DbAdd() at NinjaTrader.Cbi.DB.DBThread()
If i disable the strategy the error messages still appear every 10 seconds until i reset the DB and close and reopen NT
What are the common issues that could be causing this type of error and the areas of code i should focus on?
Any pointers would be greatly appreciated in order to debug this and resolve.
Thankyou
**Edit** On further investigation, it would appear after resetting the DB, the strategy is fine during playback and the error only appears when disconnecting from playback or enabling/disabling the strategy to change settings and re-run. As soon as the Database error appears, all future runs of the strategy fail and dont run correctly. So it seems the moment get this error all future runs do not work correctly as the strategy is designed. So what is causing this initial failure?
Comment