Just curious if there a neat way of closing order without using CTrade in trade.mqh file in MT5.
Just miss simple standalone "OrderClose" function in MT4.
Must be a position otherwise he/she would have said "miss OrderDelete()" . . . just send an equivalent order of the same size as you want to close but in the opposite direction, so to close a Buy open a Sell.
You are right.
To answer the OP, you can use MqlTradeRequest as you have done here to modify your sl/tp. CTrade class is only a wrapper class using MqlTradeRequest internally.
You are right.
To answer the OP, you can use MqlTradeRequest as you have done here to modify your sl/tp. CTrade class is only a wrapper class using MqlTradeRequest internally.
Sorry for confusion I would like to close positions not a pending orders. Thanks for clarification. Yes I thought about using MqlTradeRequest method.
Then I checked Trade Operation Type and I can't find any actions related to Closing positions.
These are all trade actions I can find from MQL references and am I looking at wrong place? :
Identifier | Description |
TRADE_ACTION_DEAL | Place a trade order for an immediate execution with the specified parameters (market order) |
TRADE_ACTION_PENDING | Place a trade order for the execution under specified conditions (pending order) |
TRADE_ACTION_SLTP | Modify Stop Loss and Take Profit values of an opened position |
TRADE_ACTION_MODIFY | Modify the parameters of the order placed previously |
TRADE_ACTION_REMOVE | Delete the pending order placed previously |
Sorry for confusion I would like to close positions not a pending orders. Thanks for clarification. Yes I thought about using MqlTradeRequest method.
Then I checked Trade Operation Type and I can't find any actions related to Closing positions.
These are all trade actions I can find from MQL references and am I looking at wrong place? :
. . . just send an equivalent order of the same size as you want to close but in the opposite direction, so to close a Buy open a Sell.
Sorry for confusion I would like to close positions not a pending orders. Thanks for clarification. Yes I thought about using MqlTradeRequest method.
Then I checked Trade Operation Type and I can't find any actions related to Closing positions.
These are all trade actions I can find from MQL references and am I looking at wrong place? :
Identifier | Description |
TRADE_ACTION_DEAL | Place a trade order for an immediate execution with the specified parameters (market order) |
Yes, as RaptorUK wrote, you have to send a request (ACTION_DEAL) for an order, in the opposite direction with same volume.
Order management is very different in mql5 relative to mql4 : read this article
- 2011.02.01
- MetaQuotes Software Corp.
- www.mql5.com
Yes, as RaptorUK wrote, you have to send a request (ACTION_DEAL) for an order, in the opposite direction with same volume.
Order management is very different in mql5 relative to mql4 : read this article
Yes, as RaptorUK wrote, you have to send a request (ACTION_DEAL) for an order, in the opposite direction with same volume.
Order management is very different in mql5 relative to mql4 : read this article
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Just curious if there a neat way of closing order without using CTrade in trade.mqh file in MT5.
Just miss simple standalone "OrderClose" function in MT4.