Skip to main content
Version: 2.0

Overall Concept

Incremental trading signals and matching strategy

In trading, a prevalent question is why automated strategies often yield less profit than manual ones. Even though most trades are automated, manual systems are undeniably the most successful. This paradox is further complicated by the fact that manual traders only trade for a few hours a day or a few days a month. It's a common belief that an automated trading strategy, which operates 24/7 and is devoid of emotions, should outperform a manual trader who works 8 hours a day, five days a week, and is subject to emotional influences.

However, the reality is that a manual trader typically executes fewer trades but with larger profits on average, while an automated trading system conducts numerous trades with smaller profits. In essence, the manual trader comes out on top! A closer examination of this behavior reveals the reason: human flexibility. Despite being emotionless and tireless, algorithms are notably inflexible. Other contributing factors include broker fees, such as commissions or adjusted spreads, which tend to increase disproportionately with the number of trades performed.

A manual trader employs a strategy to generate raw signals, each individually evaluated in the current market environment. This evaluation serves as a filtering process, considering factors such as candle patterns, chart patterns, Fibonacci patterns, timing, analysis of higher timeframes, the latest economic news, and more. This multifaceted approach results in a strategy composed of multiple sub-strategies, each employing a different filtering process. Assuming that only 50% of 20 raw signals generated are deemed valid, only 10 remain, each filtered by a different sub-strategy. The more filter factors considered, the fewer actual trades per sub-strategy.

The image below depicts a typical price chart with three viable trading opportunities. A manual trader can discern that each trading window possesses distinct characteristics, necessitating different signal validation approaches. For instance, strategies one and two call for short trades, while strategy three requires a long trade. Moreover, the order configuration must also vary. Some trades necessitate a stop-loss trailing system, while others require a hedging approach, and so on.

Multiple strategy slots in chart illustrated.png

A manual trader can adapt to each trading window. Over an extended period of practice, a manual trader tends to implement various subtly different trading strategies rather than adhering to a single static one. This dynamic approach still adheres to a strict system but allows adaptability when necessary. For instance, in the event of a Federal Reserve (FED) release, no trader would mindlessly open a trade five minutes prior just because the Relative Strength Index (RSI) oscillator generates a signal.

When examining the performance of each subtly different trading strategy, it becomes apparent that at specific points in time, one strategy may yield positive results while another may underperform. The overall performance is the cumulative result of all these sub-strategies. This highlights the importance of diversification and adaptability in trading strategies.

Individual strategy module performance and sum of all.png

As the number of sub-strategies increases, the overall performance tends to stabilize. This can be likened to listening to a person's voice. When you listen to an individual, you can understand each word. However, when you listen to a large group of people, distinguishing individual words becomes challenging, resulting in a monotonous noise.

In the trading context, this implies that the more sub-strategies are employed, the less volatile the final performance line will be. This is because the diversification of strategies tends to smooth out the performance curve, much like how many voices blend into a consistent sound.

Flattening of performance curve due to multiple strategies.png

While the ideal performance line is positive, it can also be negative or move sideways.

The key to enhancing the performance of an automated trading strategy lies in emulating the actions of a manual trader rather than blindly opening more and more trades in the hope of increasing output. This is precisely what the Expert Advisor Builder and Custom Expert Advisor are designed to do. Instead of focusing on a single automatic strategy that trades frequently, these applications aim to execute numerous smaller strategies that trade less frequently. To achieve this, two requirements must be met:

  • The ability to quickly change and test trading strategies
  • Access to a large tick data basis for extended backtesting

The necessity for the first requirement stems from the fact that the coding and testing of a trading strategy typically demand a significant investment of time. The complexity of the strategy directly influences the amount of effort required. For instance, a simple indicator-based strategy without stop-loss trailing takes a few hours to develop and test. However, more sophisticated strategies involving pattern analysis could take up to several months to implement and thoroughly test.

To address this, an abstract trading algorithm is implemented, capable of combining signals and filtering through a configuration-driven approach rather than a code-driven one. This means that instead of individually coding each sub-strategy, a single algorithm encompasses all signal and filter blocks. These blocks can be turned on or off as needed, allowing for the strategy to be recombined repeatedly. This approach significantly reduces the time and effort required to develop and test new strategies.

Given that this approach typically reduces the number of trades per sub-strategy, ensuring that the strategy test still yields statistically significant results is crucial. For a day trading strategy, it's recommended to backtest over a period that allows the trading systems to trade at least 100-150 times to assess long-term stability. This recommendation should also be applied to each sub-strategy, necessitating an extension of the test period. Instead of the 6-12 months typically used for a day trading strategy, the strategy should be tested over several years to yield statistically valid results.

This requirement is met by utilizing high-quality tick data in various spread configurations available for the past decade and more. While such data is typically challenging to find, the MT5 Tick Data provides convenient access to a comprehensive tick data database as a subscribable product. This ensures you have the data to conduct extensive and reliable backtesting for your trading strategies.

Practical implementation

While theory provides the foundation, practical implementation brings it to life. This section will guide you on using the Expert Advisor Builder with the Custom Expert Advisor to get to life trading systems with multiple sub-strategies. This allows for realizing dynamic and adaptable trading systems, enhancing their effectiveness and profitability.

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.

