Skip to main content
Version: 2.0

ORM - Order Manager

Concept diagram

The concept diagram provided below depicts the function block associated with this page.

Concept diagram, Order Manager.png

Long or short trading

A trading module generated with the Expert Advisor Builder can execute long or short trades, but only one of both. To combine both directions, you can use the generated SET files as input for the Custom Expert Advisor. This will effectively result in a trading system performing long and short trades. The trading direction can be configured with the input parameters > (ORM) Operation, which can be found in the input properties of your Expert Advisor Builder.

Input variable within MetaTrader
(Identifier in SET file)
Default valueComment
> (ORM) Operation
(IN_enmOrmOperation)
LONGNumeric values usable in SET files:
0 - LONG
1 - SHORT
2 - LONG SIGNAL ONLY
3 - SHORT SIGNAL ONLY
For both SIGNAL ONLY modes, enabling > (MIS) General signal visualization is recommended.

You can select from four different operational modes for your trading module:

  • LONG:** Only long trades such as buy, buy limit, and buy stop will be performed when a trading signal is given. **
  • SHORT:** **Only short trades such as sell, sell limit, and sell stop will be performed when a trading signal is given.
  • LONG SIGNAL ONLY:** **No trades will be performed; a vertical green line will be drawn for each trading signal.
  • SHORT SIGNAL ONLY: No trades will be performed; a vertical red line will be drawn for each trading signal.

The illustration below shows the results of each operational mode. As can be seen, example chart a) shows long trades, example chart b) shows only short trades, and example charts c) and d) show only long and short signals, respectively.

Configuration, Order Manager, Long or short trading, Example charts.png
tip

To reproduce the chart from above, you can download and use the SET file package um_eab_corm_2_v_2_0.zip.

Please note that you must also enable the input parameters > (MIS) General signal visualization to visualize the signals. No red or green vertical lines will be drawn unless this parameter is enabled.

Symbol and timeframe

The table below outlines the input parameters that allow you to specify the symbol and timeframe for opening and managing trades. The input parameter, > (ORM) Symbol, can be any symbol from your market watch. By default, it is set to CURRENT, therefore pointing to > (STF) Symbol for 'CURRENT'. If this central symbol selector is also set to CURRENT, the symbol used is the actual chart symbol where the trading module is executed, such as EURUSD. Thus, the STF input parameter primarily serves as the central symbol selector unless > (ORM) Symbol is set to a symbol name other than CURRENT. This setup allows you to quickly change the primary symbol for the entire trading module using > (STF) Symbol for 'CURRENT' or only the symbol for the order manager module by utilizing > (ORM) Symbol.

The timeframe selection process mirrors the symbol selection process. If you wish to use a different timeframe for order management, you can either modify > (ORM) Timeframe, or adjust the central timeframe selector > (STF) Timeframe for 'CURRENT'. Changing > (ORM) Timeframe will cause only the order manager to use a different timeframe, such as H1, while all other functional blocks will continue to use CURRENT, which could be M15. Altering > (STF) Timeframe for 'CURRENT' will prompt every functional block configured with CURRENT to use the selected main timeframe.

Some symbols provided by brokers may not accurately represent the reference market. For instance, many brokers offer the DE40 index with rates before and after the official market opening and closing. Outside the official market hours, the price is sometimes formed using the future price or third-party market makers to offer a continuous chart in your MetaTrader. This can result in prices that vary from broker to broker, especially during night hours. For many conservative trading strategies, it is desirable to use only the actual market hours to take into account when opening and managing trades. Therefore, with > (ORM) Exclusion (HH:MM:SS-HH:MM:SS), you can entirely exclude a given time range. Please note that this feature is not equivalent to the functional block with which you can configure the trading timing of a trading module.

Input variable within MetaTrader
(Identifier in SET file)
Default valueComment
> (ORM) Symbol
(IN_strOrmSymbol)
CURRENTThe input value cannot be empty.
> (ORM) Exclusion (HH:MM:SS-HH:MM:SS)
(IN_strOrmExclusion)
00:00:00-00:00:00The input value has to be in the format HH:MM:SS-HH:MM:SS.
> (ORM) Timeframe
(IN_enmOrmTimeframe)
CURRENTNumeric values usable in SET files:
-2 - CURRENT
0 - M1
1 - M5
2 - M15
3 - M30
4 - H1
5 - H4
6 - D1
7 - W1
8 - MN

