Video summary
Can ChatGPT Build a Profitable Scalping EA?
Main summary
Key takeaways
Summary
René demonstrates a repeatable, four-part prompting method for using an AI chatbot to create an Expert Advisor (EA) in MetaTrader 5. He uses ChatGPT to generate a scalping breakout EA, then reviews the code and tests it in MT5’s Strategy Tester. The method can be adapted to other EA projects and other coding-capable chatbots.
The video shows the EA compiling and taking trades in a historical visual test, but does not establish that it is profitable. René notes that the settings and strategy logic need further experimentation, and that live results may differ from demo or historical results.
Four-Part Prompt Method
1. Define the AI’s role and language
- Ask it to act as a professional algorithmic trader and senior MQL5 developer.
- Require it to write exclusively in MQL5 and avoid outdated MQL4 functions.
2. Provide general EA requirements
- Request efficient code without unnecessary repetition or calculations.
- Require the EA to save and restore its state after an MT5 restart.
- Make it compatible with other EAs running on the account.
- Give it a configurable, unique magic number, and ensure it only manages trades associated with that number.
- Specify that it should work with any symbol.
René says he reuses this general-purpose block across EA projects.
3. Describe the strategy and features
Specify the intended trading logic precisely. René’s example is a scalping breakout EA that should:
- Make the timeframe configurable.
- Find the most recent confirmed swing high and swing low, using a configurable number of bars on either side to validate each swing.
- Open a buy when price breaks above the latest swing high and a sell when it breaks below the latest swing low.
- Allow each breakout level to trigger only one trade.
- Set stop-loss and take-profit distances as percentages of the entry price.
- Calculate position size automatically, using either monetary risk or a percentage-based risk setting.
- Offer independently configurable trailing-stop options, which can also be combined:
- Classic trailing stop with activation, distance, and step percentages.
- Moving-average-based trailing stop with configurable period, type, and timeframe.
- Break-even stop activated at a specified profit percentage.
- Ensure stops are adjusted only in the direction of the trade.
René emphasizes that clearer, more specific descriptions reduce the chance that the AI will make assumptions.
4. Ask for clarification before requesting code
Before generating the full source, ask the AI whether it has questions or needs missing details clarified. Answer its questions directly; these may concern details such as how far back to search for a confirmed swing. Once the requirements are clear, ask it to produce the full .mq5 source code.
Code Review and Testing Process
- Copy the generated code into MetaEditor, create a new EA file, and compile it.
- Review the inputs and implementation rather than treating generated code as automatically correct. René checks items such as input validation, trade setup, swing detection, spread filtering, position management, helper functions, and trailing-stop logic.
- Adjust input values as needed—for example, the number of bars used to confirm swings, stop-loss and take-profit percentages, risk, or trailing-stop behavior.
- Open MT5’s Strategy Tester, choose the EA and symbol, configure the timeframe and inputs, enable visual mode, and run a historical test.
- Observe whether trades match the intended rules and whether features such as trailing stops behave as expected.
- Refine the logic or settings through further tests.
René notes that multiple positions can be consistent with the specified rules, even if they are triggered by different swing levels. Treat historical testing as an initial check, not proof of profitability; conduct further testing and assess live-account behavior separately.
Speakers and Sources Featured
- René Balke — narrator and EA-building demonstrator.
- ChatGPT — the AI coding assistant used to generate the EA.
- Claude and Gemini — mentioned as alternative coding chatbots, not used for this demonstration.
- MetaTrader 5, MetaEditor, and Strategy Tester — software tools shown for compiling and testing the EA.
Rate this summary
Your feedback will help improve summaries.
Improve this summary
Reprocess with a stronger model when the summary feels incomplete or inaccurate.
Translate summary in another language
Ask questions to this video
Chat for follow-up questions, clarifications, and source-backed answers.