Regression-based macro trading signals

Jupyter Notebook

Regression is one method for combining macro indicators into a single trading signal. Specifically, statistical learning based on regression can optimize model parameters and hyperparameters sequentially and produce signals based on whatever model has predicted returns best up to a point in time. This method learns from growing datasets and produces valid point-in-time signals for backtesting. However, whether regression delivers good signals depends on managing the bias-variance trade-off of machine learning. This post provides guidance on pre-selecting the right regression models and hyperparameter grids based on theory and empirical evidence. It considers the advantages and disadvantages of various regression methods, including non-negative least squares, elastic net, weighted least squares, least absolute deviations, and nearest neighbors.

(more…)

Optimizing macro trading signals – A practical introduction

Jupyter Notebook

Based on theory and empirical evidence, point-in-time indicators of macroeconomic trends and states are strong candidates for trading signals. A key challenge is to select and condense them into a single signal. The simplest (and often successful) approach is conceptual risk parity, i.e., an equally weighted average of normalized scores. However, there is scope for optimization. Statistical learning offers methods for sequentially choosing the best model class and other hyperparameters for signal generation, thus supporting realistic backtests and automated operation of strategies.
This post and an attached Jupyter Notebook show implementations of sequential signal optimization with the scikit-learn package and some specialized extensions. In particular, the post applies statistical learning to sequential optimization of three important tasks: feature selection, return prediction, and market regime classification.

(more…)

Nowcasting macro trends with machine learning

Nowcasting economic trends can make use of a broad range of machine learning methods. This not only serves the purpose of optimization but also allows replication of past information states of the market and supports realistic backtesting. A practical framework for modern nowcasting is the three-step approach of (1) variable pre-selection, (2) orthogonalized factor formation, and (3) regression-based prediction. Various methods can be applied at each step, in accordance with the nature of the task. For example, pre-selection can be based on sure independence screening, t-stat-based selection, least-angle regression, or Bayesian moving averaging. Predictive models include many non-linear models, such as Markov switching models, quantile regression, random forests, gradient boosting, macroeconomic random forests, and linear gradient boosting. There is some evidence that linear regression-based methods outperform random forests in the field of macroeconomics.

(more…)

Pure macro FX strategies: the benefits of double diversification

Jupyter Notebook

Pure macro(economic) strategies are trading rules that are informed by macroeconomic indicators alone. They are rarer and require greater analytical resources than standard price-based strategies. However, they are also more suitable for pure alpha generation. This post investigates a pure macro strategy for FX forward trading across developed and emerging countries based on an “external strength score” considering economic growth, external balances, and terms-of-trade.

Rather than optimizing, we build trading signals based on the principles of “risk parity” and “double diversification.” Risk parity means that allocation is adjusted for the volatility of signals and returns. Double diversification means risk is spread over different currency areas and conceptual macro factors. Risk parity across currency signals diminishes vulnerability to idiosyncratic country risk. Risk parity across macroeconomic concepts mitigates the effects of the seasonality of macro influences. Based on these principles, the simplest pure macro FX strategy would have produced a long-term Sharpe ratio of around 0.8 before transaction costs with no correlation to equity, fixed income, and FX benchmarks.

(more…)

Finding (latent) trading factors

Financial markets are looking at a growing and broadening range of correlated time series for the operation of trading strategies. This increases the importance of latent factor models, i.e., methods that condense high-dimensional datasets into a low-dimensional group of factors that retain most of their underlying relevant information. There are two principal approaches to finding such factors. The first uses domain knowledge to pick factor proxies up front. The second treats all factors as latent and applies statistical methods, such as principal components, to a comprehensive set of correlated variables. A new paper proposes to combine domain knowledge and statistical methods using penalized reduced-rank regression. The approach promises improved accuracy and robustness.

(more…)

Testing macro trading factors

The recorded history of modern financial markets and macroeconomic developments is limited. Hence, statistical analysis of macro trading factors often relies on panels, sets of time series across different currency areas. However, country experiences are not independent and subject to common factors. Simply stacking data can lead to “pseudo-replication” and overestimated significance of correlation. A better method is to check significance through panel regression models with period-specific random effects. This technique adjusts targets and features of the predictive regression for common (global) influences. The stronger these global effects, the greater the weight of deviations from the period-mean in the regression. In the presence of dominant global effects, the test for the significance of a macro factor would rely mainly upon its ability to explain cross-sectional target differences. Conveniently, the method automatically accounts for the similarity of experiences across markets when assessing the significance and, hence, can be applied to a wide variety of target returns and features. Examples show that the random effects method can deliver a quite different and more plausible assessment of macro factor significance than simplistic statistics based on pooled data.

(more…)

Detecting trends and mean reversion with the Hurst exponent

The Hurst exponent is a statistical measure of long-term memory of time series. The existence and form of such memory are of great interest in financial markets, as financial returns are not generally governed by random walks.
The Hurst exponent is a single scalar value that indicates if a time series is purely random, trending, or rather mean reverting. Thus, it can validate either momentum or mean-reverting strategies. The Hurst exponent uses the variance of a log price series to assess the rate of diffusive behavior. If a time series follows a random walk, its variance simply increases linearly with time elapsed. If instead variance increases with time to the power of an exponent, then a low (Hurst) exponent would indicate mean reversion and a high exponent trending behavior. The Hurst exponent depends on the period used for return calculation. For example, monthly returns can display a memory that is different from daily returns.
The Hurst exponent is estimated rather than calculated. Most methods regress rescaled ranges of the return series on the time span of observations. Code examples are available for Python and R.

(more…)

Identifying the drivers of the commodity market

Commodity futures returns are correlated across many different raw materials and products. Research has identified various types of factors behind this commonality: [i] macroeconomic changes, [ii]  financial market trends, and [iii] shifts in general uncertainty. A new paper proposes to estimate the strength and time horizon of these influences through mixed-frequency vector autoregression. Mixed-frequency Granger causality tests can assess the interaction of monthly, weekly, and daily data without aggregating to the lowest common frequency and losing information. An empirical analysis for 37 commodity futures from all major sectors, based on mixed-frequency Granger causality tests,  suggests that macroeconomic changes are the dominant common driver of monthly commodity returns, while financial market variables exercise commanding influence at a daily frequency.

(more…)

Identifying market regimes via asset class correlations

A recent paper suggests identifying financial market regimes through the correlations of asset class returns. The basic idea is to calculate correlation matrixes for sliding time windows and then estimate pairwise similarities. This gives a matrix of similarity across time. One can then perform principal component analysis on this similarity matrix and extract the “axes” of greatest relevance. Subsequently, one can cluster the dates in the new reduced space, for example by a K-means method, and choose an optimal number of clusters. These clusters would be market regimes. Empirical analyses of financial markets over the last 20-100 years identify 6-7 market regimes.

(more…)

Transaction costs and portfolio strategies

Transaction costs are a key consideration for the development of trading strategies; and not just in final profitability checks. Indeed, disregard for trading costs at the design stage leads to excessive reliance on fleeting small-scale characteristics for return predictors. It also skews the conventional efficient frontier of portfolio choice towards risky trading strategies. A realistic implementable efficient frontier would penalize risky strategies for trading costs, which in turn depend on the size of the risky strategy allocation. This is particularly important for portfolios with large assets under management whose rebalancing has a large market impact. For the development of algorithmic trading strategies with machine learning, it can be highly beneficial to integrate transaction costs into the learning process. A recent paper proposes a “portfolio machine learning method” to that end.

(more…)