The first set of examples illustrates the effect of changing the > (ORM) Symbol parameter. In chart a), the symbol is set to CURRENT, while in chart b), it's set to AUDUSD. However, both tests were conducted with EURUSD as the symbol. Consequently, trades were executed on EURUSD in chart a) and on AUDUSD in chart b). These examples utilized the MetaTrader 5 strategy tester.

Configuration, Order Manager, Symbol and timeframe, Example charts 1.png
tip

To reproduce the chart from above, you can download and use the SET file package um_eab_corm_3_v_2_0.zip.

The following examples show how to exclude a specific period from order management, such as stop loss trailing. In chart a), no hours are excluded, so the trailing continues throughout the night. In contrast, chart b) excludes the time from 21:00:00 to 08:00:00, resulting in a pause in trailing during these hours.

Configuration, Order Manager, Symbol and timeframe, Example charts 2.png
tip

To reproduce the chart from above, you can download and use the SET file package um_eab_corm_4_v_2_0.zip.

The final series of examples demonstrate the effect of using a different timeframe. Chart a) uses CURRENT as the timeframe, which means the native timeframe of M15 is used. On the other hand, chart b) uses H1 as the timeframe. This results in different trailing characteristics, as demonstrated with a market trailing. In the H1 timeframe, a new candle pattern appears less frequently, so the trailing level modification occurs only every fourth bar.

Configuration, Order Manager, Symbol and timeframe, Example charts 3.png
tip

To reproduce the chart from above, you can download and use the SET file package um_eab_corm_5_v_2_0.zip.

Screenshots for openings and closings

A trading module created with the Expert Advisor Builder can be configured to take a screenshot each time a trade is opened or closed. All screenshots will be saved in an output folder and will be versioned. This feature is available when using the Expert Advisor Builder in visual tester mode.

Input variable within MetaTrader
(Identifier in SET file)
Default valueComment
> (ORM) Take screenshots (slows down testing speed!)
(IN_enmOrmTakeScreenshot)
OFFNumeric values usable in SET files:
0 - OFF
1 - ON

The screenshot feature can be enabled with the input parameter > (ORM) Take screenshot. This feature is compatible with the MetaTrader 4 strategy tester and is fully functional when a trading module is executed with either the MetaTrader 4 or MetaTrader 5 Custom Expert Advisor. When enabled, an image will be saved at the opening and closing of each trade. The screenshots, which begin with the order number, can be found in the screenshots output folder. The folder will resemble the image shown below.

Configuration, Order Manager, Screenshots for openings and closings, Output folder.png
tip

To reproduce the chart from above, you can download and use the SET file package um_eab_corm_6_v_2_0.zip.

Extended trade visualization

Most of the FEA Trading applications designed for the MetaTrader utilize comfort visualization. While MetaTrader already displays trade entries and exits on a chart, the default visualization's usability could be better. As a solution, all trades initiated by an Expert Advisor Builder trading module can visualize trades with high-contrast graphical objects. The input parameter > (ORM) Comfort visualization can turn this feature on or off. By default, comfort visualization is enabled.

Input variable within MetaTrader
(Identifier in SET file)
Default valueComment
> (ORM) Comfort visualization
(IN_enmOrmComfortVisualization)
ONNumeric values usable in SET files:
0 - OFF
1 - ON

When > (ORM) Comfort visualization is set to ON, graphical objects for trade opening, closing, stop loss, and taking profit are drawn on the chart. The stop loss trailing method, take profit dynamic method and final trade results are also displayed. The image below illustrates what a completed long trade would look like.

Configuration, Order Manager, Extended trade visualization, Function principle.png

A line is drawn from the opening price to the closing price and updated in real time. The color varies depending on whether the trade result is positive or negative. The following examples demonstrate how different trade directions and order types are visualized. A vital feature of this comfort visualization is that changes in stop loss labels are also envisioned, significantly simplifying the understanding of previous trades!

Configuration, Order Manager, Extended trade visualization, Example charts.png
tip

To reproduce the chart from above, you can download and use the SET file package um_eab_corm_8_v_2_0.zip.

One trade mode

Some trading signals, such as crossing two indicator lines, are precise. However, many trading signals represent a period during which the signal conditions are true, such as the market phase detection of a chart analyzer. It may only sometimes be desirable to open a new trade with every signal. Instead, it might be more practical to open a trade when the first signal appears and then ignore subsequent signals while the first trade is still open.

