• Overview
  • Reviews (1)
  • Comments

Correlation 2 moving average

Correlation Expert Advisor on Two Moving Averages

The Expert Advisor allows making profit on any symbol and time frame. Default Expert Advisor settings are designed for working on EURUSD and H1 time frame for the period starting with January 1, 2013. Despite this, the Expert Advisor shows excellent results on a similar time frame, for the same period on the following currency pairs: USDJPY, EURJPY, GBPJPY, CHFJPY and AUDJPY.

Expert Advisor's Trading Algorithm

The Expert Advisor calculates correlation between the current values of moving averages and sample values. The maximum correlation value is compared to the specified threshold value. If the latter is exceeded, decision to enter the market is made.

Selecting, Downloading and Managing Sample Values

Moving averages' sample values are stored in a separate file located in the terminal's common directory: "C:\ProgramData\MetaQuotes\Terminal\Common\Files\CCMA". The file name is "ХХХХХХ_CCMA.bin", where ХХХХХХ is a currency pair's name. The file may contain any number of samples. By default, the file does not exist, but it is created automatically when a sample value is downloaded.

Expert Advisor's operation mode with sample values. "Work mode" parameter is responsible for the Expert Advisor's operation mode. Parameter values may be as follows:

  • Read - reading the file with sample values and displaying the message in "Experts" tab.
  • Write - writing selected test values to file. If the file does not exist, it will be created.
  • Delete - deleting selected test values from the file.
  • Erase - deleting all values from the file.

The following parameters should be specified to select and download a sample value: "Sample start time" – date and time, starting from which the moving averages' values are used as samples. The value countdown starts from the selected time into the past. The number of values for a sample is set in "Sample weight" parameter.

For example, "Sample start time" parameter is set as 2013.01.31 20:00, while "Sample weight" is set to 20. It means that 20 values of moving averages will be taken at H1 from 2013.01.31 20:00 to 2013.01.31 01:00.

To write the values, set the mode to "Write" and launch the Expert Advisor. In this case, selected sample values are written to the file.

The maximum value of "Sample weight" parameter is no more than 500.

The file should contain sample values of the same length to ensure the Expert Advisor's correct operation. Each specimen stored in the file has its own index. The index starts with 0. The sample's index can be seen in "Read" mode. If you want to delete any sample from the file, specify the sample's index in "Sample Index" parameter, select "Delete" mode and launch the Expert Advisor.

Normal Mode of the Expert Advisor's Operation

"Work mode" parameter ("Trade" value) is responsible for the Expert Advisor's normal operation mode.

Below are parameter settings. The names of most of them are self-explanatory.

  • Period of Fast Moving Average
  • Period of Slow Moving Average
  • Method of Moving Average - method of moving average's calculation.
  • Price of Moving Average - moving averages' price type.
  • Sample weight A specified value should be equal to sample weights contained in the file.
  • Correlation - correlation's threshold value.
  • Order volume
  • Trailing Stop level (in points). If the value is 0, Trailing Stop functionality is not used.
  • Stop Loss level (in points).
  • Take Profit level (in points).
  • The volume of orders as a percentage of the deposit - lot volume management parameter. If the value is 0, the lot volume is taken from "Order volume" parameter. Otherwise, it is calculated as a specified percentage of the deposit.
  • Adding to the open position - mode of adding to the open position (enabled by default). If a new market entry signal similar to the direction of the already opened position appears, a new deal is performed.
  • Number of attempts to open a position
  • Value of slippages in points
  • Enable comments - enable displaying comments on the chart.
  • Magic Number of Advisor
  • Pause after trading in milliseconds - pause after a trading operation in milliseconds.
Rodrigo da Silva Boa
2016.01.24 00:32 

User didn't leave any comment to the rating