Skip to main content
Version: 2.0

Custom Expert Advisor

Intro

This article offers a concise introduction to the Custom Expert Advisor product. The Custom Expert Advisor application is designed to execute one or more trading modules on either live or demo charts but can also be used with the strategy tester. Each trading module is defined by a SET file placed in an input folder. While the Custom Expert Advisor can operate as an independent application by directly editing the input parameters in the SET files, creating them using the Expert Advisor Builder is recommended. Since both of these applications work together, becoming acquainted with the Expert Advisor Builder is strongly suggested before proceeding with the Custom Expert Advisor.

Installation

First, please download the executable installer with the web-based downloads portal. You can find all available plans here if you still need to subscribe to a Custom Expert Advisor plan. Please consider that some browsers throw a warning and question whether to keep EXE files. In this case, you want to do that. Upon completion of the download, you will find a setup file in your download folder. Please double click on the setup file to start the installation.

Starting of installation.png

Some users might encounter a warning from Windows when trying to execute an EXE file. This warning can be bypassed by clicking on More info and then choosing Run anyway. It is planned to resolve this issue soon. In the meantime, you can use the provided workaround. Please proceed with the setup and follow the instructions presented below. During the installation, you'll be asked to select the MetaTrader instance on your computer where you want to install the Custom Expert Advisor.

Windows installation warning.png

Your Custom Expert Advisor is now installed and ready to use!

Grant permissions

As the Custom Expert Advisor interacts with a backend server, you must adjust some settings in your MetaTrader. Please open the instance of MetaTrader you chose during installation and go to the Options menu.

MetaTrader, Opening of options.png

Navigate the Expert Advisors tab and check the boxes for Allow automated trading and Allow DLL imports. Stay calm about the warning associated with the second option. The application uses native Windows libraries to communicate with a backend license server, simplifying your license management through the dashboard web interface.

MetaTrader, Enabling of automated trading and DLL imports.png

Next, you'll delve into the operational principles of the Custom Expert Advisor.

Overall concept

This section briefly overviews the function principle behind the Expert Advisor Builder. Perfecting this principle took several years, making explaining it in a few words challenging. Please consider reading the extended article about the overall concept for a comprehensive understanding.

However, the overall concept can be summarized in two sentences:

  • The Expert Advisor Builder is used to develop a trading module and to generate an output file containing all information about the module.
  • The Custom Expert Advisor executes the output files the Expert Advisor Builder produced.

As evident, both applications work in tandem! However, for some use cases, the Expert Advisor Builder suffices. For instance, if you only want to validate a trading idea that you will eventually execute manually, you can test the strategy upfront in the strategy tester. In contrast, to execute a trading strategy completely autonomously, you must subscribe to a Custom Expert Advisor plan and use the output files as input for this application.

This principle might be familiar from other development processes. For example, a designer uses an editor application in CAD development to model and export an output file containing the 3D model. Analogously, the editor application is the Expert Advisor Builder, and the SET files represent the 3D model, respectively, its export file. After the designer has developed the 3D model, he might want to produce it with a 3D printer. The 3D model then serves as input for the 3D printer to create a physical object. In this case, the 3D printer is the Custom Expert Advisor, which can use the output files from the Expert Advisor Builder and execute one or more so-called trading modules. A single SET file defines an entire trading module.

The illustration below visualizes the concept.

Workflow and combination of expert advisor builder and custom expert advisor.png

Looking at the Custom Expert Advisor in this illustration, you can see that two variants of this application exist - a live variant and a tester variant. Both perform the same task but use different input folders. Therefore, the live variant is exclusively responsible for executing live charts, and the tester variant is accountable for validating trading strategies with the strategy tester. This ensures the input and output data separation to avoid interference.

Just as a 3D printer can print multiple objects simultaneously, the Custom Expert Advisor can execute various input files simultaneously. In addition to that, each trading module can be turned on and off while the Custom Expert Advisor is active. This helps maintain a continuous trading journal and adequately inspect the drawdown and performance.

This unique principle of separation of expert advisor development and execution opens up an almost unlimited range of possibilities. The most interesting by far are self-adapting trading systems that turn trading modules on and off with the help of a feedback loop. Every aspect of the Expert Advisor Builder and Custom Expert Advisor is designed to be fully automated.

