If its a buy position, do a sell with same volume and vice versa
#include <Trade\Trade.mqh> CTrade m_trade; m_trade.PositionClose(Symbol());
Hi.
I good like close only which are open whith specific magicnumber.
I'm facing the same problem... I tried to use m_trade.PositionClose(Symbol()); but keeps getting error code 10006. I also tried open a position on the opposite direction but just keeps opening a new operation :(

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,
How should I implement immediate position close in MLQ5?
The only way to close something that I found is SendOrder with request action TRADE_ACTION_REMOVE. But removed pending orders, and not active position.
Thanks