Autonomous Compiler Agent for MetaTrader 5 – what would you build with it?

 

Hey everyone,

quick note first: This is not an ad. I’m genuinely curious how you use AI (Claude, Gemini, ChatGPT) in your MQL5 workflow to speed things up and reduce errors. I’d love to start a standing “Chatbots & Workflow” topic here—sharing real prompts, practices, and pitfalls.

I’ve been coding for almost two years, and I just had a real breakthrough with AI: an autonomous compiler agent (MetaEditor/Terminal CLI verified) that compiles, parses logs into structure, and makes build pipelines reliable. My approach: let the AI generate many small code blocks, and I only review logic & integration (compile, quick tests, review).

Why this scales (rules of thumb):

  • Tokens → characters: ~1 token ≈ ~4 characters.

  • Characters per code line: often ~40–60 ⇒ roughly ~12.5 tokens/line.

  • Context (per agent): ~200k+ tokens ⇒ about ~16,000 lines in context.

  • Heuristic: 100 lines ≈ ~1,000 tokens (~10 T/line) also matches practice well.

What that means in blocks:
With ~16,000 lines of context, you can roughly fit:

  • 30-line blocks: ~533 blocks

  • 60-line blocks: ~266 blocks

  • 120-line blocks: ~133 blocks

  • 300-line blocks: ~53 blocks

With this setup, you can sketch complete libraries/modules in just a few days (Risk, Entry/Exit patterns, backtest utils, logging, param parsing, etc.) and then harden them systematically.

My questions to you:

  1. What do you use AI for, concretely? (scaffolding, refactoring, tests, docs, bug-hunting, research?)

  2. How do you chunk code effectively? (functions 20–60 lines, modules 120–300 lines, EAs 300–1,000+—what works best for you?)

  3. What guardrails keep you safe from hallucinations? (compiler checks, minimal repros, rigid project templates, style guides?)

  4. Team workflows: Are you running pre-commit checks/CI with AI feedback?

  5. Prompts: Which prompt patterns give you consistently good MQL5 output?

Keen to hear your examples, lessons learned, and common pitfalls—code snippets and pipeline screenshots welcome.
Best,
Mustafa Seyyid Sahin

 

I am writing this as moderator, not as coder. We will allow this topic, but we will not accept AI generated messages. The opening post is mainly AI generated and we tolerate it as an exception.

Thank you.

 
Alain Verleyen #:

I am writing this as moderator, not as coder. We will allow this topic, but we will not accept AI generated messages. The opening post is mainly AI generated and we tolerate it as an exception.

Thank you.

Thank you for the clear feedback and the exception. I respect the rule against AI posts. I will manually revise the opening post. In future, I will only write manually composed texts here.

Just to clarify: In my opinion, the MT5 ecosystem is also increasingly moving toward AI as an assistant. This is used for brainstorming, comparing opinions, and troubleshooting. In the current AI era, there are many productive advantages to be gained from this. That's exactly what I'm talking about: responsible use, not automatic code posting.

I am fully aware that it would be unprofessional to clutter the forum with AI code. This would detract from the added value. I only share carefully checked, manually written content here. Thank you for moderating!

 

At the current state of the art of AI, I don't find it applicable for practical software development (specifically, code writing).

The reason is that AI generates an output that requires you to be an expert to proofread it, and if you are an expert - you don't need AI because you already know how to impement and usually already have a lot of code fragments implementing what you need. You just intergate them into a project.

If you're not an expert, you'll be facing a lot of AI generated errors (conceptual, syntactic, logical, etc), which leads to a pour performance (of development process) and does not help you to learn as a developer, because you learn when you do something yourself and understand it. With AI you will not understand, what you do, even if AI tries to explain some things (what can be a false knowledge).

I'd suppose that current AI could be very helpful for automatic transpiling/transcoding from one programming language to another, for common security checks, and other software related tasks without creativity. Because AI can't currently combine creativity with strict adhearing to rules/syntaxes/pre-conditions/APIs.

Most likely in 5-10 years the situation will improve. We'll see.

 
Mustafa Seyyid Sahin:

I’d love to start a standing “Chatbots & Workflow” topic here—sharing real prompts, practices, and pitfalls.

I’ve been coding for almost two years

Please describe your workflow. How did you solve the security problem of giving an AI agent control over your computer?
 
Stanislav Korotky #:

At the current state of the art of AI, I don't find it applicable for practical software development (specifically, code writing).

The reason is that AI generates an output that requires you to be an expert to proofread it, and if you are an expert - you don't need AI because you already know how to impement and usually already have a lot of code fragments implementing what you need. You just intergate them into a project.

If you're not an expert, you'll be facing a lot of AI generated errors (conceptual, syntactic, logical, etc), which leads to a pour performance (of development process) and does not help you to learn as a developer, because you learn when you do something yourself and understand it. With AI you will not understand, what you do, even if AI tries to explain some things (what can be a false knowledge).

