# 7 Types of Trading Robustness: Build Robots That Weather All Storms

# Building the Invincible Robot

### So you heard about how computers will rule the trading world, how intelligent robots make millions in the markets, and now you want to build your owb all-powerful trading robot that can conquer all. Well, this article will not promise the magic formula or holy grail to your invincible robot, but it is as close as it gets.

### PS. Trading concepts mentioned here does not apply to high-frequency trading (trading in milliseconds).

Make your robots intelligent but not too intelligent.

## What does it mean to “Weather All Storms”

### In order for our trading systems to “weather all storms”, aka remain effective in different market conditions, they need to adapt to the market. This entails trading logic that are effective in different periods, backtesting frameworks that minimise backward-looking bias and rules that are not too rigid.

### This criteria can be summarised into one word: Robustness.

## What is Robustness

### Official Definition of *Robustness*: In economics, robustness is the ability of a financial trading system to remain effective under different markets and different market conditions, or the ability of an economic model to remain valid under different assumptions, parameters and initial conditions.

### To translate that into simpler words:

A trading system is robust if it can remain effective in changing market conditions

Coding, testing and evaluating trading robots these days is inexpensive.

## Types of Robustness

### Robustness seems to be an overused word. Many people talk about robustness in a trading system without specific reference to single type of robustness. There are many types of robustness, this article will talk about the main seven:

###
- Period Robustness
- Seasonal Robustness
- Timeframe Robustness
- Instrument Robustness
- Optimisation Robustness
- Parameter Robustness
- Portfolio Robustness

## Period Robustness

Definition:A trading system is robust across periods if it can remain effective in different market periods.

### Market Periods can be characterised into 2 types: Generic and Strategic.

**Generic Market Periods**

Figure 1: Six Generic Market Periods.

### Figure 1 shows us the six main generic market periods. In this case, we are analysing the performance of our trading systems in these six periods.

### However, do note that some generic market period tables are 5 by 5 or larger.

### 5 by 5 - Y axis: Very Low Volatility, Low Volatility, Neutral, High Volatility, Very High Volatility

### 5 by 5 - X axis: Strong Uptrend, Uptrend, Ranging, Downtrend, Strong Downtrend

### The 5 by 5 classification is just a variation of the original 2 by 3, but there is nothing wrong with the 5 by 5 or any larger classification.

### If our trading system is effective across the 6 basic periods, this means that it is period robust.

**Strategic Market Periods**

### Strategic Market Periods are defined by the trader. This depends on specific conditions that strongly influence the asset you are trading. Of course, these specific conditions vary for different assets.

### For instance, if we are trading EURUSD, the US Federal Reserve monetary policy will heavily influence our trading. Hence, we will analyse 2 strategic market periods: 1) Fed Easing 2) Fed Tightening. If you are trading equities, an example would be 1) Just before earnings release 2) Just after earnings release

**Application to Trading**

### Does this mean that if my trading system is not period robust, it is unprofitable?

### That is incorrect. There are plenty of trading systems that are designed to capture a specific market inefficiency. Our aim here is to understand our trading system’s characteristics so that we know how and when to deploy them.

## Seasonal Robustness

Definition:A trading system is seasonally robust if it is able to stay effective despite seasonal effects.

### Seasonal Robustness can be considered as a subset of Period Robustness.

### A seasonal effect is any market anomaly or economic effect which appears to be related to the calendar. We say that there exists seasonal effects in the market if there are repetitive behaviour in the markets across time. There are five main types of seasonal effects:

**Intra-Day Effect: **Specific behaviour of markets on certain times of the day.

**Day Effect: **Specific behaviour of markets on certain days of the week.

**Month Effect: **Specific behaviour of markets on certain months of the year.

**Quarter Effect: **Specific behaviour of markets on a quarterly basis.

**Multi-year Effect: **The term sometimes includes multi-year effects, such as the 10-year (decadal) cycle.

### In most cases, seasonal effects are not self-fulfilling prophecies. They are created by market fundamentals.

### For instance:

### 1) Forex markets are more active during certain times of the day because of global market overlaps.

### 2) January Effect exists because of tax reducing reasons.

### 3) Markets tend to be quieter on the earlier half of the first Friday of every month due to Non-Farm Payrolls.

Figure 2: Examining the January Effect. Credits: aboutsmallcap.com

**Application to Trading**

### Why don’t we exploit this recurring inefficiency? It is definitely possible, but there are several reasons this could be difficult:

