A bit strange. Try printing Bid price... Long position is closed with Bid price.
Milko Vivaldi:
Hello,
I have a strange problem when work on strategy tester of MT5, practically, although the targets (stoploss and takeprofit) are regularly placed, the ea's (all) do not read them so the trade never closes. It seems that the price reads nothing in fact if I print the current price (by class PositionInfo) it is always the same as when the trade was entered (it prints Ask if the trade is sell and vice versa). Even the profits in the history are always zero (if I force the closure in another way, for example at the moving average).
The code is simple, only for try...
Please help me
Is that a custom symbol ?
Please post the full log.

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hello,
I have a strange problem when work on strategy tester of MT5, practically, although the targets (stoploss and takeprofit) are regularly placed, the ea's (all) do not read them so the trade never closes. It seems that the price reads nothing in fact if I print the current price (by class PositionInfo) it is always the same as when the trade was entered (it prints Ask if the trade is sell and vice versa). Even the profits in the history are always zero (if I force the closure in another way, for example at the moving average).
The code is simple, only for try...
Please help me