제품을 구매하거나 렌트한 사용자만 코멘트를 남길 수 있습니다
mftrader  
how to enter details for AI module?
Abdurahim Aras  
mftrader #:
how to enter details for AI module?

🤖 How to Use AI Models in MetaTrader 5

(Example: OpenAI GPT Model Integration)

Follow the steps below to receive trading signals using AI models like OpenAI and execute trades automatically in MetaTrader 5.


1. Allow WebRequest Access

MetaTrader requires permission to communicate with external servers using WebRequest .

🔧 Steps:

  1. In MetaTrader, go to Tools > Options > Expert Advisors

  2. In the “Allow WebRequest for listed URL” box, add the following URLs:

  1. Make sure the checkbox “Allow WebRequest” is enabled

  2. Click OK

❗ Without this step, the AI connection will not work.



2. Configure EA Parameters

Parameter Description
Auto AI Trade true : Automatically receive and execute AI signals
false : Use manual button only
Select AI Choose OpenAI
Enter Your API Key Paste your OpenAI API key here (e.g., starts with sk-... )
Enter AI Model Name e.g., gpt-3.5-turbo or gpt-4
Enter Url Address API endpoint: https://api.openai.com/v1/chat/completions
OpenRouter with site URL (optional) Leave blank unless using OpenRouter
OpenRouter with site Name (optional) Also for OpenRouter only
Refresh (Minute) Auto-check frequency, e.g., 60 = every 60 minutes



🎯 Example Setup for OpenAI

Field Example Value
Auto AI Trade true
Select AI OpenAI
Enter Your API Key sk-xxxxxxxxxxxxxxxxxx
Enter AI Model Name gpt-3.5-turbo
Enter Url Address https://api.openai.com/v1/chat/completions
Refresh (Minute) 60

🖱️ Manual Signal Button: "Get Signal from AI"

  • Click the "Get Signal from AI" button on the chart to send a one-time signal request.

  • The response will be printed in the terminal and optionally executed depending on your strategy.


🔁 Automatic Mode (Auto AI Trade = true)

  • The EA will automatically send a signal request every X minutes (based on the “Refresh (Minute)” value).

  • If the AI provides a valid signal ( BUY or SELL ), the system will open a trade with the following logic:

mql5

lotSize = AccountEquity * 0.005 / 100;

TakeProfit, StopLoss and order type will be based on AI output.

MarinelDarabana  
2025.05.30 11:51:14.032 Aras EA (NDX100,M5) ERROR: WebRequest failed [Attempt 3/3] for URL: https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash:generateContent?key=1234
2025.05.30 11:51:14.032 Aras EA (NDX100,M5) ERROR: Error Code: 5039 | Description: unknown error

is there a way to trace the communication between EA and google? to see the error messages and/or the request that was sent?

I have in the allow web links:
https://generativelanguage.googleapis.com/
https://api.openai.com/v1/completions

https://api.openai.com

Abdurahim Aras  
MarinelDarabana #:
2025.05.30 11:51:14.032 Aras EA (NDX100,M5) ERROR: WebRequest failed [Attempt 3/3] for URL: https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash:generateContent?key=1234
2025.05.30 11:51:14.032 Aras EA (NDX100,M5) ERROR: Error Code: 5039 | Description: unknown error

is there a way to trace the communication between EA and google? to see the error messages and/or the request that was sent?

I have in the allow web links:
https://generativelanguage.googleapis.com/
https://api.openai.com/v1/completions

https://api.openai.com

Hello, all bugs will be solved with the new update today; I will contact you.

Abdurahim Aras  
Peter Dietrich #:

Hello,

i 've the same problem with the webrequest url https://generativelanguage.googleapis.com/ - it does'nt work - what is the right way.. i find not the answer over google..

thanks a lot

best regards

peter

Hello, all bugs will be solved with the new update today; I will contact you.

Abdurahim Aras  
Alexandr Malanici #:
Error with all Ai

Please enable DLL permissions.

Peter Dietrich  
Abdurahim Aras #:

Hello, all bugs will be solved with the new update today; I will contact you.

Thank you, now I could enter the Google link!

Ranaweera Wanasinghe Herath Bandara  

Hey I enable everything in webrequest and DLL
changed to openAI
Add API address
turned auto AI
turned on atras EA

but keep getting 400 HTTP error msg

Abdurahim Aras  
RanaweeraBandra #:

Hey I enable everything in webrequest and DLL
changed to openAI
Add API address
turned auto AI
turned on atras EA

but keep getting 400 HTTP error msg

To use your API key, you must complete the payment to your service provider. Once the payment is made, the system should operate without any issues.

Even without AI integration, Aras EA can execute and manage trades independently, thanks to its built-in advanced trading strategies.

I am currently using DeepSeek and it's working flawlessly on my end. If you have completed the payment but are still experiencing issues, I will review the code again.

Abdurahim Aras  

You need to upload these files into the include file; 
JAson.mqh
Javal.mqh
stdlib_mq5.mqh


the include file is usually located at the following address:

C:\Users\ARAS\AppData\Roaming\MetaQuotes\Terminal\73B7A2420D6397DFF9014A20F1201F97\MQL5\Include

파일:
JAson.mqh  31 kb
stdlib_mq5.mqh  18 kb
Javal.mqh  6 kb
Franck Poncelet  
Hello, if anyone has managed to resolve the API request faild OpenAI HTTP Error 400 issue, I would appreciate some help!
제품을 구매하거나 렌트한 사용자만 코멘트를 남길 수 있습니다