Native AI Integration in MQL5: What Should Expert Advisors Be Able to Do?
External AI APIs can already be accessed through WebRequest, but native AI access through an official MQL5 API would be a different story.
Really ? Why ?
Yes, absolutely. We can already communicate with virtually any AI model using WebRequest. That's not the issue.
My point is about native integration into MQL5 itself. Instead of manually handling HTTP requests, headers, API authentication, JSON formatting, response parsing and error handling in every EA, MetaQuotes could provide built-in functions, just like other functions already available in MQL5.
For example, something like:
string response;
MQL_AI(
string input_content, // Chat message
api_key, // AI AI key
model, // AI model choose
input_parameters, // parameters
response // AI response
);
Ideally, it could even use the AI provider and model already configured in the MT5 terminal, without requiring separate API configuration in every EA.
The idea is to make AI interaction a native part of the language, simple to call and easy to integrate into trading logic.
Of course, this would require development by MetaQuotes. It's not about whether HTTP requests can do the job; it's about making AI access a built-in MQL5 capability rather than having every developer implement their own API integration.
With the new AI integration in MetaTrader 5, I think there's an opportunity to take things further.
Wouldn't it be useful if MQL5 developers could access the AI model configured in the terminal directly from their Expert Advisors?
I'm not talking about using AI to write code. Imagine an EA sending market data, indicator values or trading context to the built-in AI, receiving an analysis, and using its response as part of its trading logic.
External AI APIs can already be accessed through WebRequest, but native AI access through an official MQL5 API would be a different story.
I think this would be a valuable feature request for MetaQuotes. Ideally, it should support asynchronous communication, structured responses and Strategy Tester compatibility.
Has anyone explored this possibility? Like a WebRequest to local: "http://127.0.0.1:22346/mcp" ? Or using ONNX?
How would you use native AI integration in your Expert Advisors, and what features would you like to see? Let's share ideas and experiences that could help shape the future of AI integration in MQL5.