Admiral Markets Group consists of the following firms:

Admiral Markets Pty Ltd

Regulated by the Australian Securities and Investments Commission (ASIC)
  • Leverage up to:
    1:500 for retail clients
  • Volatility protection
  • Negative Account Balance Policy
CONTINUE

Admiral Markets UK Ltd

Regulated by the Financial Conduct Authority (FCA)
  • Leverage up to:
    1:30 for retail clients,
    1:500 for professional clients
  • FSCS protection
  • Negative balance protection
CONTINUE
Note: If you close this window without choosing a firm, you agree to proceed under the FCA (UK) regulation.
Note: If you close this window without choosing a firm, you agree to proceed under the FCA (UK) regulation.
Regulator : fca

How to create and configure a custom MT5 symbol?

Reading time: 21 minutes



Customized financial instruments

The MetaTrader trading platform allows you to create customized financial symbols. You can display the charts of many assets, perform technical analyses, and test robots and trading indicators with the Strategy Tester.

If your online broker does not provide the instrument on which you want to test your strategy, or if the size of the history provided and the quality of the price history are not sufficient, you can create a custom symbol and download the required data.

How to create and configure a custom MT5 trading symbol?

It is very simple. Two solutions are available to access the window we are interested in. The first solution is through the "Market Watch" window. If it is not already on the left side of your screen, you can display it by clicking on the "View" menu at the top of your MT5 trading platform and select "Market Watch", or use the "Ctrl + M" shortcut. Once the "Market Watch" window appears, simply right-click anywhere in the window and select "Symbols".

The second solution is to click on the "Show symbol list" shortcut at the top left of your screen or use the "Ctrl + U" keyboard shortcut to bring up the "Symbols" window where you can create and configure a custom symbol.

To create a custom symbol, you can configure some settings from the "Custom Symbol" window, such as:

  • Base, which is the name of the underlying asset for the custom symbol

For example, Gold can be the underlying instrument of a futures contract.

  • Page, which is the web page containing information about the symbol. It will be displayed as a link when displaying the symbol specifications in the "Market Watch" window
  • Cart mode, which is the price used to create the chart of the symbol: the bid or the last price
  • Background, which is the background color of the symbol in the "Market Watch" window
  • Calculate hedged margin using larger leg, which is the mode used only on hedging accounts, with opposite positions open on the same financial instrument simultaneously. The symbol margin can be calculated using the margin:
  • On the seller's side with all open sell positions and pending sell orders
  • On the buyer's side with all open buy positions and pending buy orders

The largest of the calculated values is used as the final margin value.

  • Time limits use: by choosing "Yes" here, you can specify the first and last day of the symbol exchange period (diffusion period)

In addition to the above parameters, you can configure trading and quotation sessions for the symbol. The sessions are configured separately for each day. Double-click on a day to edit it.

Define the desired sessions using the cursors. Expert advisors (EA) will not be able to trade outside of these session hours within the Strategy Tester.

Trading sessions are not specified by default and coincide with quotation sessions. If you need to configure quotation and trading periods separately, do not forget to activate the option "Enable separate trading sessions". Each trading session must be in a quotation session.

  • You can quickly configure your custom symbol by copying and modifying the settings of any similar financial instrument. To do so, you just need to select an existing symbol in the "Copy from" field
  • The name of the custom symbol must not match any name among the symbols provided by your broker. If you connect to the server where a symbol with the same name exists, the custom symbol will be deleted
  • The symbol name can only contain Latin letters without punctuation marks, spaces or special characters with an exception of the following: "...", " _", "&" and "#". It is not recommended to use the following characters: <, >, :, ", / , |, ?, *
  • The minute and tick history of the customized financial instrument is automatically deleted when the following parameters in the symbol specifications are changed:
  • The synthetic instrument formula
  • The tick size
  • The tick value
  • The chart mode
  • The point value
  • The precision (digits)

When the above parameters are changed from the MQL5 programs, the price data is also deleted. Be careful and configure all symbol settings correctly before importing the history.

Import and export of custom MT5 symbols

You can easily share custom symbols or transfer symbols between your platforms. The parameters of a specific custom symbol can be exported or imported from the editing window of the parameters shown above.

It is also possible to export and import entire groups of symbols:

The parameters are exported to JSON text files:

MT5 custom forex symbol management

All symbols are displayed in a separate custom group. If you need to change or delete a symbol, right-click on it and select what you need from the menu list:

Importing price history into MetaTrader 5

