-
Notifications
You must be signed in to change notification settings - Fork 128
Open
Description
Description
The EA logs a critical error calcCostByTicket error #4754 when attempting to process a specific ticket. This occurs on the XAUUSD on the M1 timeframe. The error indicates that OrderSelect or a history selection function failed because the ticket number provided does not exist in the current terminal context.
Error Log
2025.12.27 23:44:37.119 LRCUTB-v1.4 (XAUUSD,M1) calcCostByTicket error #4754 : Order not found (ticket=-83369947)
Environment
- Platform: MetaTrader 5 (MT5)
- Expert Advisor: LRCUTB-v1.4
- Symbol: XAUUSD
- Timeframe: M1
- Error Code: 4754 (
ERR_TRADE_ORDER_NOT_FOUND)
Suspected Root Causes
- Ticket Initialization: The log shows a negative ticket number (
-83369947). In MT5, ticket numbers areulong(unsigned), but a negative value suggests a casting error or an uninitialized variable being passed to the function. - History Synchronization: The function
calcCostByTicketmay be trying to access a closed order beforeHistorySelecthas been called or before the terminal has synchronized the trade history. - Race Condition: The order may have been deleted or filled and moved to history between the time the ticket was captured and the time
calcCostByTicketwas executed.
Steps to Reproduce
- Attach LRCUTB-v1.4 to XAUUSD.
- Allow the EA to execute a trade or modify an existing position.
- Monitor the "Experts" tab for error #4754.
Proposed Fixes
- Check the logic where the ticket variable is assigned to ensure it isn't being corrupted or treated as a signed integer.
- Wrap the
calcCostByTicketlogic in a check to verify if the ticket exists usingOrderSelect()orHistoryOrderSelect()before processing. - Ensure
HistorySelect(0, TimeCurrent())is called prior to searching for the ticket in the history pool.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels