Discussing the article: "Building AI-Powered Trading Systems in MQL5 (Part 7): Further Modularization and Automated Trading"

 

Check out the new article: Building AI-Powered Trading Systems in MQL5 (Part 7): Further Modularization and Automated Trading.

In this article, we enhance the AI-powered trading system's modularity by separating UI components into a dedicated include file. The system now automates trade execution based on AI-generated signals, parsing JSON responses for BUY/SELL/NONE with entry/SL/TP, visualizing patterns like engulfing or divergences on charts with arrows, lines, and labels, and optional auto-signal checks on new bars.

Modularization in AI-powered trading systems breaks down complex code into independent, reusable modules—such as UI handlers, data processing, and logic functions—that can be developed, tested, and scaled separately, leading to cleaner code, easier maintenance, reduced bugs, and faster feature additions without disrupting the entire system, which is something that is not new to you by now. Our automated trading builds on this by enabling the AI to not only analyze data but also execute orders directly, parsing signals for buy/sell directives with entry/SL/TP levels, applying risk parameters, and operating 24/7 without emotional bias, thus improving consistency and efficiency in live markets. Together, these enhance overall performance: modular design enables seamless integration of new capabilities, such as dynamic UIs or auto-signals, while automation turns insights into actions, freeing us to focus on strategy refinement.

A key parameter in AI responses is temperature, which controls creativity—low values (e.g., 0.0) produce deterministic, structured outputs like strict JSON for trade signals (ensuring precise BUY/SELL/NONE with prices), while higher values (e.g., 1.0) allow varied, exploratory responses for general chats where flexibility aids problem-solving, and some prompts trigger only trades without full replies for streamlined execution. If you recall, our previous updates involved sending data and extracting results from the responses. We want to be able to get direct, untampered responses like "BUY SIGNAL" and that is all, without chit-chat.

We will use different levels of temperatures to achieve that, but interchangeably, so that we can separate filtered and unfiltered responses. This adaptability will ensure the system handles diverse interactions: factual for automation, creative for analysis. To understand Large Language Models (LLM) temperature settings, have a look below at the different levels we could have and where to use them.

Author: Allan Munene Mutiiria

 
THIS IS NOT COMPLING ON MT5, THERE ARE LOTS OF ERRORS. AND MAIN THING YOU DID NOT DESCIRBE HOW TO USE JASON FILES AND HOW TO COMPLIE THIS EA ON MT5 (FULL PROCESS). I AM NEW SO I HAVE ASKED TO DEEPSEEK AND HERE IS THE ANSWER OF THIS


Looking at the errors, there are several key issues with your code. The main problems are:

  1. Missing include files:  AI JSON FILE.mqh  and  AI UI COMPONENTS.mqh  don't exist

  2. Missing image resources: BMP files are not found

  3. Undeclared variables: Many variables are used without being declared

AND DEEPSEEK CREATE NEW AI JSON FILE.mqh AND AI UI COMPONENTS.mqh

SHOULD I USE THAT

PLEASE GIVE PROPER KNOWLEDGE ABOUT THAT HOW TO USE THIS EA

 
Avinash Chandra Agarwal #:
THIS IS NOT COMPLING ON MT5, THERE ARE LOTS OF ERRORS. AND MAIN THING YOU DID NOT DESCIRBE HOW TO USE JASON FILES AND HOW TO COMPLIE THIS EA ON MT5 (FULL PROCESS). I AM NEW SO I HAVE ASKED TO DEEPSEEK AND HERE IS THE ANSWER OF THIS


Looking at the errors, there are several key issues with your code. The main problems are:

  1. Missing include files:  AI JSON FILE.mqh  and  AI UI COMPONENTS.mqh  don't exist

  2. Missing image resources: BMP files are not found

  3. Undeclared variables: Many variables are used without being declared

AND DEEPSEEK CREATE NEW AI JSON FILE.mqh AND AI UI COMPONENTS.mqh

SHOULD I USE THAT

PLEASE GIVE PROPER KNOWLEDGE ABOUT THAT HOW TO USE THIS EA

Hello. Did you bother reading from initial part?
 
Avinash Chandra Agarwal #:
THIS IS NOT COMPLING ON MT5, THERE ARE LOTS OF ERRORS. AND MAIN THING YOU DID NOT DESCIRBE HOW TO USE JASON FILES AND HOW TO COMPLIE THIS EA ON MT5 (FULL PROCESS). I AM NEW SO I HAVE ASKED TO DEEPSEEK AND HERE IS THE ANSWER OF THIS


Looking at the errors, there are several key issues with your code. The main problems are:

  1. Missing include files:  AI JSON FILE.mqh  and  AI UI COMPONENTS.mqh  don't exist

  2. Missing image resources: BMP files are not found

  3. Undeclared variables: Many variables are used without being declared

