Deep-learning-based stock market prediction incorporating ESG sentiment and technical indicators

This section describes the experimental flow. First, data were collected for the experiment. Subsequently, preprocessing was performed to eliminate irrelevant textual data. Third, technical indicators were derived from the S&P 500 dataset, with sentiment scores generated from ESG-related news data. After combining the processed data, the scaled data were adjusted as input data for the deep learning models to forecast future prices. Lastly, MAPE was employed as the assessment measure for regression performance. In addition, ablation tests were performed to evaluate the effectiveness of each input feature. The experimental procedure is illustrated in Fig. 1.

Figure 1

Flowchart for predicting S&P 500 index.

Data collection

The S&P 500 index is used to grasp and monitor the overall trends of the stock market and is considered one of the indicators representing the health of the United States’ financial markets26. The S&P 500 represents an index 500 major U.S. companies, it reflects market-wide movements rather than individual company stock prices. In addition, the S&P 500 includes companies from a variety of industries and sectors. Therefore, constructing a stock price prediction model including data from various industries is equivalent to designing a generalized model with versatility. Moreover, while stocks of individual companies must also consider the influence of internal factors, the S&P 500 is influenced by the overall market perception27. Consequently, building an enhanced stock price prediction model by integrating ESG information and the S&P 500 can underscore the significance and impact of sustainability information across the market to investors and relevant researchers.

The experiments were conducted by gathering two datasets spanning from January 1, 2016, to July 31, 2023. Through LexisNexis, the authors accessed and collected a collection of 14,049 news articles using the search term “ESG.” Access to the LexisNexis database may require a paid subscription, such as institutional access. Additionally, historical data on the S&P 500 index, containing information such as date, closing value, opening value, high value, low value, trading volume, and volatility, for the same time periods were sourced from investing.com.

Feature engineering

Based on previous research, the authors obtained various technical indicators that have been shown to impact stock prices using the TA-lib module28,29. The chosen features were opening price, closing price, high price, low price, trading volume, RSI, SMA_5, SMA_20, EMA, MACD, signal, Stochastic RSI_fastk, Stochastic RSI_fastd, Stochastic Oscillator Index_slowk, Stochastic Oscillator Index_slowd, stochastic oscillator index_slowd, WilliamR, Momentum, and ROC. Detailed descriptions of these technical indicators are provided below.

The opening price is the price of a stock at the beginning of a trading session and indicates the first transaction made for the day. High prices represent the highest value of a stock trade within a specific trading period, whereas low prices signify the lowest. Trading volume, which reflects market activity, is the number of shares or contracts traded during a specific period.

The RSI is a momentum oscillator that measures the speed and change in price movements and helps identify overbought or oversold conditions. SMAs are average closing prices over a specified number of periods. For instance, SMA_5 and SMA_20 represent the 5-day and 20-day moving averages, respectively. The EMA responds better to recent price changes by assigning more weight to them30.

MACD is a momentum indicator that follows trends by illustrating the interaction between two moving averages of a security’s price. Signal lines, i.e., the moving averages derived from MACD lines, play an important role in generating valuable buy-and-sell signals for traders and investors31.

Stochastic RSI_fastk and Stochastic RSI_fastd computed based on both the RSI and stochastic oscillator effectively grasp potential points of price reversal and enhance the accuracy of predictions32. To ensure smoothness, the stochastic oscillator indices_slowk and stochastic oscillator indices_slowd were considered supplementary components of the stochastic oscillator.

Another integral aspect of the analysis was William’s %R, commonly referred to as Williams R. This momentum indicator assesses whether market conditions indicate overbought or oversold scenarios, thereby contributing to a comprehensive understanding of market sentiment33.

Next indicators employed is momentum. The concept of momentum can be used to measure the rate of price change. Momentum provides insights into the rate at which prices change by quantifying the rate of change in stock prices. Finally, the ROC, a metric similar to momentum, involves calculating changes in prices over a specific period, providing insights into the extent of price fluctuations34.

Sentiment index calculation using financial bidirectional encoder representations from transformers (FinBERT)

