Discussing the article: "How MQL5 Lite MCP AI Assistant Changed My Debugging Approach on Generated MQL5 Codes"
Clemence, the line I'd underline is that a clean compile doesn't prove runtime behaviour. Your PriceMarker only draws objects, so the runtime checks you list (price comparison, refresh, cleanup) cover it. Once an EA trades, there's a second class of bug. It compiles and backtests clean, then shows up live. Think of a terminal restart, a position that changes between two lines of your code, or a broker that refuses your stop. No compile step catches those, so they need their own review.
Three things I search for in any generated trading EA before it goes near a live account. First, OnInit. It should rebuild its state from PositionsTotal, filtered by magic number and symbol. If it trusts a static counter instead, a VPS restart resets the counter to zero and the EA opens a second position. Second, anything that selects a position and modifies it a few lines later. Select it again by ticket with PositionSelectByTicket right before the modify. PositionSelect works on a copy of the data, and the docs say to re-select right before you read it. Third, search for SYMBOL_TRADE_STOPS_LEVEL and SYMBOL_VOLUME_STEP. If neither appears, nothing checks the stop distance or normalizes the lot before the order goes out.
Check out the new article: How MQL5 Lite MCP AI Assistant Changed My Debugging Approach on Generated MQL5 Codes.
This article presents a practical debugging workflow with MetaEditor's integrated AI Assistant and a comparison to the previous external approach. We fix a controlled set of syntax and API errors in a D1 PriceMarker EA, inspect modifications, and recompile. The result is validated in the Strategy Tester, with clear boundaries between compilation success and required runtime checks.
In October 2024, I published From Novice to Expert: Collaborative Debugging in MQL5. The article introduced debugging through compiler messages, breakpoints, watch expressions, Print() statements, temporary code isolation, the Strategy Tester, documentation, community assistance, and AI.
That workflow remains useful because debugging is broader than correcting syntax. A compiler can detect a missing delimiter, an undeclared identifier, or an incompatible function call, but it cannot automatically prove that the programmer's trading or analytical intention has been implemented correctly. Runtime state, price data, event order, and strategy assumptions still have to be examined.
The earlier article used a D1 PriceMarker program that drew the previous daily candle's open, high, low, and close levels. Its faulty version produced a cascade of compiler errors. We worked through the reported locations, corrected API calls, and used the result to illustrate several debugging methods.
AI assistance appeared near the end of that process. With an external model, the programmer copied the source code and the MetaEditor error report into a separate chat. After receiving a proposed fix, they copied it back into MetaEditor and recompiled. If another error appeared, the context-transfer loop started again.
This approach worked, but it had friction. The external model did not automatically share the current editor, compiler state, surrounding project files, terminal logs, or the exact modifications that had occurred since the previous prompt. The developer had to transport that context manually and make sure that the external conversation still described the current source.
Author: Clemence Benjamin