Alex Wong:
hi all,
i'm trying to create my own expert adviser. However, i don't know the coding (mql5) that for close the opened position by (OrderType() == OP_BUY) or (OrderType() == OP_SELL).
It is so much different with mql4.
Kindly share a sample coding (mql5) for the below situation.
if condition A, then close all the opened position (long/buy)
if condition B, then close all the opened position (short/sell)
Thank you.
Please read the document about your problem here.
https://www.mql5.com/en/docs/constants/tradingconstants/enum_trade_request_actions
Documentation on MQL5: Standard Constants, Enumerations and Structures / Trade Constants / Trade Operation Types
- www.mql5.com
Standard Constants, Enumerations and Structures / Trade Constants / Trade Operation Types - Reference on algorithmic/automated trading language for MetaTrader 5
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
hi all,
i'm trying to create my own expert adviser. However, i don't know the coding (mql5) that for close the opened position by (OrderType() == OP_BUY) or (OrderType() == OP_SELL).
It is so much different with mql4.
Kindly share a sample coding (mql5) for the below situation.
if condition A, then close all the opened position (long/buy)
if condition B, then close all the opened position (short/sell)
Thank you.