---
title: "How to Create an Expert Advisor or an Indicator - Algorithmic Trading, Trading Robots - MetaTrader 5 Help"
description: "The trading platform contains a built in programming language MetaQuotes Language 5 ( MQL5 ), the MetaEditor development... - How to Create an Expert Advisor or an Indicator - Algorithmic Trading, Trading Robots - MetaTrader 5 Help"
image: "https://www.metatrader5.com/i/logo_metatrader5.png"
url: "https://www.metatrader5.com/en/terminal/help/algotrading/autotrading"
---

[MetaTrader 5 Help](https://www.metatrader5.com/en/terminal/help) → [Algorithmic Trading, Trading Robots](https://www.metatrader5.com/en/terminal/help/algotrading) → How to Create an Expert Advisor or an Indicator

# How to Create an Expert Advisor or an Indicator

The trading platform contains a built in programming language MetaQuotes Language 5 ([MQL5](https://www.metatrader5.com/en/terminal/help/algotrading/autotrading#mql5)), the [MetaEditor](https://www.metatrader5.com/en/terminal/help/algotrading/autotrading#metaeditor) development environment and strategy testing tools.

> Any information about the development of trading strategies in MQL5 can be found on the official [MQL5.community](https://www.mql5.com/) site. The website section [Code Base](https://www.mql5.com/en/code) contains examples of ready-to-use applications.

## The MQL5 Programming Language of Trading Strategies [#](#mql5)

The trading platform has its own built-in language for programming trading strategies [MetaQuotes Language 5](https://www.mql5.com/). It is the fifth generation of MQL languages. It allows developing [Expert Advisors](https://www.metatrader5.com/en/terminal/help/algotrading/autotrading#type) to automate trading processes, as well as implementing your own trading strategies. MQL5 also allows creating [custom indicators](https://www.metatrader5.com/en/terminal/help/algotrading/autotrading#type), [scripts](https://www.metatrader5.com/en/terminal/help/algotrading/autotrading#type) and function libraries.

MQL5 Features:

- The language is object-oriented;
- MQL5 syntax is similar to that of C++;
- It contains a large number of functions necessary for analyzing quotes, managing positions, calling technical indicators, etc.;
- It is a high-performance language;
- High protection against decompilation: new complex encryption algorithms, file integrity checking, and the complexity of the language;
- [OpenCL](https://www.mql5.com/en/articles/405) support to enable use of video cards for calculations in MQL5 applications;
- Integrated software development environment [MetaEditor](https://www.metatrader5.com/en/terminal/help/algotrading/autotrading#metaeditor) including a debugger.

A detailed description of all language constructions and functions is provided in the MQL5 Reference. All the necessary information about MQL5 can also be found on the developer community website at [https://www.mql5.com](https://www.mql5.com/).

## MetaEditor [#](#metaeditor)

MetaEditor is an integrated [MQL5](https://www.mql5.com/) development environment. It is a component of the trading platform. MetaEditor allows you to create, edit, compile and debug source code written in [MQL5](https://www.metatrader5.com/en/terminal/help/algotrading/autotrading#mql5).

- MQL5 Wizard for creating templates and trading robotsMetaEditor includes the MQL5 Wizard that helps to quickly create MQL5 programs. With the MQL5 Wizard a trader without programming skills can easily create Expert Advisors. You only need to select trading signals for an Expert Advisor, as well as money management and trailing stop algorithms. The Expert Advisor code is generated automatically based on selected parameters.In addition, the MQL5 Wizard allows creating MQL5 program templates to simplify the work of a programmer.
- Helps with the source codeMetaEditor can recognize language structures: suggests tips on how to use functions and highlights various elements of the program source code. Thus, the editor enhances navigation in the source code of trading programs and speeds up the development process.
- DebuggingMetaEditor allows you to debug programs to greatly facilitate troubleshooting. A step-by-step execution of a source code enables monitoring of the variable values.
- Profiling for code optimizationThe editor also provides tools for software profiling. You can identify the slowest functions in the source code and optimize your program.
- Articles about programming and a source code libraryStraight from the editor, you can find a plethora of MQL5 programming tutorials. You can additionally access a huge code base of free automated trading programs.

More details about MetaEditor can be found in its built-in help files. The description of MQL5 can be found in the built-in reference and the official [MQL5.community](https://www.mql5.com/) website.

## MQL5 Algo Forge [#](#algoforge)

[MQL5 Algo Forge](https://forge.mql5.io/)is an online code repository and social network for developers. The portal offers numerous advantages for creating trading applications:

- Secure cloud storage, with your files securely stored in the cloud with recovery options in case of computer failure.
- Access from any device, allowing you to manage and work with your code from any computer using your MQL5.community account.
- Git-based version control.
- Collaborative project work with a complete project history.
- Deep integration with MetaEditor — create projects, commit changes, and receive updates directly from the editor.

For more information, see the article "[Getting Started with MQL5 Algo Forge](https://www.mql5.com/en/articles/18518)" and the MetaEditor Help documentation.

## Algo Trading Books [#](#algobook)

To assist beginners, we have released two comprehensive books on MQL5 programming, designed for anyone who wish to master the creation of trading robots and applications for algorithmic trading. The books offer a systematic and structured presentation of the material to make the learning process easier. Detailed code examples, which explain the step-by-step creation of trading robots and applications, allow for a deeper understanding of algorithmic trading nuances.

"[MQL5 Programming for Traders](https://www.mql5.com/en/book)" is the most complete and detailed tutorial on MQL5, suitable for programmers of all levels. Beginners will learn the basics: the book introduces development tools and basic programming concepts. Based on this material, you will create, compile and run your first application in the MetaTrader 5 trading platform. Users with experience in other programming languages can directly proceed to the applied sections: creating trading robots and analytical applications in MQL5.

"[Neural Networks in Algorithmic Trading with MQL5](https://www.mql5.com/en/neurobook)" is a guide to using machine learning methods in trading robots for the MetaTrader 5 platform. You will be progressively introduced to the fundamentals of neural networks and their application in algorithmic trading. As you advance, you will build and train your own AI solution, gradually adding new features. In addition to learning MQL5, you will gain Python and OpenCL programming skills and explore integrated matrix and vector methods, which enable the solution of complex mathematical problems with concise and efficient code.

## Articles on the development of trading applications [#](#articles)

[MQL5.community](https://www.mql5.com/) website features an extensive library [of articles on MQL4/MQL5 programming](https://www.mql5.com/en/articles). Articles are an excellent guide for creating applications, since they cover a lot of practical tasks involving algorithmic trading. New articles are published every week.

List of all available articles is displayed directly in MetaEditor. To find the necessary material, use the [online search](https://www.metatrader5.com/en/terminal/help/startworking/interface#search).

![Articles on MQL4/MQL5 programming](https://www.metatrader5.com/i/help/terminal/en/articles.png)

## Types of MQL5 Applications [#](#type)

Three major types of trading applications are available.

### Expert Advisors

Expert Advisors are mechanical trading systems that allow complete automation of analytical and trading activities for the efficient operation in the financial markets. They allow to perform prompt technical analysis of price data and control trading activities on the basis of signals received. They also help to strictly follow a trading strategy eliminating emotions.

All Expert Advisors are stored in the [/MQL5/Experts](https://www.metatrader5.com/en/terminal/help/start_advanced/structure#ea) folder of the trading platform.

### Custom Indicators

Custom Indicators are custom developed technical indicators intended for analyzing price dynamics. Trading tactics and Expert Advisors are developed based on algorithms of indicators. Custom indicators are only used for analyzing symbol price dynamics. Indicators cannot trade and do not have access to charts.

All indicators are stored in the [/MQL5/Indicators](https://www.metatrader5.com/en/terminal/help/start_advanced/structure#indicators) folder of the trading platform.

### Scripts

A script is an application written in [MQL5](https://www.metatrader5.com/en/terminal/help/algotrading/autotrading#mql5) designed for a single execution of an action. A script can perform both analytical and trading functions. Unlike [Advisors](https://www.metatrader5.com/en/terminal/help/algotrading/autotrading#type), scripts are executed on request. In other words, if an Expert Advisor works almost continuously, a script executes its function and quits.

All scripts are stored in the [/MQL5/Scripts](https://www.metatrader5.com/en/terminal/help/start_advanced/structure#scripts) folder of the trading platform.

### Services

[Services](https://www.metatrader5.com/en/terminal/help/algotrading/trade_robots_indicators#service) enable the use of custom price feeds for the platform and to implement price delivery from external systems in real time, just like it is implemented on brokers' trade servers. Services can also be used to perform other service tasks in the background.

Unlike Expert Advisors, indicators and scripts, services are not linked to a specific chart. Such applications run in the background and are launched automatically when the terminal is started (unless such an app was forcibly stopped).

All services are stored under the [/MQL5/Services](https://www.metatrader5.com/en/terminal/help/start_advanced/structure#scripts) folder of the trading platform.

> Inside folders Experts, Indicators, Scripts and Services, applications can be sorted into subfolders. The structure of their location is displayed in the [Navigator](https://www.metatrader5.com/en/terminal/help/startworking/interface) window.

## How to Create and Run a Trading Application [#](#create)

Click "![Create in MetaEditor](https://www.metatrader5.com/i/help/terminal/en/create_icon.png) Create in MetaEditor" in the context menu of the [Navigator](https://www.metatrader5.com/en/terminal/help/startworking/interface) window in section Expert Advisors, Indicators or Scripts. MetaEditor can also be launched by pressing F4.

![Start creating a trading application](https://www.metatrader5.com/i/help/terminal/en/ea_create.png)

This launches [MetaEditor](https://www.metatrader5.com/en/terminal/help/algotrading/autotrading#metaeditor) with an automatically opened MQL5 Wizard. Use it to generate the necessary program template to quickly start software development. Let's create a simple script writing a message "Hello world" into the [journal](https://www.metatrader5.com/en/terminal/help/start_advanced/journal).

![The MQL5 Wizard generates a template of the application](https://www.metatrader5.com/i/help/terminal/en/example_wizard_script.png)

In the resulting template, we add the code Print("Hello World"); and compile it by pressing F7 to receive an executable file. The executable file has an extension EX5 and can be run in the trading platform.

![Compiling and its results](https://www.metatrader5.com/i/help/terminal/en/example_compile.png)

Compilation results are added to the editor log.

In accordance with the application type, the source code is saved to the folder MQL5\Scripts\. The executable file is created in the same folder. You can now return to the trading platform and run the generated script.

![Running a script in the trading platform](https://www.metatrader5.com/i/help/terminal/en/example_run_script.png)

> Specifics of use of automated trading programs are described in section ["Expert Advisors and custom indicators"](https://www.metatrader5.com/en/terminal/help/algotrading/trade_robots_indicators).

## How to Edit a Trading Application [#](#modify)

To edit a trading robot or a custom indicator, click "![Modify](https://www.metatrader5.com/i/help/terminal/en/modify_icon.png) Modify" in its context menu in the [Navigator](https://www.metatrader5.com/en/terminal/help/startworking/interface) window or select it and press Enter. This opens [MetaEditor](https://www.metatrader5.com/en/terminal/help/algotrading/autotrading#metaeditor) with the source code of the selected indicator. After you have modified the indicator, re-compile it (F7). Otherwise its previous unchanged version will be used in the platform.

## How to Shut Down a Trading Application [#](#quit)

There are many ways to shut down a trading application in the platform.

| Trading robot | Custom technical indicator | Script |
| --- | --- | --- |
| - Click "Remove" in the [Expert List](https://www.metatrader5.com/en/terminal/help/charts_advanced/charts_objects_list#ea) window;<br>- Change the chart [template](https://www.metatrader5.com/en/terminal/help/charts_advanced/templates_profiles);<br>- Change the [profile](https://www.metatrader5.com/en/terminal/help/charts_advanced/templates_profiles#profiles), provided that the [appropriate option is enabled in the platform settings](https://www.metatrader5.com/en/terminal/help/startworking/settings#profile);<br>- Turn off the trading platform;<br>- Close the chart the Expert Advisor is running on;<br>- Run another Expert Advisor on the same chart;<br>- Click "![Remove Expert Advisor](https://www.metatrader5.com/i/help/terminal/en/ea_remove_icon.png) Remove" in the context menu of the Expert Advisor icon on the chart. | - Click "![Remove indicator](https://www.metatrader5.com/i/help/terminal/en/delete_indicator_icon.png) Delete" or "![Delete indicator window](https://www.metatrader5.com/i/help/terminal/en/delete_indicator_window.png) Delete Indicator Window" in the context menu of the indicator;<br>- Click "Delete" in the [Indicator List](https://www.metatrader5.com/en/terminal/help/charts_advanced/charts_objects_list#indicators) window;<br>- Change the chart [template](https://www.metatrader5.com/en/terminal/help/charts_advanced/templates_profiles);<br>- Re-open the chart. | - Click "Remove" in the [Expert List](https://www.metatrader5.com/en/terminal/help/charts_advanced/charts_objects_list#ea) window. This window also contains a list of running scripts;<br>- Change the chart [template](https://www.metatrader5.com/en/terminal/help/charts_advanced/templates_profiles);<br>- Change the [profile](https://www.metatrader5.com/en/terminal/help/charts_advanced/templates_profiles#profiles), provided that the [appropriate option is enabled in the platform settings](https://www.metatrader5.com/en/terminal/help/startworking/settings#profile);<br>- Change the [chart](https://www.metatrader5.com/en/terminal/help/charts_analysis/charts) symbol;<br>- Change the chart [timeframe](https://www.metatrader5.com/en/terminal/help/charts_analysis/charts#operations);<br>- Turn off the trading platform;<br>- Close the chart the script is running on;<br>- Run another script on the same chart;<br>- Click "![Remove Script](https://www.metatrader5.com/i/help/terminal/en/script_remove_icon.png) Remove" in the context menu of the script icon on the chart. |

> If a trading application is running on a chart, it will not be shut down if you delete the appropriate executable file from the [Navigator](https://www.metatrader5.com/en/terminal/help/startworking/interface) window.Disabling Expert Advisors [in the trading platform settings](https://www.metatrader5.com/en/terminal/help/startworking/settings#enable_ea) does not disable them completely. This operation only prohibits Expert Advisors from trading.

## How to Run a Downloaded File of the MQ5 Source Code [#](#mq5)

If you only have a source code file (*.MQ5), save it in a folder corresponding to the application type:

- For Expert Advisors — /MQL5/Experts
- For indicators — /MQL5/Indicators
- For scripts —/MQL5/Scripts

To quickly navigate to the trading platform data folder, click "![Open data folder](https://www.metatrader5.com/i/help/terminal/en/terminal_data_icon.png) Open data folder" in the [File](https://www.metatrader5.com/en/terminal/help/startworking/interface) menu.

To run a file in the trading platform, compile it in the [MetaEditor](https://www.metatrader5.com/en/terminal/help/algotrading/autotrading#metaeditor):

- Open MetaEditor by pressing F4.
- In MetaEditor, open the source code file in the Navigator window by a double left-click on the file name.
- Press F7 to compile it.

This creates an executable *.EX5 file that can be run in the trading platform.

> Source files (*.MQ5) are not displayed in the [Navigator](https://www.metatrader5.com/en/terminal/help/startworking/interface) window of the trading platform.

## In this section

- [Expert Advisors and Custom Indicators](https://www.metatrader5.com/en/terminal/help/algotrading/trade_robots_indicators)
- [Where to Find Trading Robots and Indicators](https://www.metatrader5.com/en/terminal/help/algotrading/algotrading_get_ea_indicator)
- How to Create an Expert Advisor or an Indicator
- [Strategy Testing](https://www.metatrader5.com/en/terminal/help/algotrading/testing)
- [How the Tester Downloads Historical Data](https://www.metatrader5.com/en/terminal/help/algotrading/test_preparation)
- [Strategy Optimization](https://www.metatrader5.com/en/terminal/help/algotrading/strategy_optimization)
- [Testing Features](https://www.metatrader5.com/en/terminal/help/algotrading/testing_features)
- [Testing Report](https://www.metatrader5.com/en/terminal/help/algotrading/testing_report)
- [Testing Visualization](https://www.metatrader5.com/en/terminal/help/algotrading/visualization)
- [Journal of Testing](https://www.metatrader5.com/en/terminal/help/algotrading/tester_journal)
- [Optimization Types](https://www.metatrader5.com/en/terminal/help/algotrading/optimization_types)
- [Real and Generated Ticks](https://www.metatrader5.com/en/terminal/help/algotrading/tick_generation)
- [MetaTester and Remote Agents](https://www.metatrader5.com/en/terminal/help/algotrading/metatester)
- [Global Variables](https://www.metatrader5.com/en/terminal/help/algotrading/service_global)

```json
{"@context": "https://schema.org", "@type": "BreadcrumbList", "itemListElement": [ {"@type": "ListItem", "position": 1, "item": {"@id": "https://www.metatrader5.com/en/terminal/help", "name": "MetaTrader 5 Help"}}, {"@type": "ListItem", "position": 2, "item": {"@id": "https://www.metatrader5.com/en/terminal/help/algotrading", "name": "Algorithmic Trading, Trading Robots"}}, {"@type": "ListItem", "position": 3, "item": {"@id": "https://www.metatrader5.com/en/terminal/help/algotrading/autotrading", "name": "How to Create an Expert Advisor or an Indicator"}} ]}
{ "@context": "https://schema.org", "@type": "FAQPage", "mainEntity": [{ "@type": "Question", "name": "MetaTrader 5: How to Create an Expert Advisor or an Indicator", "acceptedAnswer": { "@type": "Answer", "text": "The trading platform contains a built in programming language MetaQuotes Language 5 ( MQL5 ), the MetaEditor development environment and strategy..." } }] }
```
