Discussion of article "Creating and testing custom symbols in MetaTrader 5"

 

New article Creating and testing custom symbols in MetaTrader 5 has been published:

Creating custom symbols pushes the boundaries in the development of trading systems and financial market analysis. Now traders are able to plot charts and test trading strategies on an unlimited number of financial instruments.

Creating a custom symbol

Let's create a custom symbol based on the one already present in the Market Watch. Open the Symbols window by the right mouse button and select the one you would like to use to create a custom symbol.


After clicking "Create Custom Symbol", set its name and change the required parameters in the contract specification if necessary.


All custom symbols are placed to the separate <Custom> directory of the Symbols tree and are always located there regardless of a broker you are currently connected to. Price data of custom symbols are saved in a separate Custom directory outside of the directories where data of trade servers are stored:

C:\Users\[windows account]\AppData\Roaming\MetaQuotes\Terminal\[instance id]\bases\Custom

This is another advantage of creating a custom symbol — you can simply copy the necessary symbols from each broker to your custom group. Just like conventional symbols, you can delete a custom symbol only if there are no open charts with it and it is not present in the Market Watch.

Author: MetaQuotes Software Corp.

 

CustomTicksReplace

Полностью заменяет ценовую историю пользовательского инструмента в указанном временном интервале данными из массива типа  MqlTick

It is very expensive in the script to create a tick clone of an old symbol with already uploaded tick history. CopyTicks does not work instantly at all.

 
Trying backtest (in any mode) since 1st of August, error crashes out
2017.09.04 11:52:40.139 Tester  EURCHF_custom: history data begins from 2017.07.25 00:00
Added stories, no luck
2017.09.04 11:57:50.498 Tester  EURCHF_custom: history data begins from 2017.06.13 00:00
 
fxsaber:
I try backtest (in any mode) from the 1st of August, I get an errorAdded history, no luck

What timeframe is set for testing? The article Fundamentals of Testing in MetaTrader 5 says that 100 bars are required:

The testing agent downloads only the missing history with a small reserve to provide the necessary data on the history for calculating indicators at the time of testing. The minimum volume of history downloaded from the trading server for timeframes D1 and less is one year. Thus, if you start testing on the interval 2010.11.01-2010.12.01 (testing on the interval of one month) with the period M15 (each bar is equal to 15 minutes), the terminal will request the history of the instrument for the whole year 2010. For Weekly timeframes, the history of 100 bars will be requested, which is approximately two years (there are 52 weeks in a year). For testing on the Monthly timeframe, the agent will request the history for 8 years (12 months * 8 years = 96 months).

 
Rashid Umarov:

What timeframe is set for testing? The article Fundamentals of Testing in MetaTrader 5 says that 100 bars are required:

M1. Used this script to create a symbol.

 
fxsaber:

M1. I used this script to create a symbol.

In addition to EURCHF_custom, I created EURUSD_custom. And the backtest on EURCHF went on, while pulling data from EURUSD_custom.

I thought that after deleting EURUSD_custom the backtest would not work, but no. Now it works.

Why I had to create EURUSD_custom and then delete it to make the tester work is not clear.


ZY Bug.

Forum on trading, automated trading systems and testing trading strategies.

Libraries: Symbol

fxsaber, 2017.09.04 13:54

The new cross counts correctly - it does not convert profit. But for some reason it is pulling a major when it is not used anywhere else

2017.09.04 14:46:43.062 Core 1  EURCHF_custom: generate 975389 ticks in 0:00:00.063, passed to tester 3210 ticks
2017.09.04 14:46:43.062 Core 1  EURUSD: generate 979976 ticks in 0:00:00.062, passed to tester 8696 ticks
 
fxsaber:

In addition to EURCHF_custom, I created EURUSD_custom. The EURCHF backtest went on, pulling data from EURUSD_custom.

I thought that after deleting EURUSD_custom the backtest would not work, but no. Now it works.

Why it was necessary to create EURUSD_custom and then delete it to make the tester work is not clear.

You don't give all the details - account currency, profit currency. If the tester tries to get the history by some symbols, it means that it needs these symbols for calculations.

 
Rashid Umarov:

You don't give all the details - account currency, profit currency. If the tester tries to get the history by some symbols, it means that these symbols are required for calculations.

It is interesting that the real EURCHF has CHF as the profit currency, EUR as the margin currency and EUR as the base currency.

So the tester gets some kind of paradox. It has to calculate how much EUR (base currency) is included in a lot, then convert this amount into EUR (margin currency) - here it only got lucky with the ratio (EUR/EUR = 1). He must then convert the Margin into USD (account currency) and see if it is enough. When calculating the profit, he should convert CHF (profit currency) to USD (account currency).


Total, in the worst case scenario, the tester should make as many as three conversions (if the corresponding majors are available). And, of course, to pull in additionally THREE majors to the cross, on which the test is performed!

 
fxsaber:

You are testing forex instruments in forex/cross rates mode. Therefore, the requirements for the market environment are the same.

In your questions, please provide full logs at once, not torn out lines, please.

 
Renat Fatkhullin:

You are testing forex instruments in forex/cross rates mode. Therefore, the requirements in the market environment are the same.

I don't get it.

In your questions, please provide full logs, not torn lines, please.

Attached.

Files:
Log.zip  3 kb
 
fxsaber:

I don't get it.

Attached.

According to the logs, deposit currency = USD, testing is performed on EURCHF symbol. The tester needs EURUSD or USDEUR quotes for margin calculation.

2017.09.04 15:26:30.999 Tester  EURCHF_custom: history data begins from 2017.06.13 00:00
2017.09.04 15:26:31.000 Core 1  agent process started
2017.09.04 15:26:31.442 Core 1  connecting to 127.0.0.1:3000
2017.09.04 15:26:31.442 Core 1  connected
2017.09.04 15:26:31.448 Core 1  authorized (agent build 1653)
2017.09.04 15:26:31.452 Tester  EURCHF_custom,M1 (MetaQuotes-Demo): testing of Experts\Test.ex5 from 2017.08.01 00:00 to 2017.08.15 00:00
2017.09.04 15:26:31.468 Core 1  common synchronization completed
2017.09.04 15:26:31.529 Tester  quality of analyzed history is 100%
2017.09.04 15:26:31.683 Core 1  MetaTester 5 started on 127.0.0.1:3000
2017.09.04 15:26:31.683 Core 1  initialization finished
2017.09.04 15:26:31.683 Core 1  login (build 1653)
2017.09.04 15:26:31.683 Core 1  38520 bytes of account info loaded
2017.09.04 15:26:31.683 Core 1  1482 bytes of tester parameters loaded
2017.09.04 15:26:31.683 Core 1  2748 bytes of input parameters loaded
2017.09.04 15:26:31.683 Core 1  4356 bytes of symbols list loaded
2017.09.04 15:26:31.683 Core 1  expert file added: Experts\Test.ex5. 446309 bytes loaded
2017.09.04 15:26:31.683 Core 1  initial deposit 10000000.00 USD, leverage 1:500
2017.09.04 15:26:31.683 Core 1  successfully initialized

It searches for them among the available symbols and finds EURUSD, then it downloads and synchronises them

2017.09.04 15:26:31.683 Core 1  EURUSD: symbol to be synchronized
2017.09.04 15:26:31.683 Core 1  EURUSD: symbol synchronized, 3464 bytes of symbol info received
2017.09.04 15:26:31.683 Core 1  EURUSD: load 27 bytes of history data to synchronize in 0:00:00.000
2017.09.04 15:26:31.683 Core 1  EURUSD: history synchronized from 2016.01.04 to 2017.08.15