Preprocessing including stopwords removal and lemmatization was conducted on the news data, followed by sentiment analysis using FinBERT. FinBERT is built upon the BERT architecture, which is an effective language model for natural language processing and understanding by encoding text by considering context bidirectionally35. FinBERT specializes in domain knowledge by retraining BERT’s pretrained model with financial data. FinBERT takes financial-related texts such as financial news, reports, and web posts as inputs, and analyses and predicts the sentiment of the text, categorizing it as either positive, negative, or neutral.

The scores in the data were labeled 0 for negative sentiments and 1 for positive sentiments (Eq. (1)). Referring to a study by Wu et al.36, sentiment measurements were calculated as the difference between the number of negative and positive posts in a specific dataset.

$$Sentiment\, score=\frac{{M}_{tpos}-{M}_{tneg}}{{M}_{tpos}+{M}_{tneg}}$$

(1)

where \({M}_{tpos}\) represents the number of positive news articles and \({M}_{tneg}\) represents the number of negative articles on day t. The range of values for the sentiment index was between −1 and 125. If the sentiment index value approaches −1, it suggests a negative tone in the news for that date. Conversely, if it approaches 1, it indicates an overall positive tone in the news. Before employing the selected features as input to the framework, a min–max scaler was applied to standardize the range of these values between 0 and 1.

Window size

Subsequently, multiple datasets are generated, each corresponding to a distinct hyperparameter window. Window size is a fundamental concept in stock price predictions for processing and predicting time-series data37,38. The window size defines a fixed unit period, with the data within this window used to predict future stock prices. Therefore, selecting an appropriate window size is crucial to improving the performance of stock price prediction models. In this study, experiments were conducted using three window sizes: 3, 4, and 5 (Fig. 2). Finally, the training and test datasets were split at an 8:2 ratio. The validation dataset comprises 20% of the training dataset.

Figure 2
figure 2

Window size illustration.

Deep learning models

Bidirectional recurrent neural networks (Bi-RNN) are a type of recurrent neural network capable of considering both the preceding and subsequent contexts of a sequence. This bidirectional characteristic enables them to capture patterns in different temporal directions39. Moreover, since short-term factors can influence the fluctuation in stock prices, the RNN structure with recurrent layers is adept at capturing these changes, rendering it suitable for application as a time series model. Additionally, Bi-RNN has a flexible structure that can be applied to various types of time series data, making it useful for processing patterns. By contrast, bidirectional long short-term memory networks (Bi-LSTM) represent an enhanced iteration of RNNs that incorporate LSTM cells40. They excel at learning long-range dependencies and are particularly effective in tasks involving sequential data, such as time-series forecasting41.

Source link

Visited 1 times, 1 visit(s) today

Related Article

See Which Recent 13F Filers Hold TSLA But Boussard & Gavaudan Investment Management, Wright Wealth, Lombard Odier Asset Management USA, Carret Asset Management, Coppell Advisory Solutions and Deltroit Asset Management UK Exited

At Holdings Channel, we have reviewed the latest batch of the 111 most recent 13F filings for the 03/31/2026 reporting period, and noticed that Tesla Inc (Symbol: TSLA) was held by 31 of these funds. When hedge fund managers appear to be thinking alike, we find it is a good idea to take a closer

Stock trade disclosure reveals Trump made massive gains on Big Tech bets

Donald Trump’s latest financial disclosure has opened an unusually detailed window into the scale and pace of trading activity tied to the US president’s investment portfolio. The filing, submitted on Thursday to the US Office of Government Ethics through two OGE Form 278-T reports, disclosed more than 3,600 transactions executed between January and the end

Nvidia’s trillion-dollar run puts pressure on the bulls

BEIJING, CHINA – MAY 14: Nvidia CEO Jensen Huang (C) gestures as he prepares to depart following a welcome ceremony at the Great Hall of the People on May 14, 2026 in Beijing, China. President Trump is meeting with President Xi Jinping in Beijing to address the Iran conflict, trade imbalances, and the Taiwan situation

Is Now a Bad Time to Invest?

The market has been on a roll lately, with the S&P 500 (SNPINDEX: ^GSPC) setting new highs throughout May. If you think you missed your opportunity when the market bottomed in late March, don’t fret. The market hitting new all-time highs is not particularly rare and should not change your investment strategy. And if you