In conjunction with the Custom Expert Advisor, the Expert Advisor Builder generally allows for multiple trades by registering multiple trading modules. Ideally, each trading module should have only one trade open at a time. However, it is also possible to have multiple trades open simultaneously. This behavior is configured by the input parameter > (ORM) One trade.

Input variable within MetaTrader
(Identifier in SET file)
Default valueComment
> (ORM) One trade
(IN_enmOrmOneTrade)
ONE PENDINGNumeric values usable in SET files:
0 - OFF
1 - KEEP PENDING
2 - DELETE PENDING
3 - ONE PENDING

Here, you can choose from four options. Unless > (ORM) One trade is set to OFF, only one trade can be open simultaneously. Any additional signals will be overseen until the previous trade is completed. The four selectable options and their meanings are as follows:

  • OFF: Each appearing signal initiates a trade or pending order.
  • KEEP PENDING: Only one open trade at a time is allowed, but each signal can trigger a new pending order if configured.
  • DELETE PENDING: Only one open trade at a time is allowed, and each new signal deletes the previous pending order in case a pending order execution is configured.
  • ONE PENDING: Only one open trade or pending order is allowed. Any further signals will be ignored until the existing trade or order is closed, respectively deleted.

The first series of examples below demonstrates all four options with a market long trade.

Configuration, Order Manager, One trade mode, Example charts for market orders.png
tip

To reproduce the chart from above, you can download and use the SET file package um_eab_corm_9_v_2_0.zip.

An example series for long pending orders for each option can be seen next.

Configuration, Order Manager, One trade mode, Example charts for pending orders.png
tip

To reproduce the chart from above, you can download and use the SET file package um_eab_corm_10_v_2_0.zip.

Notification settings

Each trading module created with the Expert Advisor Builder can send various notifications. Below is a list of all input parameters related to the notification feature and a brief explanation for each.

Input variable within MetaTrader
(Identifier in SET file)
Default valueComment
> (ORM) Notification logs ('main switch')
(IN_enmOrmNotificationLogs)
OFFNumeric values usable in SET files:
0 - OFF
1 - ON
This is the primary switch for turning notifications on and off via your MetaTrader's Experts tab in the terminal view.
> (ORM) Notification mails
(IN_enmOrmNotificationMails)
OFFNumeric values usable in SET files:
0 - OFF
1 - ON
This is the primary switch for turning notifications on and off via the built-in email API.
> (ORM) Notification protection
(IN_enmOrmNotificationProtection)
OFFNumeric values usable in SET files:
0 - OFF
1 - ON
This turns warnings on or off when an inspector limit is reached.
> (ORM) Notification open
(IN_enmOrmNotificationOpen)
ONNumeric values usable in SET files:
0 - OFF
1 - ON
This is used to turn notifications on or off when a trade is opened.
> (ORM) Notification close
(IN_enmOrmNotificationClose)
ONNumeric values usable in SET files:
0 - OFF
1 - ON
This is used to turn notifications on or off when a trade is closed.
> (ORM) Notification report daily
(IN_enmOrmNotificationReportDaily)
OFFNumeric values usable in SET files:
0 - OFF
1 - ON
This turns on or off notifications for reporting the inspector values at the end of each day.
> (ORM) Notification report weekly
(IN_enmOrmNotificationReportWeekly)
OFFNumeric values usable in SET files:
0 - OFF
1 - ON
This turns on or off notifications for reporting the inspector values at the end of each week.
> (ORM) Notification report monthly
(IN_enmOrmNotificationReportMonthly)
OFFNumeric values usable in SET files:
0 - OFF
1 - ON
This turns on or off notifications for reporting the inspector values at the end of each month.
> (ORM) Notification report end
(IN_enmOrmNotificationReportEnd)
OFFNumeric values usable in SET files:
0 - OFF
1 - ON
This turns on or off notifications for reporting inspector values when the trading module is removed, or the executing application is closed.

The trading module uses the built-in API of MetaTrader to transmit this information. However, this requires the configuration of the email and notification settings in your MetaTrader instance. These settings can be found in the Tools - Options menu. Please navigate to this view and configure the notifications and email feature to fully enable email and mobile messaging.

Configuration, Order Manager, Notification settings, MetaTrader options.png

The log options, which output all data to the MetaTrader's experts tab in the terminal view, are functional without any additional configuration of your MetaTrader instance. The image below provides an example of the extended log for a trade opening. The log contains extensive information, reflecting the entire order management settings each time a trade is opened or closed.