###
- Timing and extent of seasonal effects are unstable

### Market participants are constantly trying to exploit seasonal effects. These actions influence the extent and behaviour of the seasonal effects. Therefore, this creates a dynamic situation where the seasonal effects are constantly changing.

###
- Cost of trade is too high

### The seasonal effect could exist because the cost to exploit the effect is too high. The high cost acts as a natural barrier to protect the seasonal effects.

###
- Effect is priced in

### We don’t believe the market is completely efficient, but we believe it is efficient to a certain extent. In many cases, it is difficult to exploit a seasonal effect because the efficiency is priced in. For instance, you may want to buy a straddle (an option structure that gains in value when volatility increases) during Non-Farm Payroll because you expect higher volatility. However, the sellers of the straddle have factored in the high volatility and thus priced this into the straddle price (option premiums).

## Timeframe Robustness

Definition:A trading system is timeframe robust if it is able to stay effective when trading in different timeframes.

### Timeframe refers to our candlestick period (1min, 5min, 15min, 1hour, Daily etc). Our trading system is timeframe robust if its underlying trading strategy is effective in different timeframes.

### We need to understand timeframe robustness in two types of market conditions:

### 1) Our asset behaves like a fractal across timeframes.

### 2) No fractal behaviour.

**Scenario 1: Our asset behaves like a fractal across timeframes**

### No we are not referring to the candlestick pattern when we talk about Fractals.

### Official Definition of *Fractals*: A fractal is a natural phenomenon or a mathematical set that exhibits a repeating pattern that displays at every scale. If the replication is exactly the same at every scale, it is called a self-similar pattern.

### To simplify it: A fractal is a pattern that repeats itself in different visuals or time scales.

Figure 3: Fractals in different timeframes

### As we zoom into the lower timeframes, we see that the shapes (characteristics) of the asset remains the same.

### Our trading system will always be timeframe robust when it is trading an asset that behaves as a fractal across timeframe. If the market behaves in the same manner at every timeframe, there should not be any difference in our trading system’s behaviour.

**Scenario 2: No fractal behaviour**

### A general rule of thumb is that noise (volatility) increases as we go to the lower timeframe. Our trading system will be timeframe robust here if its underlying logic is effective in spite of the different noise levels and market behaviour at different timeframes.

**Application to Trading**

### If our trading system is timeframe robust, it works at every timeframe. However, this does not mean that we remain indifferent to the timeframe we trade.

### We should trade on lower timeframe. This will maximise the number of trading opportunities per time. Imagine averaging 1 trade per 5 bars. If you trade on Daily timeframe, you will fire 52 trades a year (260 weekdays / 5). If you trade on 1 Hourly timeframe, you can fire 1248 (260 * 24 / 5) trades a year. Hence, your profit will be 24 times higher (without considering the effects of compounding!)

*Should we trade on the lowest possible timeframe?*

### Following the logic stated above, if we should trade on the lowest possible timeframe (1min for MT4), we should be massively profitable right? Sadly and unsurprisingly, no.

### It is unlikely for a trading system to be perfectly timeframe robust. It is unlikely for an asset to behave in a perfect fractal manner. As we go to lower timeframes, the noise increases. The asset’s behaviour becomes more unpredictable due to real-time influences from current events, market microstructure and speculation by market participants. Therefore, we should choose a timeframe that balances noise reduction and profit maximisation.

### If our trading system is not timeframe robust, we need to understand which timeframe is most suitable for our trading system in different market conditions.

## Instrument Robustness

Definition:A trading system is robust across instruments (assets) if it can remain effective across different instruments.

### A trading system is instrument robust if it performs as expected across different assets. This means that the trading system’s underlying trading logic is capturing an inefficiency that exist in multiple assets.

**Application to Trading**

### Instrument robustness is not a gauge of a trading system’s performance. In fact, most trading systems are not instrument robust. Trading systems are designed to capture specific market inefficiencies and these inefficiencies tend to be instrument specific. Thus, it is not unusual that most trading systems are not instrument robust.

### Instead of aiming for instrument robustness, we should understand how our trading systems work in different assets. This will allow us to discover common inefficiencies in different assets and deploy our portfolio of trading systems more effectively.

## Optimisation Robustness

Definition:A trading system is robust in optimisation if the trading system objective function is maximised while minimising curve fitting.

### Before we explain in detail what Optimisation Robustness is, let’s briefly understand what optimisation, objective function and curve fitting are.