You can import price data on your custom symbol from any text file, as well as MetaTrader history files (HST). Choose a symbol and go to the "Bars" or "Ticks" tab.

In the import dialog box, specify the path to the file and define the required settings:

  • Separator: this is the symbol used to separate the elements in the text file
  • Ignore columns and rows: the number of columns (from left to right) and rows (from top to bottom) is to be ignored when importing data
  • Shift: it corresponds to the time difference. This option is used when importing data stored in a different time zone
  • Use only the selected data: import only the highlighted lines in the line display area. You can highlight lines with your mouse by holding down the Ctrl or Shift key on your keyboard

A file with one-minute bars should have the following format:

  • Date
  • Time
  • Open (opening price)
  • High (highest price)
  • Low (lowest price)
  • Close (closing price)
  • Tickvol (tick volume)
  • Vol (volume)
  • Spread

For example:

A file with ticks should have the following format:

  • Date
  • Time
  • Bid (bid price)
  • Ask (ask price)
  • Last (last price)
  • Volume

For example:

You can use the data from any existing instrument for your custom symbol. Export the data, modify it if necessary and re-import the data.

  • The price history is stored in one-minute bars. All other time frames are created based on these bars. You can also import data from longer periods, although shorter time frame charts will have gaps
  • For example, if you import one-hour bars, one bar per hour will appear on the one-minute chart
  • During import, the time interval is entirely replaced by the data of the specified file
  • For example, if the file contains data from the 2016.01.01 at 00:00:00:00 to the 2016.06.01 at 00:00:00:00 and the history of the custom symbols already contains data in this interval, this data will be completely replaced by new data (even if the amount of imported data is less than the history)
  • When importing bars, the presence of duplicate entries in the imported file (bars at the same time) is considered an error. In the platform, only one bar can correspond to a minute. When importing ticks, several ticks can have completely identical parameters
  • Values less than or equal to zero are not imported
  • During import, the user must provide the correct order of ticks in the file, i.e., from the oldest to the most recent tick

The price data for custom symbols is stored in a separate custom directory (not where trading server data is stored):

Changing the price history in MT5

You can change the history of the bars and ticks of custom symbols manually. To do this:

  • Ask for the required data interval in the "Bars" or "Ticks" tab
  • Click twice to change the value
  • Use the right-click menu to add or delete entries
  • If you need to delete several bars or ticks at once, select them with your mouse by holding down the Shift key or Ctrl + Shift key

When editing bars, it is strongly recommended to request data from the one-minute period. Indeed, the price history is stored in the form of one-minute bars in the platform. All other time frames are created based on these bars. Even if you initially request another period, all changes will be applied to the corresponding one-minute data.

For example, if you request data from the 5-minute period and change a bar, five one-minute bars will be replaced by a one-minute bar (corresponding to the beginning of the 5-minute bar). This means that the modified interval will be replaced entirely.

For simplicity, the modified entries are highlighted as follows:

  • The red background means that the entry is incorrect (for example, the highest price is lower than the lowest price)
  • The green background indicates a correctly modified entry
  • The grey background indicates a deleted entry
  • The yellow background shows an added entry
  • When adding a new bar, the first unoccupied date or time of the current data selection is automatically inserted into the "Date" column
  • The platform does not allow you to create bars with the same date or time. Only one bar can correspond to a specific minute

To save the changes, click on "Apply Changes" at the bottom of the window.

Using customized financial instruments in your trading

The use of custom symbols is similar to the use of instruments provided by your broker. Custom symbols are displayed in the "Market Watch" window; you can open the chart of these symbols and apply indicators as well as analytical objects.

Tests using customized MT5 financial instruments

Real transactions cannot be executed on custom symbols, but they can be used to test robots and trading indicators in the Strategy Tester.

Select a custom symbol and start the test:

When calculating the margin and profit of the transactions executed during the tests, the Strategy Tester can automatically use the exchange rates available on the account.

For example, if the profits are in EUR and the account currency is USD, the Strategy Tester will convert it using the corresponding EUR/USD rate.

Most of the time, custom symbol names include various suffixes, such as EURUSD.1 or EURUSD.f. Therefore, the Strategy Tester uses a special mechanism to search for appropriate exchange rates for the corresponding calculation.

For example, we have created a custom symbol named "AUDCAD.custom" with the forex type of margin calculation, and the USD is the base currency of the account. Based on the name of the forex instrument, the Strategy Tester searches for the required symbols in the following order:

  • 1.First, the Strategy Tester looks for symbols such as AUDUSD.custom (for margin calculation) and USDCAD.custom (for profit calculation)
  • 2.If one of these symbols is not found, the Strategy Tester searches for the first symbol, whose name corresponds to the required currency pairs, i.e., AUDUSD and USDCAD. For example, if AUDUSD.b and USDCAD.b are found, the rates of these symbols will be used to calculate the margin and profit