Since many trading strategies only work for a limited period, finding an algorithm-based system that operates profitably for an extended period is challenging. This means trading strategies have to be adapted continuously. Depending on the timeframe, it can sometimes be commonplace. Using the Expert Advisor Builder to improve this workflow, many different trading strategies for MetaTrader can be generated and evaluated quickly.

Execute an example

In this section, you'll work through one of the examples available for the Custom Expert Advisor. A list of all examples can be found in the examples section. Next, you will execute the Custom Expert Advisor with the MetaTrader strategy tester. To do so, select the correct variant accessible under FEA Trading\MT4\Custom Expert Advisor Tester 2.0 in the MetaTrader strategy tester settings. You can use either MetaTrader 4 or MetaTrader 5 to execute the example.

Most of the examples can be executed on any timeframe and any symbol. However, for this exercise, please set EURUSD as the symbol to be tested, M15 as the timeframe, select Open prices only (MetaTrader 4) or 1 minute OHLC (MetaTrader 5) as the data model, and the previous four weeks as the test period. Finally, enable the visual testing mode.

Next, download the example zip package and utilize the profile folder with this trading system.

tip

To reproduce this example, you can also download the zip package cea_example_1_v_2_0.zip containing the entire profile folder.

Result

Let's examine the final result aimed to achieve with this example. As you can observe in the chart below, this example strategy initiates long and short trades. At this moment, long and fast transactions are created by independent trading modules.

Custom expert advisor example chart 3, Long and short trading combined, All modules combined.png

To accomplish this, two input files are loaded and executed simultaneously. Each input file represents a fully autonomous and encapsulated trading module. The Custom Expert Advisor recognizes commonly used signals, like the MACD oscillator, and computes the algorithm only once. As a result, even many independent trading modules can be executed simultaneously. For instance, some could contain an indicator-based trading strategy, while others could contain a candle pattern-based trading logic. The flexibility of this approach is virtually limitless.

EAM_I1.set, MACD - Long trading

By executing each trading module individually, you can see that module number one only performs long operations.

Custom expert advisor example chart 0, Long and short trading combined, MACD - Long trading.png

EAM_I2.set, MACD - Short trading

Module number two performs the short operations.

Custom expert advisor example chart 2, Long and short trading combined, MACD - Short trading.png

This article does not explain how to turn individual trading modules on and off. For more details, kindly refer to the user manual article elaborating on the file inputs. Generally, the input folder containing the trading modules can be modified while the Custom Expert Advisor is active. Any changes made will prompt the trading systems to adjust accordingly. This provides a unique chance to eliminate ineffective trading strategies and introduce new ones to adapt to fluctuating market conditions.

As mentioned, a live variant of the Custom Expert Advisor also exists. This variant is used to execute a trading module on live charts. With the live variant of the Customs Expert Advisor, you can use a different input folder to implement trading strategies in real-time on any chart from your market watch - more about that in this article from the user manual.

Trading results to go

The primary advantage of an automated trading strategy is that it allows a machine to handle the task for you. However, it's crucial to periodically verify the performance and functionality to ensure the automated trading strategy is executed as intended. The Custom Expert Advisor is designed to monitor performance and drawdown at all times. It can automatically turn off a trading module if it detects unfavorable values. This feature is known as the inspector, and you're likely already familiar with it, as it's the same one used by the Meta Extender and Expert Advisor Builder. The inspector updates a web interface, enabling you to access the performance and drawdown values within your dashboard.

Dashboard features, Inspector simplified.png

This dashboard page provides each trading module's performance, drawdown, and statistical critical facts. As this view is updated several times per minute, you can conveniently inspect your trading system even with your mobile phone.

Automatically generated journal

In addition to the inspector feature, a sophisticated trading journal is automatically maintained. The Custom Expert Advisor utilizes an engine to track past trades. A trading journal is automatically, continuously generated, and exported as a CSV file. The export can be imported into an easy-to-use Excel file, as shown in the image below.

File Output, Journal, Data import.png

Given the diverse nature of the trading strategies that the Custom Expert Advisor can comprise, the application creates a separate trading journal for each. In addition, a comprehensive version contains journal information for all trading modules combined. For more information, please read the user manual article about the trading journal.