Skip to content

Strategy Modules

Modules are the building blocks of your EA. Your signals decide when to open or close; the modules decide how: how many orders, with which stop loss and take profit, and when no new order may open at all.

In short:

  • Modules for opening open orders when an Open signal is met. Every EA has exactly one: Open order V3 (V2 in older EAs).
  • Modules for closing close orders: stop loss, take profit, trailing and lifespan. Add as many as you need.
  • Modules which prevent opening block new orders, for example outside a trading session or after a loss.
  • Most settings that several modules share are explained once, under Settings that many modules share.

On every tick, your EA goes through its modules:

  1. The modules which prevent opening check whether a new order is allowed right now.
  2. When an Open signal is met and no module prevents it, the module for opening opens the order.
  3. The modules for closing watch every open order and set or move its stop loss and take profit, or close it.

The full flow, with the order of all checks, is in How your EA works.

Modules live in the Strategy column of the EA editor, grouped like on this page.

Strategy column with Stop loss and Stop loss - Trailing, Open order V3 (Hedging disabled), Pip gap between orders and Add moduleStrategy column with Stop loss and Stop loss - Trailing, Open order V3 (Hedging disabled), Pip gap between orders and Add module
The Strategy column: two modules for closing, the module for opening and one module which prevents opening.
  1. Click Add module in the Strategy column.
  2. Click the module you want. Its settings open.
  3. Set the settings and click Save.
List of strategy modules under Modules for closing: Maximum lifespan, Stop loss, Stop loss - Catching up trail and moreList of strategy modules under Modules for closing: Maximum lifespan, Stop loss, Stop loss - Catching up trail and more
Add module: the modules you can add, grouped as Modules for closing, Modules for opening and Modules which prevent opening.
  • Change a module: click it in the Strategy column, change its settings and click Save.
  • Switch it off: the switch next to a module leaves it out of your EA without deleting it.
  • Remove it: open it and click Delete. The module for opening can’t be removed.
  • Help: the help button on a module page shows the docs page of that module.

The module for opening opens an order when an Open Buy or Open Sell signal is met. Your EA has exactly one; it is in the Strategy column from the start.

Modules for closing watch your open orders and close them when their condition is met. You can add several, also the same module more than once (give each a Name to tell them apart).

Stop loss: limit the loss of an order.

Take profit: lock in the profit of an order.

Other:

These modules block new orders while their condition is true. Open orders are not affected.

Optional: tells this module apart from others of the same kind, for example SL buy and SL sell. Only modules you can add more than once have a Name.

Which orders are evaluated together (Stop loss, Take profit). Each group contains the orders with the same Magic Number:

  • Order: every order is evaluated and closed on its own.
  • Symbol and ordertype: one group per symbol and type (buy or sell).
  • Symbol: one group per symbol.
  • Magic number: all orders with the same Magic Number on the account. You won’t see a line on the chart, but the total is calculated and evaluated nonetheless.

How a value is measured (Stop loss, Take profit, Maximum loss, Maximum profit):

  • Pips: the distance from the open price.
  • Money: an amount in the account currency.
  • Percentage of balance: a percentage of the account balance, for example 2 for 2%.

Whether the module works on Buy orders, Sell orders or Buy and Sell orders (Conditional modules). When buy and sell orders need a different condition, add the module twice: once for buy orders and once for sell orders.

The Conditional modules have conditions, such as Precondition. You build them exactly like a signal: see Conditions. An empty optional condition means the module doesn’t wait for it.

Modules with (Pro) in their name need a Pro subscription.

MetaTrader is a registered trademark of MetaQuotes Ltd. EA Builder Pro is not affiliated with MetaQuotes.