Check Open Trade
CheckOpenTrade¶
Performs a validation check for opening a trade based on the provided trade parameters.
int CheckOpenTrade(const TradeRecord& source_trade);
Parameters¶
- source_trade — constant reference to a TradeRecord structure containing the trade parameters to be validated.
Return Value¶
RET_OK— trade parameters are valid for opening.RET_*— error code if trade cannot be opened.- Return Codes
Example¶
TradeRecord tr = {};
tr.login = 1001;
tr.symbol = "EURUSD";
tr.cmd = OP_BUY;
tr.volume = 1000;
tr.sl = 1.0500;
tr.tp = 1.0800;
if (CheckOpenTrade(tr) == RET_OK) {
// Trade parameters are valid
}
Warning
- This function does not open the trade, it only validates the parameters.
- Use
OpenTradeafter successful validation to place the trade. - Always check the return code before proceeding.