Share this Article & Support our Mission Alpha for Impact
This is some text inside of a div block.
This is some text inside of a div block.
This is some text inside of a div block.

A "factory" for tactical algorithms.

Post by 
Text Link
Some investors explain markets with fundamental data, others with technical instruments, and still others with behavioral effects. Many developers of systematic trading strategies, on the other hand, have a completely different idea - they see the markets as abstract, data-generating processes.

One path among many

It is no secret that markets are in different phases over time. In addition to the classic, calm bull market, there are volatile sideways phases, turbulent crashes and gruelling bear markets. Each of these phases ends at some point and passes over into a new regime. The characteristics of the individual phases also change over time, so that no market is identical to the previous version of itself. The individual players adapt and learn, and as a result, the markets evolve over time.

The challenge of developing permanently profitable algorithms under these constantly changing conditions is enormous. In his paper "Tactical Investment Algorithms", Marcos López de Prado explains the crucial problem: "We do not know the true process that generated the past data time series. All we have is one of many paths that could have developed. Therefore, simple back tests based on this one path alone are on shaky legs.

Better Backtests

In view of these challenges, are there any trading strategies that "always" work?  If de Prado has his way, the chances of that are slim - and even if they did exist, they probably wouldn't be outstanding.

However, this all-weather assumption is implicit in a test method that is particularly common in theory and practice: walk-forward analysis. At first glance, it may seem more mature than simple backtesting due to the inclusion of out-of-sample periods, but ultimately the two basic problems remain the same: The assumption that future observations are based on the same data generating process (DGP) as the past ones. And the assumption that the one observed path is actually representative of this process.

As de Prado writes in his paper, advanced test methods such as bootstrapping can be used to solve the problematic path dependency by resampling past values. But even here, according to de Prado, the problem of limited data history remains, which is not necessarily representative for future development.

Monte Carlo, the clear favorite

In his paper, de Prado favours the Monte Carlo method. Based on a given estimated DGP, this method simulates a large number of data sets whose statistical properties correspond to those of the DGP and which are overlaid with random noise. Unlike bootstrap resampling, for example, where the simulation is based on actually observed market data, the Monte Carlo method uses artificial data. As a classic example, the paper describes a regime switching model in which samples can be taken from different DGPs. A special algorithm is used to continuously estimate the probability that the DGP will switch to a new regime. A model parameterized in this way can then be optimized to match the statistical properties of the data actually observed. Based on these objectives, a large number of artificial data sets can be replicated, allowing for a much more comprehensive analysis than would be possible by resampling a limited and potentially unrepresentative data history.

In addition to the statistical properties, sound theoretical considerations can also contribute to a deeper understanding of the probable DGP. De Prado cites as an example two dynamic variables between which, according to accepted theories, a long-term equilibrium exists (cointegration). Empirical studies can be used to determine the approximate range of values that these variables can assume. Based on these inputs, it is possible to simulate many millions of years of artificial data in which the variables realize all possible values within the estimated bandwidth.

Is there a catch?

Normally, the fact that algorithms are tested with the Monte Carlo approach on the basis of artificial data is often criticized - this might not be meaningful for future data realized by DGP. But de Prado does not accept this criticism for two reasons. First, estimating a suitable DGP is not necessarily more difficult than a market forecast: anyone who is convinced that statistical methods enable successful investment results should also be convinced that these methods can be used to identify a DGP. Secondly, even with walk forward and resampling analyses, these observations are unlikely to occur exactly as simulated, so the synthetic paths generated with Monte Carlo are no less likely.

Monte Carlo back tests have the following advantages over walk forward and resampling analyses:

Randomized, controlled experiments can be performed based on an assumed DGP.
It is possible to define different tactical algorithms that are applied over time; statistical tools can determine the probability of these algorithms complying with the DGP.
Additional information can be integrated, for example from economic theories; this makes it possible to simulate the most probable scenarios - including those that have never occurred before (potential black swans).
The scope of the simulation can be extended as far as necessary to achieve a given level of statistical certainty.
The paradigm of an algo factory: A variety of tactical algorithms are created, of which only those that are selectively used that have qualified in the simulations for the current market environment. In other words: algorithms are traded instead of markets.
De Prado, M. L. (2019), Tactical Investment Algorithms

The factory for tactical algorithms

The classic walk forward and resampling analyses are based, as described, on the all-weather assumption that they will  "always" work if possible - i.e. independent of specific, more precisely defined DGP. This contradicts the fact that the market develops over time in different regimes in which it can be rationally expected that certain algorithms will work while others fail.

The Monte Carlo method, on the other hand, makes it possible to determine the sensitivity of an algorithm to the specific characteristics of different, defined DGPs. From this it can be deduced which features determine success. Accordingly, the algorithm can be used whenever it is tactically advantageous.

From this, de Prado derives the paradigm of an algo factory: A variety of tactical algorithms are created, of which only those that are selectively used that have qualified in the simulations for the current market environment. In other words: algorithms are traded instead of markets. The advantage is that it is much easier to estimate which DGP is currently determining the market than to find an algorithm that "always" works, i.e. for all possible DGPs.

The paper describes the process as follows:

Development of a variety of tactical algorithms for a wide range of DGPs using Monte Carlo simulations.
Selection of a sample of the latest market development.
Using statistical tests to estimate the probability that each DGP examined could have produced this sample; even with comparatively small samples, most DGPs can often be excluded.

The result of this process is a probability distribution that can be used to assign the available exposure to the appropriate algorithms. This means that not only the one strategy that is assessed as optimal is used, but also a selection of the probable best ones. This has the advantage that the exposure dynamically adapts to potential changes in the DGP over time as this process is applied continuously.


Monte Carlo backtests enable algorithms to be tested and developed under controlled conditions as in a laboratory. This approach comes closest to the scientific ideal that we know from physics, for example. The simulations can be understood as a kind of performance certification that obtains algorithmic strategies for very specific market conditions. Therefore, these strategies should only be used if the right conditions are present with a sufficiently high probability. Conversely, conditions can be defined under which an algorithm is particularly vulnerable and should not be used. This makes it possible to exchange a strategy before it loses a lot of money.

De Prado, M. L. (2019), Tactical Investment Algorithms, True Positive Technologies

Would you like to use this article - in full or in part - for your purposes? Then please consider the following Creative Commons-Lizenz.