**Optimisation**: The process where we adjust the structure and rules of a trading system to maximise or minimise its objective function.

**Objective** **Function**: This is the performance output of a backtest that we are trying to maximise or minimise.

### An easy (and lazy) way to choose an objective function is to use Net Profit. This is rarely a good idea. In trading, this output should consist of 3 things - reward, consistency and risk.

**Curve Fitting**: The process of catering the trading system so closely to historical data that it becomes ineffective in the future.

### Why? Because the future rarely reflects the past!

### Because the future rarely reflects the past, we need an optimisation process that minimises curve fitting. This will increase the odds of success of our trading system. A trading system going through such a process can be said to be optimisation robust.

**Application to Testing**

### This brings us to our solution – The Walk Forward Optimisation.

### Definition according to Wikipedia:

### The trading strategy is optimised with in-sample data for a time window in a data series. The remainder of the data are reserved for out-of-sample testing. A small portion of the reserved data following the in-sample data is tested with the results recorded. The in-sample time window is shifted forward by the period covered by the out-of-sample test, and the process repeated. At the end, all of the recorded results are used to assess the trading strategy.

### To translate into simpler words:

### We optimise our trading system using one period (in-sample), and apply the optimised parameters to the next period (out-of-sample). Repeat. The performance of the trading system is collated using all the out-of-sample periods.

Figure 4: In-sample and out-of-sample periods

### Steps:

### 1) Optimise trading system using In-Sample A

### 2) Test trading system’s performance in Out-Sample A

### 3) Optimise trading system using In-Sample B

### 4) Test trading system’s performance in Out-Sample B

### 5) Repeat for Period C to E

### 6) We will evaluate the trading system’s performance in Out-Sample A to E

### The aim of this process is to examine how will our trading system perform when executed in unknown territory (out-of-sample).

## Parameter Robustness

Definition: A trading system is parameter robust if its performance does not change drastically due to slight change in parameter values.

### If the underlying trading logic is sound, changing the parameter values slightly should not significantly affect its performance. If the performance changes drastically, the trading system exhibits signs of curve fitting.

**Application to Testing**

### The results of an optimisation can be viewed in an optimisation surface/parameter space (if we are only optimising two parameters). The x-axis and y-axis represents our two parameters. The z-axis represents our objective function.

Figure 5: Optimisation Surface with spiky peaks

Figure 6: Optimisation Surface with flat hills

### The two figures above represents the optimisation surface of a trading system that uses two parameters, a fast moving average and a slow one. When we examine this optimisation surface, we prefer flat hills over spiky peaks. Flat hills indicate little change in performance even if we shift the parameter values slightly.

## Portfolio Robustness

Definition:Portfolio Robustness occurs when a group of trading systems are able to remain effective in different market conditions.

### Portfolio Robustness and Period Robustness are different as Portfolio Robustness focuses on the complementary effects of separate trading systems. Different trading systems have different strengths and weaknesses. They can be combined in a way to maximise our objective function of the portfolio in the long run.

**Application to Trading**

### For illustration, assume we have two trading systems which are long term profitable but are negatively correlated to each other.

Figure 7: Net equity curve of a portfolio of two robots

### By combining these two trading systems, we are able to cancel out the risk in their performance and achieve a net long run positive result with significantly lower risk.

### By applying this concept to a portfolio of different trading systems, we aim to achieve Portfolio Robustness.

## Conclusion

### This article serves to briefly introduce the seven main types of robustness. However, in order to truly have a good grasp on building great trading systems, you need these three elements: Trading System Design, Coding for Algorithmic Trading and Market Knowledge. What’s next? Go Google these topics and get started!

###
**← Newer Post:** Impossible Trinity Of Position Sizing

## Not sure if Algorithmic Trading is for you?

## Join our prequel course

# AT100 - KWTG (Know-What-To-Google) Email Course

## 10 Lessons over 10 days via Email. Free.

*AlgoTrading101 is the first comprehensive online school on algorithmic trading. Learn the fundamentals of algo trading and put your ideas into action along with more than 25,000 students. Learn more about us at AlgoTrading101.*

Lucas has been designing and building algorithmic trading robots since 2010. He worked at a proprietary trading firm and taught programming for financial applications to Government of Singapore Investment Corporation (GIC), one of the largest sovereign wealth funds in the world. He runs this blog and the AlgoTrading101 course.