I’m using MT5 hedging account and I’m trying to open an opposite market order (hedging order). I’m using MT5 hedging platform. The problem is when I open the hedging order the existing order gets closed, why is that? Here is my order opening code.
// Open buy market order
if(close[0] > ma[0] && glBuyPlaced == false)
{
// Open buy order
request.action = TRADE_ACTION_DEAL;
request.type = ORDER_TYPE_BUY;
request.symbol = _Symbol;
request.position = 0;
request.volume = TradeVolume;
request.price = SymbolInfoDouble(_Symbol,SYMBOL_ASK);
request.sl = 0;
request.tp = 0;
request.deviation = 50;
bool sent = OrderSend(request,result);
// Open opposite market order
else if(close[0] < ma[0] && glBuyPlaced == true)
{
// Open sell order
request.action = TRADE_ACTION_DEAL;
request.type = ORDER_TYPE_SELL;
request.symbol = _Symbol;
request.position = 0;
request.volume = TradeVolume;
request.price = SymbolInfoDouble(_Symbol,SYMBOL_BID);
request.sl = 0;
request.tp = 0;
request.deviation = 50;
bool sent = OrderSend(request,result);