I'm testing an algo live with tiny sums of money. QC wont let me do proper TAKE_PROFIT orders, so I'm closing my trades by setting manual takeprofits from my brokers app.

So, I had 25 open units (opened by the algo). I manually set takeprofits on 8 (from my brokers app). These 8 hit takeprofit and were successfully closed. But my algo still thinks i have 25 units open, when i obvioiusly only have 17 open on the broker servers.

Also, the Algo sees that my cash has changed to reflect the gains from these 8 closed units, but the fact the 8 units were closed is not seen from the algo and neither that the average position price has changed.

I'm wondering, what data can be asked, retrieved, and refreshed, directly from the broker servers?

Thanks for any pointers.