Data Collection and Preprocessing — Feature Engineering (Creating Custom Features Relevant to Trading)

TechwithJulles
3 min readDec 27, 2023

--

Introduction

Feature engineering is the process of creating new features or transforming existing ones to better capture relevant patterns in the data. In trading, effective feature engineering can help improve the performance and accuracy of neural network models. In this article, we will discuss various feature engineering techniques that can be applied to trading data to create custom features for use in neural network models.

Feature Engineering Techniques for Trading

Technical Indicators

Technical indicators are mathematical calculations based on historical price and volume data, used to analyze trends and make trading decisions. Creating features based on technical indicators can help neural networks identify patterns in the data that may be indicative of future price movements. Common technical indicators include:

  • Moving averages (simple, exponential, weighted)
  • Relative strength index (RSI)
  • Moving average convergence/divergence (MACD)
  • Bollinger Bands
  • Stochastic oscillator

Lagged Variables

Lagged variables are created by shifting the data points of a time series by a specified number of periods. These variables can help capture the temporal dependencies in time series data and allow neural networks to learn from past observations. For example, you can create lagged variables for price, volume, or technical indicators to capture their historical values.

Price-Based Features

Price-based features are derived from the historical price data and can help capture various aspects of price movements. Examples of price-based features include:

  • Price change (absolute or percentage)
  • Price volatility (standard deviation or average true range)
  • Price momentum (rate of change or price differences)
  • Price patterns (candlestick patterns, chart patterns)

Sentiment Analysis

Sentiment analysis involves processing textual data, such as news articles, social media posts, or analyst reports, to gauge market sentiment. By extracting sentiment scores or other relevant information from text data, you can create features that help neural networks identify the impact of market sentiment on asset prices. Common sentiment analysis techniques include:

  • Lexicon-based methods (using predefined dictionaries of positive and negative words)
  • Machine learning-based methods (training classifiers on labeled text data)
  • Deep learning-based methods (using pre-trained models like BERT or GPT for sentiment classification)

Macro-Economic Features

Macro-economic features capture the broader economic environment and can help neural networks account for external factors that influence asset prices. Examples of macro-economic features include:

  • Interest rates
  • Inflation rates
  • Gross domestic product (GDP) growth
  • Unemployment rates
  • Economic policy announcements

Conclusion

Feature engineering plays a crucial role in improving the performance and accuracy of neural network models in trading applications. By creating custom features based on technical indicators, lagged variables, price-based factors, sentiment analysis, and macro-economic data, you can help your neural network models better capture the underlying patterns in the data. As you progress through the lessons, you will learn how to apply these feature engineering techniques to various trading applications, such as price prediction, trading signal generation, and portfolio optimization.

If you enjoyed this article and would like to show your support, feel free to buy me a coffee! Your support is greatly appreciated and it helps me continue creating content that you love. You can make a contribution by following this link: Buy Me a Coffee. Thank you for your generosity and for being a part of this journey!

--

--

TechwithJulles

I'm a software developer who enjoys teaching people about programming and the tech world. #TechWithJulles