Fix 7 MQL4/MQL5 bugs: timer polling, JSON parsing, TimeBar, UnlockTicks, iCustom, OrderComment#297
Closed
tudstudent wants to merge 2 commits intovdemydiuk:masterfrom
Closed
Fix 7 MQL4/MQL5 bugs: timer polling, JSON parsing, TimeBar, UnlockTicks, iCustom, OrderComment#297tudstudent wants to merge 2 commits intovdemydiuk:masterfrom
tudstudent wants to merge 2 commits intovdemydiuk:masterfrom
Conversation
…ng, iCustom, OrderComment MQL5 (MtApi5.mq5): - Add Period field to MtTimeBarEvent JSON payload (fixes #290) - Fix Execute_UnlockTicks: set _is_ticks_locked = false (fixes #261) - Add EventSetMillisecondTimer(100) for live trading command polling (fixes #295/PR) - Move OnTimer() call outside IsTesting() block in OnTick() - Fix iCustom double params: ArrayResize before write loop (fixes #266) - Add EventKillTimer() in deinit() MQL4 (MtApi.mq4): - Add Period field to MtTimeBar JSON payload (fixes #290) - Always serialize Comment field even when empty (fixes #167) - Add EventSetMillisecondTimer(100) for live trading - Add OnTimer() call in OnTick() else branch - Add EventKillTimer() in OnDeinit() Note: Timer polling changes overlap with PR #295 but include additional fixes. This PR supersedes #295 with a broader fix set.
This was referenced Mar 21, 2026
mq5/json.mqh: - Fix JSON string escaping: backslash, quote, newline, CR, tab (PR #294) - Fix negative integer parsing: reset digit index after sign (PR #292) mq4/json.mqh: - Fix negative integer parsing: same fix as MT5 (PR #292 was MT4 only) Note: MQL4 json.mqh already had the backslash escaping workaround via manual StringReplace in individual Execute_ functions, but the MQL5 fix at the serialization layer is the proper approach.
This was referenced Mar 21, 2026
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
Fixes 7 bugs across MQL4 and MQL5 Expert Advisors. Tested against live Eightcap demo terminals.
MQL5 (MtApi5.mq5):
EventSetMillisecondTimer(100)for live trading — commands now process without waiting for ticks (fixes EA MtApi5 get locked/frozen under mutli-symbol optimization mode during backtesting #261 freeze, supersedes PR MQL5: add timer-based command polling for live trading #295)Execute_UnlockTicks(): was missing_is_ticks_locked = falsecausing backtesting freeze (EA MtApi5 get locked/frozen under mutli-symbol optimization mode during backtesting #261)Periodfield toMtTimeBarEventJSON so clients can identify bar timeframe (time_bar, but the period of the bar is unknown. #290)iCustomdouble params:ArrayResizewas called AFTER the write loop (out-of-bounds crash) (iCustom with parameters #266)EventKillTimer()indeinit()for cleanupMQL4 (MtApi.mq4):
EventSetMillisecondTimer(100)for live trading (same as MT5)Periodfield toMtTimeBarJSON (time_bar, but the period of the bar is unknown. #290)Commentfield even when empty string — prevents null on client side (about order's comment is null #167)EventKillTimer()inOnDeinit()Notes
Test plan