MQL5: add timer-based command polling for live trading#295
Open
biohazardxxx wants to merge 12 commits intovdemydiuk:devfrom
Open
MQL5: add timer-based command polling for live trading#295biohazardxxx wants to merge 12 commits intovdemydiuk:devfrom
biohazardxxx wants to merge 12 commits intovdemydiuk:devfrom
Conversation
OnTimer() (which drains the command queue via executeCommand()) was only called from OnTick() during backtesting. In live trading, commands from the .NET client would queue up and never be processed until the next market tick arrived, making the EA unresponsive on low-volume symbols or outside market hours. - Add EventSetMillisecondTimer(100) in init() for live trading mode - Call OnTimer() on every tick regardless of mode (supplements the timer) - Add EventKillTimer() in deinit() for cleanup Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The .ex5 binary was stale and still referenced removed DLL imports (getIntValue, getDoubleValue, etc.) that no longer exist in MT5Connector.dll since the migration to the JSON payload-based protocol (getPayload). This caused "unresolved import function call" errors when loading the EA in MetaTrader. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
OnTimer()(which drains the command queue) was only called fromOnTick()during backtesting. Commands from the .NET client would queue up and never be processed until the next market tick, making the EA unresponsive on low-volume symbols or outside market hours.EventSetMillisecondTimer(100)ininit()for live trading mode so commands are polled every 100ms regardless of tick activity.OnTimer()is now also called on every tick (supplements the timer for lowest latency when ticks are flowing).EventKillTimer()indeinit()for proper cleanup.Test plan
MtApi5.mq5with MetaEditor — verified 0 errors, 0 warningsOnTick()still callsOnTimer())🤖 Generated with Claude Code