Previously, this approach was exclusively available to large funds and institutional entities. Now, it's accessible to everyone!

Concept diagram

As previously mentioned, the Expert Advisor Builder is based on a generic trading algorithm that can implement various trading strategies. For instance, a news trading strategy may not require any indicators, while a strategy based on the Moving Average Convergence Divergence (MACD) will undoubtedly need an indicator. The term generic here implies that not required modules are not computed. To achieve this, these modules must be able to be quickly turned on and off, ideally with a switch. However, the first step is to analyze which module blocks are necessary to create a universally applicable trading algorithm.

The Expert Advisor Builder concept diagram below represents the entire code base, from input parameters to the actual software implementation and testing.

Expert Advisor Builder concept diagram.png

A trade can be broken down into five stages: signal generation, signal filtering, order configuration, execution of the actual trade, and post-trade analysis. Each aspect of market analysis can be classified into one of these stages. It's important to note that while many signals can also function as filters, some filters can never serve as signals. For simplicity, most of these blocks are represented as signals in this diagram.

Each module in the concept diagram is abbreviated with a short identifier. For instance, the Events function block uses EVT, or the Fibonacci search uses FIS. These identifiers group the input parameters, and help identify which input parameters belong to which functional block. An input parameter only has an effect when the corresponding functional block is in use. A list of all input groups, organized by identifier, is available for reference. This system aids in maintaining organization and ensuring that each parameter is correctly applied.

Signal

Raw trading signals are the first step towards an automated trading system. These signals can be generated using a signal generator block. Various signal generators can be employed, including news events, indicators, oscillators, chart analyzers, candle search engines, pattern search engines, and Fibonacci search engines. Each signal generator has its unique signal generation method and can be freely combined with others.

By default, the Expert Advisor Builder does not enable any signal generator. To generate any signal, at least one signal generator must be activated. This is accomplished by enabling the Signal in use configuration of a functional block. All Signal in use input parameters and their effects are explained in the progress of this documentation.

A signal generator block can serve as either a signal or a filter, with the distinction between the two only sometimes being clear-cut. Generally, the function block that generates more raw signals in the native timeframe is considered the primary source, while the others act as filters. For instance, a MACD oscillator can generate numerous signals quickly, while an EMA 200 typically maintains its direction for an extended period, often acting as a filter.

All signal blocks can be freely combined. For example, a news event could temporarily turn off an indicator signal generator, or a chart analyzer could be used to filter candle search signals. Combining these elements is virtually limitless, offering a high degree of flexibility in creating trading strategies.

Filter

In practice, only two functional blocks act exclusively as filters: the timing and the inspector module. The timing filter restricts the trading hours or days. For instance, this filter can limit the trading module to operate only during specific times. This is particularly useful for covering different sessions in forex trading or enabling indices trading modules only when the actual reference market is open.

The inspector module continuously calculates the current performance and drawdown, which are the most critical metrics for determining the effectiveness of a trading strategy. Depending on the recent performance or drawdown, the inspector can turn off the entire trading module either permanently or temporarily. This feature is vital for modern automated trading systems as it fulfills the requirement of self-awareness, allowing the system to adapt based on its performance and drawdown.

Order

Once a signal successfully passes all filters, it is deemed a valid trading signal, typically prompting the initiation of a trade. The configuration of an order encompasses a broad range of aspects, including risk money management, the symbol, and timeframe for trading, general order configuration, initial stop loss and take profit, the trailing method for stop loss and take profit, the actual order type, and settings related to splitting a trade. The latter allows the risk of a trade to be divided into several smaller positions, each potentially having different stop loss and take profits. The Expert Advisor Builder offers many order parameters, far exceeding MetaTrader's standard options. This professional abstraction of order configuration enables the implementation of highly sophisticated trading features.

The so-called One trade mode order configuration is a unique form of signal filtering. Some trading modules may allow only one trade at a time, leading to the skipping of further signals deemed valid while a trade is already open. This feature simultaneously acts as an order configuration and filter.

Trade

Once a trade is opened, the trading algorithm continuously updates the inspected performance and drawdown, manages the trailing of limits, and adequately visualizes the trade in the chart window. However, beyond these functions, the market ultimately determines the outcome of the trade. This highlights the dynamic nature of trading, where algorithmic management and market conditions interact to shape the final result.

Result Data Management

Undoubtedly, the Expert Advisor Builder utilizes a multitude of input parameters. Even though, in most scenarios, only a few parameters need to be configured, keeping track while developing a new trading module can be challenging. To address this, a built-in feature helps to track every single test run in an output folder of your choice. A SET file containing all the input parameters is stored in your chosen output folder at the start of each test run. Within this folder, each test run is versioned and contains various output files, enabling the reproduction of any previously tested trading module.

The Expert Advisor Builder can generate a real-time trading journal and a statistic, in addition to capturing screenshots of each trade opening and closing. The output data can be processed in various ways post-analysis, for example, with a trading journal Excel file. Another option is to use it as input for a self-adapting feedback loop. However, it's important to note that this feature is not part of the currently released version of the Expert Advisor Builder.