Commodity trading is inherently volatile, demanding strategies that can adapt and predict market movements with high precision. At Affor Analytics, we continually seek innovative ways to enhance trading strategies, and our latest approach leverages the power of Long Short-Term Memory (LSTM) networks combined with sentiment analysis. This strategy aims to provide more accurate predictions of commodity momentum, offering a significant edge in trading decisions.

Understanding the concept

The core of this strategy revolves around LSTM networks, a type of Recurrent Neural Network (RNN) designed to handle long-term dependencies in data. Traditional active traders rely heavily on momentum and technical indicators to decide when to enter or exit positions in commodity futures. Our approach enhances this by integrating a set of widely used momentum indicators with sentiment data from news articles.

Momentum scores, ranging from -1 to 1, are generated by the LSTM model to guide buy or sell decisions. These scores are derived from numerous technical indicators like the Relative Strength Index (RSI), Moving Average Convergence Divergence (MACD) lines, Average Directional Index (ADX), and the Stochastic Oscillator (SO). Each indicator captures historical price movements and trends, essential for predicting momentum in commodity futures.

Here’s a brief overview of the average hit rate of predicting the next open-to-open return using technical indicators for a set of commodity futures from 2010-2022:

ADX RSI SO PVO
Average 0.69 0.36 0.56 0.50
% Signals of total days 0.54 0.27 0.15 0.99

 

In addition to these technical indicators, sentiment data plays a crucial role. Using data from RavenPack, we analyze news articles to gauge public sentiment on commodities. This sentiment data is segmented into categories such as import, export, supply, and demand. For example, negative sentiment in export-related news might indicate potential price declines, while positive sentiment about inventory levels could signal price increases.


Delving deeper: how LSTM works

Long Short-Term Memory (LSTM) networks are adept at learning long-term dependencies and patterns in data, making them ideal for our strategy. Traditional RNNs often struggle with the vanishing gradient problem, which hampers their effectiveness in learning from data sequences where important information is spread out over time. LSTMs overcome this issue with a series of gates that control the flow of information, deciding what to remember and what to forget:

  • Forget gate: Decides which information from the previous cell state to discard.
  • Input gate: Determines which new information to add to the cell state.
  • Output gate: Selects the information to be passed on to the next step.

The image below illustrates the key components of an LSTM cell:

By feeding both momentum indicators and sentiment features into an LSTM network, we generate more accurate momentum scores. This ensures our model is both reactive and anticipatory, helping traders make better-informed decisions on when to enter or exit positions in commodity futures.

Practical application

Traders can apply this strategy by integrating LSTM-driven momentum scores into their trading decisions. By focusing on commodities with significant predicted movements, they can optimize their investment portfolios for solid returns. Our rudimentary implementation selects commodities with momentum scores larger than 0.1 and applies a maximum leverage of 3 to enhance returns while managing volatility. The weight allocation is determined using a linear approach based on the momentum scores, with more weight given to commodities demonstrating stronger momentum.

Using a model trained from 2000 to 2023 and backtested from January 2023 until November 2023, we observed the following results:

  • Total return: 28.04% (compared to -5.2% for the benchmark*)
  • Volatility (annualized): 33.08% (compared to 18.99% for the benchmark)
  • Max drawdown: -16.02% (compared to 14.79% for the benchmark)
  • Sharpe ratio: 0.85
  • Sortino ratio: 1.51
  • Calmar ratio: 1.13

* SP Commodity Index is used as benchmark

The strategy demonstrated resilience, recovering from drawdowns and achieving a total return of 28.04% over 2023. The inverse relationship between long and short returns indicates effective hedging within the strategy, keeping combined returns relatively stable and less volatile over the investment period. To mitigate volatility and drawdown, one could implement constraints on maximum weights for individual commodities, ensuring no single asset disproportionately impacts the portfolio. Additionally, a more advanced weight allocation can enhance risk management by diversifying exposures more effectively.

Benefits

This strategy offers several advantages, including improved predictive accuracy by integrating multiple momentum indicators into a single momentum score. By combining technical indicators and sentiment analysis, traders gain a more comprehensive view of market conditions, leading to more informed decisions.

Traditional momentum strategies often rely solely on historical price data, missing out on broader market sentiments. Our approach, which includes sentiment features, provides a more complete picture of market dynamics, potentially leading to better trading outcomes.

Conclusion

Combining LSTM-driven momentum scores with sentiment analysis presents a powerful approach to commodity trading. This strategy enhances predictive accuracy and offers a balanced view of market conditions, helping traders make better-informed decisions. In a market as volatile as commodities, having an edge through both technical and sentiment data can make all the difference. Leverage the power of machine learning and sentiment analysis to stay ahead.

Sign up to get notified about our latest insights