I have been having the issue where a limit order (target) will be filled at my broker and the strategy does not recognize that this is the case. So it remains long, lets say, while really we're flat and it should be looking for a new entry...
I was wondering if anyone uses "MarketPosition_at_Broker" to check that their actual position and their strategy positions line up? Does anyone have any code or know how this could be used to resolve this sort of issue? Perhaps some sort of comparison using "CurrentContracts" and "MarketPosition_at_Broker"?
Broker/Data: TDA/Interactive Brokers/ Data Feed TDA and Kinetick
Favorite Futures: Stocks NASDAQ
Posts: 813 since May 2011
Thanks: 1,520 given,
Sounds like you are way, way beyond me in NT7 C# programming, but have you considered using Market Analyzer for what you are trying to do? Granted it won't check against your strategy, but it will give you an accurate position count(using column PositionSize set for your broker) and other values you may want to check during strategy execution if you'd like.
What settings are you using for the automation? As to my understanding you could try a setting where positions are only reported as filled on the chart after a broker confirmation. However this is something to test on a simulation account of course.
I have worked with MarketPosition_at_Broker or MarketPosition_at_Broker_for_The_Strategy and CurrentContracts to check and display differences in broker and signal positions.
MC has had some issues with sometimes MarketPosition_at_Broker behaving incorrect, but as far as I know this is ironed out now.
You need to decide what you want to do if they are out of sync, as I can imagine you will have situations where they are out of sync for a few ticks although everything is fine. If you trigger correcting orders then you might desync a strategy that actually was in sync before.