How to Start with Metatrader 5 - page 148

 

Forum on trading, automated trading systems and testing trading strategies

Buying or Selling all 7 pairs

Sergey Golubev, 2026.04.08 16:21

Developing a Multi-Currency Expert Advisor (Part 26): Informer for Trading Instruments

Developing a Multi-Currency Expert Advisor (Part 26): Informer for Trading Instruments

For almost the entire series, we worked with only one simple trading strategy, and only in the last parts, when the main features had already been implemented, we started considering adding a new trading strategy and using it as the main one. This example demonstrated the possibility of trying to unlock the potential of almost any trading strategy (if that potential really exists, of course).


 

Publish Your Article Code to MQL5 Algo Forge in 10 Minutes: A Step-by-Step Guide

Publish Your Article Code to MQL5 Algo Forge in 10 Minutes: A Step-by-Step Guide

Is your article already published in MQL5? Then take the next step: turn the code from the article into a full-fledged project in MQL5 Algo Forge. Do not leave the source files only in an archive. Move them to the repository so that readers see the current version of the project, a clear file structure, a change history, and a clear description. Algo Forge is based on Git, but the main Git actions are already built into the MetaEditor interface, and README.md becomes the face of the project.
 

Forum on trading, automated trading systems and testing trading strategies

Multi instrument robot

Sergey Golubev, 2026.06.08 14:52

Developing a Multi-Currency Expert Advisor (Part 28): Adding a Position Closing Manager

Developing a Multi-Currency Expert Advisor (Part 28): Adding a Position Closing Manager

In Part 12, we added a risk manager module to the multi-currency EA to limit daily and overall drawdown. It does not increase profits, but is critical to protecting funds in adverse conditions. It is based on prop trading rules with flexible settings: drawdown in currency, as a percentage of the balance, or from the start of the day.

The module is implemented as the CVirtualRiskManager class with methods for tracking balance, profit, and checking limitations. A profit-locking function is also provided: once the target is reached, all positions are closed and trading stops.

 

Forum on trading, automated trading systems and testing trading strategies

MetaTrader 5 Beta Build 5955: MCP and Agentic AI support

MetaQuotes, 2026.06.26 15:44

We're introducing a new beta version of MetaTrader 5 with built-in support for the Model Context Protocol (MCP) and agentic AI. These new capabilities are now available in both the client terminal and MetaEditor, and we invite all users to participate in the public beta.


How to Get the New Version

To update to the AI-enabled beta, connect to the MetaQuotes-Demo server: use an existing demo account or create a new one. If the server is not listed in your platform, enter access.metatrader5.com in the account opening dialog and click 'Find your company'.

Open a demo account on the MetaQuotes-Demo server to get the AI-enabled beta


What Is MCP?

The Model Context Protocol (MCP) is an open standard that enables applications to communicate with AI agents. Unlike traditional chatbots, AI agents can independently complete complex tasks by breaking them down into a sequence of actions and using the capabilities of connected applications.

With built-in MCP support, MetaTrader 5 becomes a fully featured source of market data and trading functionality for modern AI agents. They can access market information, analyze charts, work with the trading environment, and perform required operations through the standard MCP interface.

In addition to the built-in AI assistant, you can also connect external systems that support MCP, including OpenAI Codex, Claude Code, and other compatible solutions.


No Configuration Required

To start using AI features, simply sign in to your MQL5.community account. After updating, the platform automatically configures everything you need: MQL5.community is selected as the default AI provider, and the required API key is added automatically.

If you prefer, you can use your own API keys for OpenAI, Anthropic, Gemini, DeepSeek, Ollama, or other supported providers, and select your preferred model directly in the terminal settings.

AI Settings

Your AI settings are automatically synchronized between the trading terminal and MetaEditor.


AI Assistant in MetaTrader 5

The built-in AI Assistant helps you analyze markets. It can explain current market conditions for a symbol, review your open positions, analyze your trading history, answer questions about financial instruments, and provide context on recent market events.

Ask AI to analyze your trading

Example prompts:

  • Analyze the current EURUSD situation on the H1 timeframe. Identify the trend, the nearest support and resistance levels, and explain what's happening in the market.
  • Analyze my open positions. Which trades currently carry the highest risk, and why?
  • Analyze my trading history for the last three months. Identify my most profitable trades and suggest ways to improve my trading strategy.
  • Scan all symbols in Market Watch and identify those where an important level breakout or a strong trend is currently developing.

Important: AI-generated responses are provided for informational purposes only and do not constitute investment advice. Use them as an additional analytical tool and always make trading decisions based on your own judgment.


AI Assistant in MetaEditor

The AI Assistant in MetaEditor is now a full-featured development assistant. It can:

  • Generate new MQL5 programs
  • Analyze existing code
  • Detect errors and suggest fixes
  • Explain complex algorithms
  • Explain complex algorithms

Launch the assistant from the File menu, the toolbar, or the Navigator context menu. Then simply describe your task in natural language.

Ask AI to write a script for you

Example prompts:

  • Create an Expert Advisor that opens a position when the EMA 20 crosses the EMA 50, uses a 500-point Stop Loss, a 1000-point Take Profit, and risks 1% of the account deposit.
  • Analyze this MQL5 code, identify potential issues, explain their causes, and provide a corrected version.
  • Optimize this indicator to reduce calculations and improve performance without changing its logic.
  • Convert this MQL4 Expert Advisor to MQL5 using modern language features and the Standard Library.
  • Explain how this Expert Advisor works. Describe its trading logic, the indicators it uses, its entry and exit conditions, and any potential weaknesses in the strategy.

The more detailed your request, the more accurate and useful the generated results will be.

Your conversation history is available in the Chats tab of the Navigator.