I'd suppose that current AI could be very helpful for automatic transpiling/transcoding from one programming language to another, for common security checks, and other software related tasks without creativity. Because AI can't currently combine creativity with strict adhearing to rules/syntaxes/pre-conditions/APIs.

Most likely in 5-10 years the situation will improve. We'll see.

Artificial intelligence is changing software development. I have been programming for about six years, including two to three years in MQL5, and I find that AI is a real multiplier for experienced developers. Those who know the language and the basics can use AI in a targeted manner. This allows, for example, function frameworks, tests, or logging structures to be created more quickly. This saves time while still maintaining control. Mistakes do happen, but experienced developers recognize them quickly and therefore use AI as an accelerator, not a risk. I also think beginners learn when they do everything themselves, which is logical. Once the foundation is in place, efficiency becomes more important, and that's where AI is already very helpful today. I also believe that not everyone can work effectively with AI right away. You first have to get a feel for how to use it properly. Especially in the beginning, prompting is important because the results depend heavily on how you phrase your questions.

 
Vladislav Boyko #:
Please describe your workflow. How did you solve the security problem of giving an AI agent control over your computer?

Hmm, I'll try to explain it simply. So, I wrote a total of nine different Python codes to understand how MetaEditor is structured, which involved a lot of research, really a lot. First, I spent several months developing nine different Python scripts to understand exactly how MetaEditor works locally. I tested many commands and researched intensively until I finally found a stable solution. In the end, my AI agent was able to perform the entire process independently, i.e., write code, compile, check, improve, and recompile until there were no more errors.

For secure implementation, I use Claude Code from Anthropic within a controlled development workflow. The agent runs in an isolated sandbox environment with strictly limited rights. Access is only possible via scoped permissions—i.e., clearly defined file and process rights, without administrator access or open network interfaces.

The whole thing is based on a combination of Windows security mechanisms (NTFS, UAC) and process-based isolation, which means that the agent is only allowed to interact with MetaEditor components. Production systems remain completely separate.

 
Vladislav Boyko #:
Please describe your workflow. How did you solve the security problem of giving an AI agent control over your computer?

I use AI for "help me choose a class/method name," "help me formulate a commit message." That is, for the English language, roughly speaking. I never ask AI to write code.

So, when I ask the AI ​​to formulate a commit message, it would be really convenient if it could see all the files in my project. I've been thinking about installing Claude Code CLI (or something similar from another company), but I haven't done so yet due to security concerns. What if this thing goes crazy one day and downloads me something with stealer inside? Or will it make my computer vulnerable to attacks from the internet (open some ports, for example, I don’t know, I’m not a hacker)?

Has anyone here solved the security problem of giving AI agents control over your computer?

 
Mustafa Seyyid Sahin #:
The agent runs in an isolated sandbox environment with strictly limited rights. Access is only possible via scoped permissions—i.e., clearly defined file and process rights, without administrator access or open network interfaces.

Let's imagine that I installed Claude Code CLI. How do I achieve the isolated sandbox you're talking about?

Mustafa Seyyid Sahin #:
Production systems remain completely separate.

What do you mean by "Production systems" for MQL development?

 
Vladislav Boyko #:

Let's imagine that I installed Claude Code CLI. How do I achieve the isolated sandbox you're talking about?

What do you mean by "Production systems" for MQL development?

With “isolated sandbox,” I don’t mean a full VM like Docker, but rather a controlled setup at the operating system level. Claude Code CLI runs with normal user privileges, meaning no admin rights, no open ports, and no network access outside the Anthropic API (Anthropic Docs, 2025).

Security in my setup is based on three layers:

  • OS isolation: NTFS and UAC policies prevent write access to system directories.

  • Scoped permissions: The agent can only write to defined project paths and cannot start foreign processes (Backslash Security, 2025).

  • Manual control: Every action is transparent; I can see it in the chat and stop it at any time.

Regarding “production systems”: In the MQL context, I mean a clear separation between demo terminals (development) and live accounts (production). My agent only operates on a separate demo terminal without any broker credentials, keeping it completely isolated from real trading environments.

I trust Claude Code because Anthropic is certified under SOC 2 Type 2 and ISO 27001, and places strong emphasis on security (Anthropic Security Overview, 2025). Of course, something could theoretically always happen in the background, but such an incident would severely damage trust in a multi-billion-dollar company. That’s why I consider the risk to be very low.


Well, my trust in the company is perhaps due to the fact that I have been a security tester for about six months and have not been able to find any security vulnerabilities. (There are also many interesting reports where users have spent days trying to find security vulnerabilities without success.)

Security - Claude Docs
Security - Claude Docs
  • docs.claude.com
Learn about Claude Code's security safeguards and best practices for safe usage.
 
Vladislav Boyko #:
...

Has anyone here solved the security problem of giving AI agents control over your computer?

Yes sure, just don't do it. Problem solved.

P.S.: I think you should put aside security issue in this topic, as it's an entire other subject not specifically tied to AI.