Close the following trade in mt5

 

I am new to developing expert advisors on meta trader platform and hence I got stuck at a small problem which I don't think require any expertise to solve.

if(BuyCondition1 && BuyCondition2 && BuyCondition3 && !Buy_Opened)
     {
      mRequest.action=TRADE_ACTION_DEAL;
      mRequest.price=NormalizeDouble(latestPrice.ask,_Digits);
      mRequest.sl=0;
      mRequest.tp=0;
      mRequest.symbol=_Symbol;
      mRequest.volume=Lot;
      mRequest.magic=EAMagic;
      mRequest.type=ORDER_TYPE_BUY;
      mRequest.type_filling=ORDER_FILLING_FOK;
      mRequest.deviation=100;
      ticket=OrderSend(mRequest,mResult);
     }

   if(SellCondition1 && SellCondition2 && SellCondition3 && !Sell_Opened)
     {
      mRequest.action=TRADE_ACTION_DEAL;
      mRequest.price=NormalizeDouble(latestPrice.bid,_Digits);
      mRequest.sl=0;
      mRequest.tp=0;
      mRequest.symbol=_Symbol;
      mRequest.volume=Lot;
      mRequest.magic=EAMagic;
      mRequest.type=ORDER_TYPE_SELL;
      mRequest.type_filling=ORDER_FILLING_FOK;
      mRequest.deviation=100;
      ticket=OrderSend(mRequest,mResult);
     }

If I use the above code to place a Buy/Sell trade then what is the opposite of this Buy/Sell function which will close each of the trade.I don't want to use TAKEPROFIT/STOPLOSS.

 
Sudhanshu Gupta:

I am new to developing expert advisors on meta trader platform and hence I got stuck at a small problem which I don't think require any expertise to solve.

If I use the above code to place a Buy/Sell trade then what is the opposite of this Buy/Sell function which will close each of the trade.I don't want to use TAKEPROFIT/STOPLOSS.

Use a BUY to close a SELL and vice-versa.