Join the Beta Testing

The integration of MCP and agentic AI introduces an entirely new way to interact with the trading platform. We will continue to expand these capabilities and invite traders and MQL5 developers to help us test them.

Try the new features, share your feedback, and help us make AI-powered tools in MetaTrader 5 even more capable, intuitive, and effective.


 

This is very interesting:

No Configuration Required

To start using AI features, simply sign in to your MQL5.community account. After updating, the platform automatically configures everything you need: MQL5.community is selected as the default AI provider, and the required API key is added automatically.

 

Forum on trading, automated trading systems and testing trading strategies

MetaEditor, Open AI and ChatGPT

Sergey Golubev, 2026.07.01 15:31

Code, Tears, and Algo Forge

Code, Tears, and Algo Forge

Switching to Algo Forge isn't just a change in how you store files; it's a new standard for professional activities. We're moving away from static ZIP archives and lengthy republishing cycles to living, relevant projects that are under your complete control, right here and now.

For you, as an author, this means, first and foremost, saving time and keeping things in order. There's no longer any need to search for old archives on the drive or explain to readers repeatedly how to manually assemble a project. Now your work lives in the cloud, and any correction can be added to the repository instantly—with a single command from MetaEditor. No unnecessary emails, no waiting for moderation, and no edits to the text of the article itself.

Incorporating such tools into your practice isn't just about following trends, but a way to make your article production more predictable and high-quality. Ultimately, when an author chooses a modern approach to code presentation, it inevitably raises the bar for quality content throughout the entire resource. This is a case where technology helps us focus on what matters most, turning each article into a fully-fledged and long-lasting working tool for the entire community.


 

Forum on trading, automated trading systems and testing trading strategies

Divergence Indicators

Sergey Golubev, 2026.07.10 14:53

Building a Divergence System (Part II): Adaptive SuperTrend Custom Indicator

Building a Divergence System (Part II): Adaptive SuperTrend Custom Indicator

In the previous article, we introduced MPO4, a pressure-based oscillator that measures the directional effort behind price movements by weighting candlestick bodies against recent volatility. Combined with a non-repainting pivot-detection engine, it enabled us to identify bullish and bearish divergences, revealing moments when underlying buying or selling pressure begins to weaken before a potential market reversal.

This presents a mechanical challenge for systematic traders: once a divergence warns us that a trend is dying, how should we mechanically adjust our trade management to capitalize on it?


 

Analyzing the Hourly Movement of Trading Symbols and Their Spreads in MetaTrader 5

Analyzing the Hourly Movement of Trading Symbols and Their Spreads in MetaTrader 5

We will look at a powerful tool for analyzing intraday patterns - the ISI ProSpread SMA indicator, where:

  • ISI — Index Seasonality Indicator (seasonality indicator),
  • Spread — spread (working with a pair of instruments),
  • SMA — Simple Moving Average.

Here we will examine not only the ways to use the indicator, but also the mathematical theory that anticipates market movements. Let's talk about how probability theory and mathematical statistics help us understand and calculate recurring market patterns.

Analyzing the Hourly Movement of Trading Symbols and Their Spreads in MetaTrader 5
Analyzing the Hourly Movement of Trading Symbols and Their Spreads in MetaTrader 5
  • 2026.07.14
  • www.mql5.com
The ProSpread seasonality index indicator with a Moving Average is a technical analysis tool that identifies seasonal patterns in price movements, analyzes price behavior during specific trading hours and is able to work with either a single instrument or a spread between two assets. It also visualizes the statistical probability of directional movements.
 

How To Profile MQL5 Code in MetaEditor

How To Profile MQL5 Code in MetaEditor

This article is a practical walk-through of the profiler. To keep the focus on the tool, I use a small, familiar indicator as the patient: a rolling z-score with bands. I write it the obvious way first, then put it under the profiler three times, fixing whatever each report points at. By the end the same indicator produces the same output for a fraction of the work.

The goal is not this indicator but the profiling workflow: launching the profiler, interpreting its two key metrics per function, using the heat map to find the exact line, and knowing when to stop. Once you can read a profile, you can point the tool at your own indicators, libraries, and EAs.

How To Profile MQL5 Code in MetaEditor
How To Profile MQL5 Code in MetaEditor
  • 2026.07.21
  • www.mql5.com
This article profiles a rolling z-score indicator with bands using MetaEditor's built-in sampling profiler. We read the Total CPU and Self CPU columns and follow the heat‑mapped source to the true hotspots, replace window rescans with sliding accumulators, remove a redundant array copy, and honor prev_calculated. The result is the same output with measured samples reduced from roughly 7,050 to 59.
 

Developing a Terminal Manager (Part 1): Problem Statement

Developing a Terminal Manager (Part 1): Problem Statement

If we want to use a single Expert Advisor on our trading account, it is no problem — we just launch the terminal, set it up, and wait for the results. Let's imagine a situation where trading is going well and we want to try adding one or more Expert Advisors. If they can work without getting in each other's way, that is fine. If not, you will need to run separate terminal instances for them. Separate instances will also be needed if you want to trade on different accounts.

This is where organizational and technical challenges gradually begin to arise. How can you make your life easier by conveniently managing and monitoring multiple terminals on which Expert Advisors are running? Furthermore, the terminals can be physically located on different computers (servers). What can we do to address this?

Developing a Terminal Manager (Part 1): Problem Statement
Developing a Terminal Manager (Part 1): Problem Statement
  • 2026.08.05
  • www.mql5.com
How can we conveniently monitor multiple terminals running Expert Advisors, especially when they are on different computers? Let's try to create a web interface for managing the launch of MetaTrader 5 trading terminals and viewing detailed information about the operation of each instance.