Artificial intelligence is still in its early days, and many bugs should be resolved.
but, One area I found that was very useful is the area that creates automated trading robots for trading platforms like Metatrader 4.
Therefore, in this tutorial we will show you how to create a custom MT4 EAS using CHATGPT. This process is very fast, and easily, I don’t even know how to code.
If you prefer the text version, it is provided under the video.
Tutorial Video
https://www.youtube.com/watch?v=dx_avbmkgwy
How to create an EA with chatgpt
All of these steps must be performed in your demo account.
Don’t use EA with real money. Until you’re sure it’s working properly.
Step 1: There’s a trading strategy
You can get trading strategies from almost anywhere… a book, a website, a YouTube or something you just created.
Ideally, you’ll need a trading strategy that you’ve already backtested.
However, if you just want to run the process and see how it works, use the sample code in the section below.
Step 2: Explain to chatgpt
Ask them to create an EA for MT4.
Next, explain the rules as clearly as possible. Write it as if you were writing a letter to a friend.
The code needed for MT4 is generated.
Copy this code from Chatgpt
Step 3: Copy and paste the code into MT4
Next, open Metaquotes Language Editor Go through the toolbar at the top.
Click new The button to create a new EA.
Select Expert Advisorgive it a name, then leave the remaining settings blank. Continue to hit Next Button until you reach the end of the wizard.
It gives you a blank EA template.
Click anywhere in the code to use it Control + a Select all text. Then it hits Back space To remove all default codes, Control + v Paste it into the ChatGPT code using the keyboard.
Click compile A button to generate EA.
Step 4: Check for the error
If there are any errors or warnings in your code, ask them to go back and fix ChatGpt.
A new code is generated.
Repeat step 3 above to start using the new code.
Step 5: Add EA to the chart and start testing
Once all the errors and warnings are gone, you’re ready to use the EA.
Go to the main MT4 screen and Navigator window.
Click and drag the new EA onto the chart.
In the top right corner of the chart you added, you should have the name of your EA next to your happy face.
If your face is sad, click Auto Trading Use the buttons at the top to activate the EA. A happy face indicates that the EA is activated.
Test your EA to see if it works properly.
Test all your normal features and try to “break” the EA by doing something unexpected. This shows how robust it is and gives you confidence in it.
If you have any issues, go back to ChatGpt and work on fixing them.
This may take several attempts, but keep it.
Example code
If you want to try this, here is an example code: Copy and paste this prompt chatgpt And it generates code for this EA.
important: This is for Educational purposes only and Do not use for live trading. This is provided only to help you understand how the creation process works. There is Very high probability This strategy means losing money.
“Create an expert Metatrader 4 advisor who will implement these rules.
-
Indicator
-
Long entry
-
Condition: Short SMA (2) > Long SMA (36)
-
Price closes Below Short SMA
-
action: Open A buy At the end of that bar
-
-
Long exit
-
Short entry
-
Condition: Short SMA (2)
-
Price closes On top of that Short SMA
-
action: Open A sell At the end of that bar
-
-
Short exit
-
Sizing and setting the position
-
Fixed size: 0.1 lot Trade
-
Is there no stop? Losses, no take?
-
Words of warning
Remember that this is just step one in the process of creating a fully or partially automated trading strategy.
If you backtested with AI, you will need to double check the results.
Even if you don’t, you need to make sure your code is doing what you expected.
AI can cause hallucinations, so you need to make sure that the EA is doing what you expected before putting your actual money in danger.
Don’t trade EA live until you’re absolutely certain you’re functioning EA properly.
Final Tips
We hope this tutorial will help you create your own tools to improve your trading results.
At the time this is written, reverse testing in AI is not yet mature.
However, creating an EAS for MT4 is very easy to use, so I highly recommend learning how to do it.
Even if you’ve never built an EA, you can also build a very useful custom indicator that will help you find trading opportunities and manage some of your transactions.
enjoy!