Trading with the Momentum Transformer: An Intelligent and Interpretable
  Architecture
  Deep learning architectures, specifically Deep Momentum Networks (DMNs)
[1904.04912], have been found to be an effective approach to momentum and
mean-reversion trading. However, some of the key challenges in recent years
involve learning long-term dependencies, degradation of performance when
considering returns net of transaction costs and adapting to new market
regimes, notably during the SARS-CoV-2 crisis. Attention mechanisms, or
Transformer-based architectures, are a solution to such challenges because they
allow the network to focus on significant time steps in the past and
longer-term patterns. We introduce the Momentum Transformer, an attention-based
architecture which outperforms the benchmarks, and is inherently interpretable,
providing us with greater insights into our deep learning trading strategy. Our
model is an extension to the LSTM-based DMN, which directly outputs position
sizing by optimising the network on a risk-adjusted performance metric, such as
Sharpe ratio. We find an attention-LSTM hybrid Decoder-Only Temporal Fusion
Transformer (TFT) style architecture is the best performing model. In terms of
interpretability, we observe remarkable structure in the attention patterns,
with significant peaks of importance at momentum turning points. The time
series is thus segmented into regimes and the model tends to focus on previous
time-steps in alike regimes. We find changepoint detection (CPD) [2105.13727],
another technique for responding to regime change, can complement multi-headed
attention, especially when we run CPD at multiple timescales. Through the
addition of an interpretable variable selection network, we observe how CPD
helps our model to move away from trading predominantly on daily returns data.
We note that the model can intelligently switch between, and blend, classical
strategies - basing its decision on patterns in the data.
