I have an old strategy that works just fine with live data, opens and reverses positions without any issue. But when I try to start it, doing the sync process as Sync Positions = true and Submit immediately reconciliatory historical orders, then I get the following issue:
if the historical strategy position is short, then it shows an issue in the log file:
9/23/2019 6:47:49 PM|3|128|Strategy 'PRF/7c7683a3c65a442d99766c6cacb8a82e': submitted an order with an invalid 0 quantity. Please increase the quantity of the order. In the code it's just impossible to submit an order with 0 quantity.
9/23/2019 6:47:49 PM|1|128|Syncing account position on starting strategy 'PRF/7c7683a3c65a442d99766c6cacb8a82e'. Account position='' Strategy position=''
When the historical position is Long, there's no problem at all as you can see the log file below:
9/9/2019 3:41:23 AM|1|128|Syncing account position on starting strategy 'PRF/b7ec52c758c440cfa05b085d512fd22c'. Account position='' Strategy position='XL MES 09-19'
9/9/2019 3:41:23 AM|1|32|Order='7c43efba8de7447cbb826ac1668ac80d/UXXX' Name='Synchronize' New state=PendingSubmit Instrument='MES 09-19' Action=Buy Limit price=0 Stop price=0 Quantity=X Type=Market Filled=0 Fill price=0 Error=NoError Native error=''....................etc
While I'm creating workarounds to solve the issue, still I do some trials to get behaviors about it and I've noticed that if I let run a strategy with a failed historical Short position sync, then eventually it submits a right reconciliatory order, really weird. It's important to me to overcome this issue cause often in my strategy, my Sunday begins with an open position in my broker's account from Fridays, so any ideas would be appreciated.