Hi,
Can someone write for me short simple code which close position.
I used that code to open position but I can not close it.
request.action = TRADE_ACTION_DEAL;
request.symbol = _Symbol;
request.volume = Lot;
request.price = Bid;
request.sl = Loss;
request.tp = Profit;
request.deviation = SP;
request.type = PositionDirection;
request.type_filling = ORDER_FILLING_FOK;
OrderSend(request, result);
I expect something simple too.
Thanks for help.
You should try to use the stardand library, in particular, CTrade (#include <Trade\Trade.mqh>).
It simplify a lot stuffs like that. If you don't want to you it for some reason, look it anyway to find examples on how to use this kind of function corretly.
regards.
Fringe
Hi,
Can someone write for me short simple code which close position.
I used that code to open position but I can not close it.
request.action = TRADE_ACTION_DEAL;
request.symbol = _Symbol;
request.volume = Lot;
request.price = Bid;
request.sl = Loss;
request.tp = Profit;
request.deviation = SP;
request.type = PositionDirection;
request.type_filling = ORDER_FILLING_FOK;
OrderSend(request, result);
I expect something simple too.
Thanks for help.
You can send a ordersend with the opposite direction to close the trade
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi,
Can someone write for me short simple code which close position.
I used that code to open position but I can not close it.
request.action = TRADE_ACTION_DEAL;
request.symbol = _Symbol;
request.volume = Lot;
request.price = Bid;
request.sl = Loss;
request.tp = Profit;
request.deviation = SP;
request.type = PositionDirection;
request.type_filling = ORDER_FILLING_FOK;
OrderSend(request, result);
I expect something simple too.
Thanks for help.