PositionsTotal - Wrong value provided

 

Hi,


I'm testing an EA on Strategy Tester with the debugging mode on MT5.

I put a break point somewhere and wait for it to trigger.

Then, I store the value of PositionsTotal() on a variable to debug it.

While on my trading tab, I can see two open positions, the PositionsTotal() is returning only one.


What's wrong?

These are the positions open at the time of the break point is reached.



It's only detecting the position with ticket 6.


Who can help?

 
If the position was taken during that tick event, It only gets updated when you return from OnTick().
 
Fernando Carreiro #:
If the position was taken during that tick event, It only gets updated when you return from OnTick().

Turns out that position got closed at that tick, and I had to skip to the next tick for it to disapear.

Thanks for your response!

 
Rui Ferreira #: Thanks for your response!
You are welcome!
Reason: