ORDER_TYPE_CLOSE_BY with Ctrade Standard Library
arimbur: I can't understand how to close an open buy with a ORDER_TYPE_CLOSE_BY. my code : this is what I get on the Journal on the strategy Tester..
I think you may be misunderstanding something. "ORDER_TYPE_CLOSE_BY" is only used when you have opposing positions on a "hedging" account, and you want to close them simultaneously against each other and save on trading costs (which does not seem to be your case).
Closes a position with the specified ticket by an opposite position
To close a normal single position by using the CTrade class, then use the following method:
Closes a position for the specified symbol
Documentation on MQL5: Standard Library / Trade Classes / CTrade / PositionClose
- www.mql5.com
PositionClose(const string,ulong) - CTrade - Trade Classes - Standard Library - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
Hello,
I can't understand how to close an open buy with a ORDER_TYPE_CLOSE_BY.
my code :
Close Error code 0this is what I get on the Journal on the strategy Tester..