AND DEEPSEEK CREATE NEW AI JSON FILE.mqh AND AI UI COMPONENTS.mqh

SHOULD I USE THAT

PLEASE GIVE PROPER KNOWLEDGE ABOUT THAT HOW TO USE THIS EA

Please stop "SHOUTING", don't write in uppercase.

Also watch your tone when communicating with other people.

 
looking through all 6 parts of the main article i can conclude that there are files missing to be able to compile 

missing .mqh include / resource files 
missing .bmp image files. 
also i would to ask is it possible for it to not use chatgpt but to use other LLM's that are done through a web address and that web address api token? 
 
Ricks creations #:
looking through all 6 parts of the main article i can conclude that there are files missing to be able to compile 

missing .mqh include / resource files 
missing .bmp image files. 
also i would to ask is it possible for it to not use chatgpt but to use other LLM's that are done through a web address and that web address api token? 

Hello. To answer your question directly, you'll need to read the previous article parts to understand the flow.

  • All files are included always and labelled with their functions in a table after conclusion.
  • For bmp files, their inclusion was perfectly discussed here in Part 4. Just take your time and read via the article.


  • On your question about model switching, that was explained and pointed out here in Part 2 when we explained the very first program's input variables.

//--- Input parameters
input string OpenAI_Model = "gpt-3.5-turbo";                                 // OpenAI Model
input string OpenAI_Endpoint = "https://api.openai.com/v1/chat/completions"; // OpenAI API Endpoint

And we stated "...We begin the implementation of the program, focusing on the initial setup of input parameters to configure the program’s connection to OpenAI’s API. First, we define the input parameter "OpenAI_Model" as a string set to "gpt-3.5-turbo", specifying the ChatGPT model to use for API requests, allowing flexibility to switch models if needed. You can switch to your model here...."

Thanks.

Building AI-Powered Trading Systems in MQL5 (Part 4): Overcoming Multiline Input, Ensuring Chat Persistence, and Generating Signals
Building AI-Powered Trading Systems in MQL5 (Part 4): Overcoming Multiline Input, Ensuring Chat Persistence, and Generating Signals
  • 2025.10.09
  • www.mql5.com
In this article, we enhance the ChatGPT-integrated program in MQL5 overcoming multiline input limitations with improved text rendering, introducing a sidebar for navigating persistent chat storage using AES256 encryption and ZIP compression, and generating initial trade signals through chart data integration.
 
Alain Verleyen #:

Please stop "SHOUTING", don't write in uppercase.

Also watch your tone when communicating with other people.

Sorry 😔 I was very depressed, I lost so many money in Trading. But when I saw your program I was thought I can recover my losses and without reading article I was in hurry to use that. Sorry I am your big fan and always following you. 
Please forgive me as like younger brother. Please 🥺 reply to me 
Thanks with regards 
 
Avinash Chandra Agarwal #:
[W]hen I saw your program I was thought I can recover my losses and without reading article...
Alain is not the author, Allan.
 
Sorry 😔 I was very depressed, I lost so many money in Trading. But when I saw your program I was thought I can recover my losses and without reading article I was in hurry to use that. Sorry I am your big fan and always following you. 
Please forgive me as like younger brother. Please 🥺 reply to me 
Thanks with regards 
 

**An Earnest Appeal to All**


With folded hands and a heart full of respect, I address each one of you.


I have read every article, from Part 2 all the way through Part 7. Sir Allan is truly an expert, and the work he has done is nothing short of incredible—the EA's performance, as shown, is absolutely astounding.


But I must confess, with a heavy heart, that I am not like him. Perhaps it is my lack of knowledge in coding or MQL5. I have tried so very hard, pouring my soul into every attempt, yet each time, I meet with failure. I simply do not know how to get this magnificent EA to work on my own system. The process described in Part 2—with a single file to copy, compile, and run—was clear. But now, with multiple files in these later parts, I am completely lost and overwhelmed.


With utmost humility, I make two small requests, if I may:


1.  Could Sir Allan kindly provide all the `.bmp` resource files in one place? I may have missed them, and having them together would be a great help for everyone.

2.  Would it be possible to have a simple guide—an `Instructions.txt`—that explains exactly where to save each file and image within MT5? This would be a blessing for people like me, who lack technical knowledge but are eager to learn.


I know I am asking for more, and I apologize if this seems like too much. But my eagerness comes from a place of deep need. I have lost significant capital in trading, and my hope is pinned on finding a system that works. This EA feels like that beacon of hope.


If I have made any mistake in my words, I beg your forgiveness. I implore you all, from the depths of my being, to show a little mercy to a struggling learner.


Thank you for your patience and kindness. I await your supportive guidance with hopeful anticipation.


**With sincere gratitude and respect,**  

*A fellow trader*