In countless posts of the past, you've always said that NT is like a beacon of all info coming from the broker's account, so when I have a Strategy working in real-time-live trading, and I need to check for Market.Position or Position.Quantity actually from my broker's account only.
So, I have this situation, very easy to understand. I have a simple Strategy that before doing anything, it needs to check Market.Position and Quantity.Position, so it will know if it has to close an opened position, opening a new position or doing nothing with the right accordingly orders. So following with the example, if I had an opened position and my Strategy detects a signal that indicates to reverse that position, first, the Strategy will check for actual position and submits an order to Flatten it, once it makes sure that it's actually flat by checking the new status info, it will submit a new order to open the desired new active position. Obviously, the info that the Strategy needs to know before acting, will be "always and all time" the info coming from my real-live-trading broker's account and NOT some temporary internal NT's strategy position. Let me explain it better with my real trading situation from last night so you know why this so critical for some of us:
I have a simple account with Interactive Brokers, and I need to meet right margin requirements constantly in the instruments that I work with, that's why my Strategy works as it stated above.
Last night, I started my Strategy, and in few moments it opened the first position with a simple trade, so far so good. Then, as expected, the Strategy detects a signal that indicates to reverse the actual position. So, once again, I repeat: the Strategy first checks the actual position ( Market.Position and Quantity.Position ) and submits a simple order to flat the actual Position. When this is done and checked, by verifying the Market.Position and Quantity.Position coming supposedly from "my broker's account", then the Strategy would submit a new order for the new desired position, pretty straightforward. Well, last night, I got eventually several margin warnings and rejected orders cause margin was not met. Since the Strategy always works with the right quantity to meet margins, I decided to investigate and I found that the problem was the Strategy was submitting the second order to open a new position WHILST Interactive Brokers still has not been yet updated with the actual and right Market.Position and Quantity.Position, so How was this possible??? Well, obviously the Strategy is getting some temporary-internal Strategy position from NT instead of my broker's account as it should be. Because, eventually when the broker's account is updated, the order is processed just fine.
Having explained the issue, is there any way to check ONLY my broker's account info OR this is a critical bug that you need to fix immediately?
Will I have to implement some snippet ( like below ) cause NT is not working properly with the info coming from the broker's account right away?
foreach (Account acct in Cbi.Globals.Accounts) { if ( acct.Name == "XXXXXXX") { PositionCollection positions = acct.Positions; foreach (Position pos in positions) { if (pos.Instrument.FullName == "ES XXXXXX") { if ( Position.MarketPosition != pos.MarketPosition || Position.Quantity != pos.Quantity ) { // Do something } } } } }
Looking forward to this urgent requirement. I have a lot of pressure on me and this kind of issues makes me unhappy. Please help.
Thanks
Comment