---
title: "Creating an EA template - MQL4/MQL5 Wizard - MetaEditor Help"
description: "A template is a basic source code of a trading robot. It contains the standard program header, general properties and... - Creating an EA template - MQL4/MQL5 Wizard - MetaEditor Help"
image: "https://www.metatrader5.com/i/logo_metatrader5.png"
---

[MetaEditor Help](https://www.metatrader5.com/en/metaeditor/help) → [MQL4/MQL5 Wizard](https://www.metatrader5.com/en/metaeditor/help/mql5_wizard) → Creating an EA template

# Creating an EA template

A template is a basic source code of a trading robot. It contains the standard program header, general properties and workpieces for the main event handlers: new tick arrival (OnTick), launch (OnInit) and EA deinitialization (OnDeinit). A template is created in the directory corresponding to a program type – MQL5/Experts (or MQL4/Experts). When creating a template, you can define the program inputs beforehand, as well as add them to the workpiece code for additional event handlers.

![Creating an EA](https://www.metatrader5.com/i/help/metaeditor/en/wizard_ea.png)

Fill in the following fields:

- Name – EA name. The same name is assigned to an EA file. Here you can also change the path to a destination file. For example, create it in the new \Experts subfolders.
- Author – author name.
- Link – developer's email address or website.
- Parameters – set of EA input parameters (external variables).

The input parameters are "input" class variables. To create a parameter, click Add and fill in three fields:

- Name – input variable name.
- Type – input variable type.
- Initial value – initial value of a variable. It can be changed before a program launch or during operation.

After specifying all the necessary data, click Next.

## Event handlers [#](#events)

At subsequent stages, select additional [event handlers](https://www.mql5.com/en/docs/basis/function/events). The workpieces for them are to be inserted into the EA template:

- General handlers: events of a chart, a depth of market, new trades, etc.
- [Test event handlers](https://www.mql5.com/en/docs/basis/function/events) – managing optimization in real time.

To view an extended handler description, move the cursor over it.

![Select event handlers](https://www.metatrader5.com/i/help/metaeditor/en/wizard_ea_events.png)

| Selected handlers are added in addition to the main ones – OnInit, OnDeninit and OnTick. |
| --- |

Click Finish to complete template creation. A generated file is immediately opened for editing.

## In this section

- Creating an EA template
- [Creating a ready-made Expert Advisor](https://www.metatrader5.com/en/metaeditor/help/mql5_wizard/wizard_ea_generate)
- [Creating an indicator](https://www.metatrader5.com/en/metaeditor/help/mql5_wizard/wizard_indicator)
- [Creating a script](https://www.metatrader5.com/en/metaeditor/help/mql5_wizard/wizard_script)
- [Creating a library](https://www.metatrader5.com/en/metaeditor/help/mql5_wizard/wizard_library)
- [Creating an include file](https://www.metatrader5.com/en/metaeditor/help/mql5_wizard/wizard_include)
- [Creating a class](https://www.metatrader5.com/en/metaeditor/help/mql5_wizard/wizard_class)

```json
{"@context": "https://schema.org", "@type": "BreadcrumbList", "itemListElement": [ {"@type": "ListItem", "position": 1, "item": {"@id": "https://www.metatrader5.com/en/metaeditor/help", "name": "MetaEditor Help"}}, {"@type": "ListItem", "position": 2, "item": {"@id": "https://www.metatrader5.com/en/metaeditor/help/mql5_wizard", "name": "MQL4/MQL5 Wizard"}}, {"@type": "ListItem", "position": 3, "item": {"@id": "https://www.metatrader5.com/en/metaeditor/help/mql5_wizard/wizard_ea", "name": "Creating an EA template"}} ]}
{ "@context": "https://schema.org", "@type": "FAQPage", "mainEntity": [{ "@type": "Question", "name": "MetaTrader 5: Creating an EA template", "acceptedAnswer": { "@type": "Answer", "text": "A template is a basic source code of a trading robot. It contains the standard program header, general properties and workpieces for the main event..." } }] }
```