If I Could Tell All Investors 1 Thing About the Stock Market Right Now, It’s This

The past year has been a confusing one for many investors, as the stock market has been sending mixed signals. Despite persistent recession warnings, surging inflation, and the war in Iran disrupting global supply chains, major market indexes are thriving. The S&P 500 (^GSPC +0.77%) has delivered total returns of around 33% over the last

50 Years of Stock Market Returns

 A reader asks: I was doing my net worth over the last year, and found this to be very interesting. I asked AI if the last year return of the S&P 500 of 30.6% is one of the biggest. It was not, most likely #7 or #8. Either way, this is rarified air here,

Stock Market Today, May 14: Cisco Systems Surges After Blowout Earnings and Raised Guidance

Today’s Change (13.38%) $13.63 Current Price $115.50 Key Data Points Market Cap $402B Day’s Range $113.98 – $119.35 52wk Range $62.30 – $119.36 Volume 3M Avg Vol 22M Gross Margin 63.97% Dividend Yield 1.62% Cisco Systems (CSCO +13.38%), a networking and communication technology solutions provider, closed Thursday at $115.53, up 13.41%. The stock is rallying

The Best Stocks to Buy Right Now on Sale

Success in the stock market isn’t complicated. The occasional bouts of volatility can make it feel challenging, but it comes down to patiently owning shares of a great business with a long runway for growth. The companies below have delivered market-beating returns over the past decade, and their recent pullbacks could be a gift for

Here’s Why I’d Sell Nebius Stock and Buy Astera Labs Instead

Nebius Group (NBIS +6.57%) sits at the center of every artificial intelligence (AI) hype checklist right now: graphics processing unit (GPU) cloud, hyperscaler partnerships, an Nvidia investment, and a stock that has multiplied in value over the last six months. The issue isn’t the story itself; it’s that investors now have to pay the valuation the

The 60/40 Portfolio Is Flatlining: Alternatives Can Revive It

(Image credit: Getty Images) For more than six decades, the 60/40 portfolio, comprised of 60% equities and 40% fixed income, served as the baseline for retirement planning. Its success was built on the inverse correlation between stocks and bonds: When equities faced volatility, bonds typically provided a stabilizing cushion. However, recent market shifts have exposed

Here’s Why Micron Can Reach a $1 Trillion Market Cap This Year

Micron‘s (NASDAQ: MU) positioning in the AI build-out and recent results have put it on course for a benchmark that would have been inconceivable last year. The maker of memory chips has a real shot at surpassing a $1 trillion market cap this year. A 150% year-to-date rally has helped, but the stock’s gains are

Why Nextpower Stock Rocked the Market Today

Nextpower (NXT +4.76%) was providing its investors with some powerful gains on Wednesday. Those folks traded the solar infrastructure company’s sock up by over 9% that day. That followed its release of estimates-crushing fiscal fourth quarter results, combined with the announcement of a fresh acquisition. A fine fiscal year Nextpower would have attracted attention simply

Property market slumps despite new stock highs

LITTLE APPETITE: Weak demand and rising unsold inventory has caused developers to step back from large-scale projects with amplified risk, an expert said By Crystal Hsu / Staff reporter Taiwan’s cooling housing market is diverging sharply from the buoyant stock market, as tighter mortgage restrictions and government measures aimed at curbing speculation weigh on buyer

Should You Buy Bloom Energy Stock While It’s Below $300?

Bloom Energy (BE +5.79%) is a clean energy company making large, box-shaped power generators that let businesses generate their own electricity instead of buying it from the grid. It essentially gives companies their own mini power plant that keeps the lights on even if the larger grid goes out. Bloom’s technology is gaining momentum right

Tech stocks rally rolls on as US-China talks underway

US President Donald Trump at a welcome ceremony with China’s President Xi Jinping at the Great Hall of the People in Beijing (Brendan SMIALOWSKI) · Brendan SMIALOWSKI/AFP/AFP European and US stock markets climbed Thursday as a tech-fuelled rally rolled on even as the United States and China were locked in talks in Beijing, accompanied by

0
Would love your thoughts, please comment.x
()
x