Getting a lot of those "Foriegn Key constraint failed" errors.
Logs:
2025-04-07 22:36:15:033|1|32|Order='aa68735dea6944dfa35aa3207 0f3322e/Playback101' Name='Stop loss' New state='Working' Instrument='MES 03-25' Action='Sell' Limit price=0 Stop price=6047.75 Quantity=1 Type='Stop Market' Time in force=GTC Oco='a608ab3f466a421495494969446e115b' Filled=0 Fill price=0 Error='No error' Native error=''
2025-04-07 22:36:15:039|1|32|Order='aa68735dea6944dfa35aa3207 0f3322e/Playback101' Name='Stop loss' New state='Filled' Instrument='MES 03-25' Action='Sell' Limit price=0 Stop price=6047.75 Quantity=1 Type='Stop Market' Time in force=GTC Oco='a608ab3f466a421495494969446e115b' Filled=1 Fill price=6047.75 Error='No error' Native error=''
2025-04-07 22:36:15:040|1|32|Order='c1937a754a9d48e9818644443 ac49400/Playback101' Name='Profit target' New state='Cancel submitted' Instrument='MES 03-25' Action='Sell' Limit price=6072.75 Stop price=0 Quantity=1 Type='Limit' Time in force=GTC Oco='a608ab3f466a421495494969446e115b' Filled=0 Fill price=0 Error='No error' Native error=''
2025-04-07 22:36:15:040|1|32|Order='c1937a754a9d48e9818644443 ac49400/Playback101' Name='Profit target' New state='Cancelled' Instrument='MES 03-25' Action='Sell' Limit price=6072.75 Stop price=0 Quantity=1 Type='Limit' Time in force=GTC Oco='a608ab3f466a421495494969446e115b' Filled=0 Fill price=0 Error='No error' Native error=''
2025-04-07 22:36:15:040|1|8|Execution='c0fa4ea3627841fe86f3e4 f6f4e6615f' Instrument='MES 03-25' Account='Playback101' Exchange=Default Price=6047.75 Quantity=1 Market position=Short Operation=Operation_Add Order='aa68735dea6944dfa35aa32070f3322e' Time='1/6/2025 9:42 AM'
2025-04-07 22:36:15:040|1|64|Instrument='MES 03-25' Account='Playback101' Average price=0 Quantity=0 Market position=Flat Operation=Remove
2025-04-07 22:36:15:050|3|524288|Error on executing DB command: code = Constraint (19), message = System.Data.SQLite.SQLiteException (0x800027AF): constraint failed
FOREIGN KEY constraint failed
at System.Data.SQLite.SQLite3.Reset(SQLiteStatement stmt)
at System.Data.SQLite.SQLite3.Step(SQLiteStatement stmt)
at System.Data.SQLite.SQLiteDataReader.NextResult()
at System.Data.SQLite.SQLiteDataReader..ctor(SQLiteCo mmand cmd, CommandBehavior behave)
at System.Data.SQLite.SQLiteCommand.ExecuteReader(Com mandBehavior behavior)
at System.Data.SQLite.SQLiteCommand.ExecuteNonQuery(C ommandBehavior behavior)
at NinjaTrader.NinjaScript.StrategyBase.DbAdd()
at NinjaTrader.Cbi.DB.DBThread()
2025-04-07 22:36:22:656|1|16|NinjaScript strategy 'ESMAStrategyManaged/355543122' submitting order
2025-04-07 22:36:22:663|1|32|Order='4dec519fcc7344b5ba31f2227 a27c6f0/Playback101' Name='ShortEntry' New state='Submitted' Instrument='MES 03-25' Action='Sell short' Limit price=0 Stop price=0 Quantity=1 Type='Market' Time in force=GTC Oco='' Filled=0 Fill price=0 Error='No error' Native error=''
2025-04-07 22:36:22:664|1|32|Order='4dec519fcc7344b5ba31f2227 a27c6f0/Playback101' Name='ShortEntry' New state='Accepted' Instrument='MES 03-25' Action='Sell short' Limit price=0 Stop price=0 Quantity=1 Type='Market' Time in force=GTC Oco='' Filled=0 Fill price=0 Error='No error' Native error=''
2025-04-07 22:36:22:664|1|32|Order='4dec519fcc7344b5ba31f2227 a27c6f0/Playback101' Name='ShortEntry' New state='Working' Instrument='MES 03-25' Action='Sell short' Limit price=0 Stop price=0 Quantity=1 Type='Market' Time in force=GTC Oco='' Filled=0 Fill price=0 Error='No error' Native error=''
2025-04-07 22:36:22:669|1|32|Order='4dec519fcc7344b5ba31f2227 a27c6f0/Playback101' Name='ShortEntry' New state='Filled' Instrument='MES 03-25' Action='Sell short' Limit price=0 Stop price=0 Quantity=1 Type='Market' Time in force=GTC Oco='' Filled=1 Fill price=6026.5 Error='No error' Native error=''
2025-04-07 22:36:22:669|1|8|Execution='140fbc9812934a32870c55 5cd824d8b9' Instrument='MES 03-25' Account='Playback101' Exchange=Default Price=6026.5 Quantity=1 Market position=Short Operation=Operation_Add Order='4dec519fcc7344b5ba31f2227a27c6f0' Time='1/6/2025 11:00 AM'
2025-04-07 22:36:22:669|1|16|NinjaScript strategy 'ESMAStrategyManaged/355543122' submitting order
2025-04-07 22:36:22:677|1|32|Order='f0bcec6c705e4addbc053c1e7 b732710/Playback101' Name='Stop loss' New state='Submitted' Instrument='MES 03-25' Action='Buy to cover' Limit price=0 Stop price=5901.25 Quantity=1 Type='Stop Market' Time in force=GTC Oco='140fbc9812934a32870c555cd824d8b9' Filled=0 Fill price=0 Error='No error' Native error=''
2025-04-07 22:36:22:677|1|32|Order='f0bcec6c705e4addbc053c1e7 b732710/Playback101' Name='Stop loss' New state='Rejected' Instrument='MES 03-25' Action='Buy to cover' Limit price=0 Stop price=5901.25 Quantity=1 Type='Stop Market' Time in force=GTC Oco='140fbc9812934a32870c555cd824d8b9' Filled=0 Fill price=0 Error='Order rejected' Native error='Buy stop or buy stop limit orders can't be placed below the market.'
2025-04-07 22:36:22:677|0|32|Playback101, Buy stop or buy stop limit orders can't be placed below the market. affected Order: BuyToCover 1 StopMarket @ 5901.25
2025-04-07 22:36:22:677|0|4|Strategy 'ESMAStrategyManaged/355543122' submitted an order that generated the following error 'Order rejected'. Strategy has sent cancel requests, attempted to close the position and terminated itself.
2025-04-07 22:36:22:677|1|4|Disabling NinjaScript strategy 'ESMAStrategyManaged/355543122'
2025-04-07 22:36:22:678|1|32|Order='07db07cff52b4da08123a52e8 4e82b6b/Playback101' Name='Profit target' New state='Rejected' Instrument='MES 03-25' Action='Buy to cover' Limit price=5884.25 Stop price=0 Quantity=1 Type='Limit' Time in force=GTC Oco='140fbc9812934a32870c555cd824d8b9' Filled=0 Fill price=0 Error='Unable to submit order' Native error='Order '07db07cff52b4da08123a52e84e82b6b' can't be submitted: The OCO ID ‘140fbc9812934a32870c555cd824d8b9’ cannot be reused. Please use a new OCO ID.'
2025-04-07 22:36:22:678|0|32|Playback101, Order '07db07cff52b4da08123a52e84e82b6b' can't be submitted: The OCO ID ‘140fbc9812934a32870c555cd824d8b9’ cannot be reused. Please use a new OCO ID. affected Order: BuyToCover 1 Limit @ 5884.25
2025-04-07 22:36:22:678|1|64|Instrument='MES 03-25' Account='Playback101' Average price=6026.5 Quantity=1 Market position=Short Operation=Operation_Add
2025-04-07 22:36:22:689|1|32|Order='bba850753eb94aabac99bb0f1 abb3e89/Playback101' Name='StopCancelClose' New state='Submitted' Instrument='MES 03-25' Action='Buy to cover' Limit price=0 Stop price=0 Quantity=1 Type='Market' Time in force=GTC Oco='' Filled=0 Fill price=0 Error='No error' Native error=''
2025-04-07 22:36:22:689|1|32|Order='bba850753eb94aabac99bb0f1 abb3e89/Playback101' Name='StopCancelClose' New state='Accepted' Instrument='MES 03-25' Action='Buy to cover' Limit price=0 Stop price=0 Quantity=1 Type='Market' Time in force=GTC Oco='' Filled=0 Fill price=0 Error='No error' Native error=''
2025-04-07 22:36:22:689|1|32|Order='bba850753eb94aabac99bb0f1 abb3e89/Playback101' Name='StopCancelClose' New state='Working' Instrument='MES 03-25' Action='Buy to cover' Limit price=0 Stop price=0 Quantity=1 Type='Market' Time in force=GTC Oco='' Filled=0 Fill price=0 Error='No error' Native error=''
2025-04-07 22:36:22:702|1|32|Order='bba850753eb94aabac99bb0f1 abb3e89/Playback101' Name='StopCancelClose' New state='Filled' Instrument='MES 03-25' Action='Buy to cover' Limit price=0 Stop price=0 Quantity=1 Type='Market' Time in force=GTC Oco='' Filled=1 Fill price=6027.25 Error='No error' Native error=''
2025-04-07 22:36:22:702|1|8|Execution='7152eb76d56b406ea79887 87a687203d' Instrument='MES 03-25' Account='Playback101' Exchange=Default Price=6027.25 Quantity=1 Market position=Long Operation=Operation_Add Order='bba850753eb94aabac99bb0f1abb3e89' Time='1/6/2025 11:00 AM'
2025-04-07 22:36:22:702|1|64|Instrument='MES 03-25' Account='Playback101' Average price=0 Quantity=0 Market position=Flat Operation=Remove
2025-04-07 22:36:25:076|3|524288|Error on executing DB command: code = Constraint (19), message = System.Data.SQLite.SQLiteException (0x800027AF): constraint failed
FOREIGN KEY constraint failed
at System.Data.SQLite.SQLite3.Reset(SQLiteStatement stmt)
at System.Data.SQLite.SQLite3.Step(SQLiteStatement stmt)
at System.Data.SQLite.SQLiteDataReader.NextResult()
at System.Data.SQLite.SQLiteDataReader..ctor(SQLiteCo mmand cmd, CommandBehavior behave)
at System.Data.SQLite.SQLiteCommand.ExecuteReader(Com mandBehavior behavior)
at System.Data.SQLite.SQLiteCommand.ExecuteNonQuery(C ommandBehavior behavior)
at NinjaTrader.NinjaScript.StrategyBase.DbAdd()
at NinjaTrader.Cbi.DB.DBThread()

.
Comment