(Thought) Autonomous AI "Research Agent" for CommunityPower EA (MT5 + MCP)

Avatar
  • updated

The Goal

is to allow an LLM (like claude sonnet 4.5 / gemini3.0 or cli via Cursor/Antigravity/kilocode/other IDE) to:

  1. Read our complex .set files intelligibly.
  2. Understand the parameters by cross-referencing the official docs for CommunityPowerEA.
  3. Modify the strategy safely based on natural language (e.g., "Make this set news-neutral"). 
  4. (Future Phase) Run the backtest automatically and learn from the results with windows MCP. https://github.com/CursorTouch/Windows-MCP

Image 6749

The Challenge: Parsing .set Files

We all know the CommunityPower .set files use the custom MT5 optimization syntax: Key=Value||Start||Step||Stop||Enabled

Example Raw Line: Lot_Per_1000=0.01||0.01||0.001000||0.100000||N

If you feed this raw text to an AI, it gets confused by the optimization parameters (||...). It often hallucinates or breaks the file format when trying to edit it.

The Solution: A Custom MCP Parser To develop a Python-based MCP server that parses this syntax into a clean JSON structure that the AI can understand.

The Knowledge Gap (RAG Integration)

The EA uses numeric IDs for settings, which is hard for an AI to interpret.

  • In File: Oscillators_Indicator=3
  • To AI: "Set Indicator to 3" (The AI doesn't know what 3 is).

Such integrating the documentation so the MCP Server presents this to the AI as:

  • To AI: Oscillators_Indicator=3 (Stochastic)

E.g:

def parse_cp_line(line):
"""
Converts: Lot_Per_1000=0.01||0.01||0.001||0.1||N
To: {'value': 0.01, 'opt_start': 0.01, 'opt_step': 0.001, ...}
"""
if "=" not in line or "||" not in line:
return None

key, properties = line.split("=", 1)
parts = properties.split("||")

# The AI primarily cares about the 'active_value'
return {
"parameter": key.strip(),
"active_value": parts[0],
"optimization_config": {
"start": parts[1],
"step": parts[2],
"stop": parts[3],
"enabled": parts[4]
}
}
Avatar
0

Yeah, everyone is using LLMs now, even this thread was generated, wasn't it? Do you want my LLM to answer this? ;)

I don't think MT5 and CP EA are the best choice for automating this job. CP is powerful, right, but MT5 is not flexible enough to automate complex tasks.

Check out some open source projects on the web, there are many of them now.

Avatar
0
leo

I wouldn't optimize an existing Expert Advisor (EA) with AI. MetaTrader's backtesting capabilities are good for this. Indicators are laggy and never show what's coming. And a good backtest might not work well in a demo account. And with bad luck, a good demo might not work well in a live account.

a) You could ask AI what the three best trading strategies are and then have AI program them. With AI, you should try to reach the Expert level. Otherwise, you'll only get superficial answers.

b) If you really want to build an LLM: My suggestion would be "Al Brooks' Encyclopedia of Chart Patterns." Compare chart images.

c) Learn how financial institutions behave. What their price targets are. And remember, institutions also issue margin calls from time to time.