For financial instruments with other types of margin calculation (CFDs, Futures, Stock Exchanges), a currency pair is required to convert the currency of the instrument into the deposit currency.

For example, we have created a custom symbol with the British pound (GBP) defined as the profit and margin currency, and the Swiss franc (CHF) as the deposit currency. In this case, the symbols to be tested are searched in the following order:

  • 1.The availability of a trading instrument corresponding to GBPCHF (GBP vs CHF) is checked
  • 2.If this symbol is not available, the Strategy Tester will search for the first trading instrument corresponding to the currency pair GBPCHF, such as GBPCHF.b or GBPCHF.def
  • When testing applications using custom instruments, make sure that the account has all the necessary currency pairs. Otherwise, the calculation of financial results and margin requirements during the tests will not be possible
  • The use of MQL5 Cloud Network for optimization using custom symbols is not allowed. This is due to the fact that custom symbols with the same names, but different price histories may exist on different traders' computers. In addition to the divergence of test results between network agents, this can cause mass reloading and synchronization of history data, leading to excessive internet use. The use of local network agents and remote agents is allowed

Synthetic trading symbols with real-time quotes

The trading platform allows you to create synthetic financial instruments, i.e., symbols based on one or more existing instruments. The user must define the formula for calculating the quotations, after which the platform will generate ticks for the synthetic instrument in real time and will also create its history in minutes.

How does it work?

  • You create a synthetic instrument and define a formula for calculating the price
  • The platform calculates ticks at a frequency of 10 times per second, as long as the price of at least one of the instruments used in the formula has changed
  • The platform also calculates the history of one-minute bars (for the last two months) based on the one-minute instrument bars used in its formula. All new measurements (current and future) will be drawn in real time according to the ticks generated by the synthetic instrument

For example, you can create an instrument displaying the dollar index (USDX). The latter will use the formula below:

The trading platform will calculate the price of the new instrument in real time based on the quotes of the other six symbols provided by your broker. Price changes will be displayed in the "Market Watch" window and on the chart:

Create a new custom symbol, open its specification and specify the formula:

The calculation of ticks and one-minute data of a synthetic instrument begins when the instrument is added to the "Market Watch" window. In addition, all symbols required for the calculation of the synthetic price are automatically added. The calculation will be added to the platform journal under: Synthetic symbol USDX: processing started.

  • The calculation of a synthetic instrument is stopped after its withdrawal from the "Market Watch" window
  • The symbols currently used to calculate the prices of synthetic symbols cannot be hidden in the "Market Watch" window

Real-time calculation of quotations

For each second, the prices of the symbols used in the calculation are checked 10 times. If at least one of them has changed, the price of the synthetic symbol is calculated, and a new stick is generated. The calculation is carried out three times for the bid, the ask, and the last price.

For example, if the calculation formula is EURUSD * GBPUSD, the price of the synthetic symbol will be calculated as follows:

  • Bid = bid (EURUSD) * bid (GBPUSD)
  • Ask = ask (EURUSD) * ask (GBPUSD)
  • Last = last (EURUSD) * last (GBPUSD)

For example, if only the bid price of a source instrument has changed, only the appropriate price of a synthetic instrument will be calculated.

Creating a one-minute bar history on the MT5 platform

In addition to collecting ticks in real time, the platform creates a detailed history of the synthetic instrument. It allows traders to visualize synthetic symbol charts similar to those of standard assets, as well as to perform technical analyses using objects and indicators.

When a trader adds a synthetic instrument to the "Market Watch" window, the platform checks whether its history in minutes exists. If it does not exist, the history of the last 60 days will be created, which includes about 50 000 bars. If a lower value is specified in the "Max . bars" field in the graphical parameter of the platform, the appropriate limitation will apply.

If some bars from this period were created earlier, the platform will also generates new bars. A larger history is created if the user tries to display an older period on the chart (by scrolling or accessing it from an MQL5 program).

The minute history of a synthetic instrument is calculated based on one-minute bars (and ticks) of the instruments used in its formula.

For example, to calculate the opening price of a one-minute bar of a synthetic symbol, the platform uses the opening prices of the symbols used in its formula. High, low and close prices are calculated in the same way.

If the required bar is not available for any of the instruments, the platform will use the closing price of the previous bar.

