Get Open Trades By Login
GetOpenTradesByLogin¶
Retrieves all currently open trades for a given account login.
int GetOpenTradesByLogin(int login, std::vector<TradeRecord>* trades);
Parameters¶
- login — integer representing the account login ID.
- trades — pointer to a
std::vectorof TradeRecord structures where the retrieved open trades will be stored.
Return Value¶
RET_OK— open trades found and successfully retrieved.RET_NOT_FOUND— no open trades found for the specified login.RET_*— other error codes.- Return Codes
Example¶
std::vector<TradeRecord> openTrades;
if (GetOpenTradesByLogin(1001, &openTrades) == RET_OK) {
// Process openTrades
}
Warning
- The
tradespointer must point to a validstd::vector<TradeRecord>object. - If no open trades are found, the function will return
RET_NOT_FOUNDand leavetradesunchanged. - Always check the return code before accessing
trades.