Download MetaTrader 5

Position close in MQL5

To add comments, please log in or register
TheWho
10
TheWho  

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 

Dua Yong Rew
5476
Dua Yong Rew  
If its a buy position, do a sell with same volume and vice versa
Atsushi Yamanaka
5519
Atsushi Yamanaka  
#include <Trade\Trade.mqh>
CTrade            m_trade;

m_trade.PositionClose(Symbol());
 
little1hu
8
little1hu  

Hi.

I good like close only  which are open whith specific magicnumber.

vinyoliver
29
vinyoliver  
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 :(
To add comments, please log in or register