I use an unsupported piece of code to enter the acoounts data. This code worked fine to enter the account position quantity. I test my complete code always in market replay, in which I also have seen this piece of code did the job multiple times. From the one test on the other it did not work anymore and I can't recall what I have changed (it's a very large code on which I work on different areas at the the same time). But I do know for sure the problem is in the calling of the positions, as I tested with print statements the consequative steps in the account quering code.
The accounts are being called, but the positions are not. It does not differ if I add a test for Positions != null of == null. But without this test It has worked previously also.
Do you have any idea where to look at? Could it be something with market replay? I have resetted the db's, restarted NT multiple times, but the problem still exist and after the foreach Positions nothing is called anymore. When I deactivate the total foreach the rest of the code works fine again. I have tried anything I can think of, without any success.
foreach (Account acct in Cbi.Globals.Accounts)
{
Print("Accounts are called");
PositionCollection positions = acct.Positions;
foreach (Position pos in positions)
{
Print("Positions are called");
int intEnterQuantity = pos.MarketPosition == MarketPosition.Short ? pos.Quantity : 1;
... code...
}
}
Kind regards,
Francis
Comment