For example, let's say that three instruments are used: EURUSD, USDJPY, and GBPUSD. If in the calculation of a bar corresponding to 12:00, the required USDJPY bar is not available; the following prices will be used for the calculation as follows:

  • Open: open of the EURUSD bar of 12:00; close of the USDJPY bar of 11:59, open of the GBPUSD bar of 12:00
  • High: high of the EURUSD bar of 12:00, close of the USDJPY bar of 11:59, high of the GBPUSD bar of 12:00
  • Low: low of the EURUSD bar of 12:00, close of the USDJPY bar of 11:59, low of the GBPUSD bar of 12:00
  • Close: close of the EURUSD bar of 12:00, close of the USDJPY bar of 11:59, close of the GBPUSD bar of 12:00

If the minute bar is not available for all the instruments used in the formula, the appropriate minute bar of the synthetic instrument will not be calculated.

Creating minute bars in your trading platform

All new bars (current and future) of the synthetic instrument are created according to the ticks generated. The price used to build the bars depends on the "Chart mode" parameter in the parameters:

Operations allowed in the symbol formula – MT5 platform

Price data and some properties of existing symbols provided by the broker can be used to calculate synthetic prices, including the following elements:

  • Symbol name: depending on the synthetic price to be calculated, the bid, the ask or the last price of the specified instrument will be used.
  • For example, if EURUSD * GBPUSD is specified, the bid and ask are calculated as follows:
  • Bid = bid (EURUSD) * bid (GBPUSD)
  • Ask = ask (EURUSD) * ask (GBPUSD).
  • Bid (symbol name): the bid of the specified symbol will be used forcefully to calculate the bid of the synthetic instrument. This option is similar to the previous one (where the price type is not specified)
  • Ask (symbol name): the ask of the specified symbol will be used to calculate the bid of the synthetic instrument. The bid of the specified instrument will be used to calculate the ask. The last price of the specified symbol will be used to calculate the last price. If the (EURUSD) * GBPUSD ask is specified, the following calculation will be used:
  • Bid = bid (EURUSD) * bid (GBPUSD)
  • Ask = ask (EURUSD) * ask (GBPUSD)
  • Last = last (EURUSD) * last (GBPUSD)
  • Last (symbol name): the last price of the specified symbol will be used in the calculation of all synthetic instrument prices (bid, ask and last price). If the (EURUSD) * (GBPUSD) last price is specified, the following calculation will be used:
  • Bid = last (EURUSD) * bid (GBPUSD)
  • Ask = last (EURUSD) * ask (GBPUSD)
  • Last = last (EURUSD) * last (GBPUSD)
  • Volume (symbol name): the tick volume of the specified instrument will be used in the formula. Make sure that the volume information is provided by the broker for this symbol
  • Point (symbol name): the minimum price change of the specified instrument will be used in the calculations
  • Digits (symbol name): the number of decimal places in the price of the specified symbol will be used in the formula

If a symbol has a complex name (contains hyphens, dots, etc), it must be written in quotation marks.

Example: "RTS-6.17".

The following arithmetic operations can be used in the formula:

  • Addition: +
  • Subtraction: -
  • Multiplication: *
  • Division: / and %

For example: EURUSD + GBPUSD means that the price is calculated as the sum of the EURUSD and GBPUSD prices.

Be careful with the calculation priority of arithmetic operations:

  • Multiplication and division operations are performed first, followed by addition and subtraction operations
  • Operations are performed from left to right. If the formula uses several operations with the same priority (for example, multiplication, and division), the operation on the left will be executed first
  • You can use brackets to change the priority of operations. Operations in brackets have the highest priority in the calculation. The left-to-right principle also applies for them: the operations in parentheses on the left are calculated first

You can use constants in the formula:

  • Numeric (whole and others)
  • Example: EURUSD * 2 + GBPUSD * 0.7
  • Properties of the symbol _Digits and _Point. They add the appropriate properties of the custom symbol to the formula
  • _Digits indicates the number of decimals in the price of the instrument
  • _Point indicates the smallest change in the price of the symbol (step)

You can also use in the formula all the mathematical functions supported in MQL5, except MathSrand, MathRand, and MathIsValidNuber:

If you want to discover all the features offered by the MT5 trading platform, and how to get started, you can consult our complete MetaTrader 5 guide!

About Admiral Markets

As a regulated broker, we provide access to some of the most widely used trading platforms in the world. With us, you can trade CFDs, shares, and ETFs.

CFDs are complex instruments and come with a high risk of losing money rapidly due to leverage.