Skip to content

Fix 7 MQL4/MQL5 bugs: timer polling, JSON parsing, TimeBar, UnlockTicks, iCustom, OrderComment#297

Closed
tudstudent wants to merge 2 commits intovdemydiuk:masterfrom
tudstudent:pr/mql-bugfixes
Closed

Fix 7 MQL4/MQL5 bugs: timer polling, JSON parsing, TimeBar, UnlockTicks, iCustom, OrderComment#297
tudstudent wants to merge 2 commits intovdemydiuk:masterfrom
tudstudent:pr/mql-bugfixes

Conversation

@tudstudent
Copy link

Summary

Fixes 7 bugs across MQL4 and MQL5 Expert Advisors. Tested against live Eightcap demo terminals.

MQL5 (MtApi5.mq5):

MQL4 (MtApi.mq4):

Notes

Test plan

  • Compiled with MetaEditor 0 errors, 0 warnings (both MT4 and MT5)
  • Tested connection, account info, market data, timeseries, indicators, charts, objects, global variables, trading against live Eightcap demo
  • 68 live integration tests passing

…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.
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

EA MtApi5 get locked/frozen under mutli-symbol optimization mode during backtesting

1 participant