Configuration, Order Manager, Notification settings, Example logs.png
tip

To reproduce the chart from above, you can download and use the SET file package um_eab_corm_12_v_2_0.zip.

Maximum allowed slippage for execution

Slippage in trading refers to the discrepancy between the expected price of an order and the price at which it is executed. This is often due to market volatility or low liquidity, particularly during high-impact news events or market openings, and can affect both buy and sell transactions.

Input variable within MetaTrader
(Identifier in SET file)
Default valueComment
> (ORM) Max slippage
(IN_nOrmMaxSlippage)
10The input value cannot be smaller or equal to 0.

The > (ORM) Max slippage input parameter allows you to set a maximum slippage limit for executing any pending orders. However, this feature does not apply to market orders. It's also important to note that the enforcement of this setting is dependent on your broker, as many brokers may choose to ignore this order configuration parameter.

Forced waiting time between trades

Although deemed precise and occurring within a single chart bar, many signals remain valid for several minutes or hours, depending on the trading timeframe. If a trade is closed within the bar in which it was opened, this could lead to the immediate opening of another trade. To prevent this, the default value for > (ORM) Waiting between trades (<0 -> Seconds, >0 -> Bars) is set to 1 bar. This means at least one bar must pass before opening the next trade.

Input variable within MetaTrader
(Identifier in SET file)
Default valueComment
> (ORM) Waiting between trades (<0 -> Seconds, >0 -> Bars)
(IN_nOrmWaitingBetweenTrades)
1Positive values represent the waiting time in bars, while negative values define the waiting time in seconds.

The waiting time can be defined as the number of bars (if the value is positive) or in seconds (if the value is negative). The following example charts illustrate this feature. As shown in chart b), the trading logic waits for one bar before opening the next trade. This feature lets you control the waiting period before opening the next trade.

Configuration, Order Manager, Maximum allowed slippage for execution, Example charts.png
tip

To reproduce the chart from above, you can download and use the SET file package um_eab_corm_13_v_2_0.zip.

Locally managed stop loss and take profit

Instead of providing your broker with stop loss information, you can opt to manage these values locally using the > (ORM) Local limits input parameter. Some brokers may manipulate their price charts by inserting peaks, using your stop loss information as a reference. By employing local limits, you can prevent your broker from adjusting prices based on your stop loss. However, it's important to note that unscrupulous brokers typically carry out such practices. If you ever encounter this, it is recommended that you change your broker.

Input variable within MetaTrader
(Identifier in SET file)
Default valueComment
> (ORM) Local limits
(IN_enmOrmLocalLimits)
OFFNumeric values usable in SET files:
0 - OFF
1 - ON

When local limits are activated, you'll notice that MetaTrader does not display any stop loss or take profit values in the trades tab or the strategy tester output. However, stop loss and take profit values are still in effect. The example below illustrates the same trade executed with different settings: Chart a) shows a trade executed with local limits disabled, while chart b) shows a trade executed with local limits enabled. In both scenarios, the stop loss and take profit behavior is identical.

Configuration, Order Manager, Locally managed stop loss and take profit, Example charts.png
tip

To reproduce the chart from above, you can download and use the SET file package um_eab_corm_14_v_2_0.zip.

Locally managed pending orders

Limit orders often have a significant impact on the process of price generation. In most cases, this might not affect your trading. But you can enable the local pending feature if you want to use a stealth mode. If **> (ORM) Local pending** is enabled, the pending order will not be sent to your broker's server or appear in MetaTrader's trade view. Instead, the information about when the pending price will execute a limit or stop order is managed locally. A regular sell or buy market order is executed when the pending price is reached according to the order type.
Input variable within MetaTrader
(Identifier in SET file)
Default valueComment
> (ORM) Local pending
(IN_enmOrmLocalPending)
ONNumeric values usable in SET files:
0 - OFF
1 - ON

With local pending orders activated, the behavior of the pending orders remains the same as with regular pending orders. However, you'll notice that MetaTrader's trade view does not list any limit or stop orders. Despite this, these orders are visualized in the chart windows as usual. The example below illustrates both use cases.

Configuration, Order Manager, Locally managed pending orders Example charts.png
tip

To reproduce the chart from above, you can download and use the SET file package um_eab_corm_15_v_2_0.zip.