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

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

Permutations in Europe: What’s still at stake in final weeks of season?

There’s still plenty to play for across Europe as we head into the final matches of the club season. Here are all the title races, Champions League fights, and relegation battles left to be decided in the top leagues this month. This story will be updated until the end of the campaign. 👉 Jump to:EPL

Brewing a Better Half-Gallon Batch

Today I finally ran an experiment I’ve wanted to try for a long time. If you’re a professional barista—or you run a busy café—this may save you some time. Most coffee shops use 1–1.5 gallon batch brewers (Bunn, Curtis, Fetco, etc.). When I opened Short Sleeves Coffee, I intentionally avoided brewing full 1-gallon batches. I

5 Frozen Breakfasts Chefs Say Keep You Full All Morning

Chef-approved frozen breakfasts with more protein and better ingredients. Eating a healthy breakfast every morning is a great way to start the day, but most people don’t have time to cook. Whether you’re rushing out the door in the morning for work, taking the kids to school or both, there’s usually not much time in

CA scales back plan to ban student use of cell phones

By Carolyn Jones, CalMatters This story was originally published by CalMatters. Sign up for their newsletters. Until last month, California was poised to join nearly a dozen other states that ban cell phones in K-12 schools. But under pressure from school boards and administrators, lawmakers scaled back a bill that would have required such a

BulkQuant Launches AI Trading Bot for Crypto, Forex, and Stock Markets

BulkQuant Launches AI Trading Bot for Crypto, Forex, and Stock Markets

London, United Kingdom, May 15, 2026 (GLOBE NEWSWIRE) — BulkQuant has officially launched its AI trading bot platform designed for crypto, forex, and stock market traders seeking a simpler way to automate trading strategies across multiple financial markets. The platform combines AI-powered quantitative analysis, automated trade execution, portfolio monitoring, and adaptive risk management into a

IMF lauds resilient Hong Kong economy but warns of risks linked to Middle East war

IMF lauds resilient Hong Kong economy but warns of risks linked to Middle East war

The International Monetary Fund (IMF) has lauded the resilience of Hong Kong’s economy, noting a sustained recovery despite economic activity having yet to return to pre-Covid levels, while warning of downside risks stemming from escalating geopolitical tensions. It also urged Hong Kong to pursue medium-term financial reforms, including the introduction of a goods and services

Smithsonian Presidents Exhibit Reopens With Low-Key Trump Impeachment Mention

For the past year, the Smithsonian Institution has found itself in the awkward position of telling the nation’s story while being supported in part by a government that wants to narrow how that story is told. In December, the White House threatened to revoke funding to the institution if it did not hand over a

Marvel’s Daredevil Follow-up Is Already Dominating on Streaming

A follow-up to Daredevil: Born Again Season 2 on Disney+ has become a massive streaming success within days of its launch. The Punisher: One Last Kill has quickly climbed to the top of multiple charts, beating out other titles on the platform. The MCU television special follows the gun-toting vigilante, who finds himself targeted by

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

6 bids for Hong Kong land sale signal renewed confidence despite market caution

6 bids for Hong Kong land sale signal renewed confidence despite market caution

The Hong Kong government’s first land sale in the current financial year has drawn six bids, according to the Development Bureau, including those from the city’s largest developers, suggesting a more confident outlook for the residential property market. At the close of tender for Tung Chung Town Lot No 54 at Area 106A on Friday

Each Premier League team reranked: Man City rise; Chelsea, Liverpool collapse

Ryan O’Hanlon Close Ryan O’Hanlon ESPN.com writer Ryan O’Hanlon is a staff writer for ESPN.com. He’s also the author of “Net Gains: Inside the Beautiful Game’s Analytics Revolution.”  and  Bill Connelly Close Bill Connelly ESPN Staff Writer Bill Connelly is a writer for ESPN. He covers college football, soccer and tennis. He has been at

Trump departs China after two-day summit

Trump departs China after two-day summit

IE 11 is not supported. For an optimal experience visit our site on another browser. Trump Wraps China Summit With Xi Jinping: What Are the Results? 05:41 Xi gives Trump rare tour of secret garden at heart of Chinese government 01:04 Now Playing Trump departs China after two-day summit 01:01 UP NEXT Special Report: Trump

Carol Chow was facing a bankruptcy petition by five people over unspecified debts at the time of her death. Photo: Dickson Lee

Embattled Hong Kong developer sued for HK$130 million, days after founder’s death

A Hong Kong property developer has been sued for HK$130 million (US$16.6 million) over allegedly breaching guarantor obligations in two bond subscription agreements, becoming the latest lawsuit to implicate the embattled company and following its founder’s sudden death earlier this week. Lofter Group, known for its urban renewal projects across the city’s core districts, and

Trump’s China visit left chip export issue unresolved

This report is from this week’s The Tech Download newsletter. Like what you see? You can subscribe here. One look at the roster of U.S. execs that cozied up to U.S. President Donald Trump on the 20+ hours flight from Alaska to China on Wednesday and you get a sense of the American delegation’s key focus

Why the Cerebras IPO matters for the AI race with China

Why the Cerebras IPO matters for the AI race with China

Cerebras, an AI chipmaker, saw its shares nearly double on Nasdaq, closing up 70% with a $95B market cap. Cerebras’s powerful chips are key in the US-China AI tech race. Chris Buskirk, co-founder and chief investment officer of 1789 Capital, a key Cerebras investor, says the company’s IPO is geopolitically significant. On Thursday, shares of

Fitbit Air vs Whoop Strap Comparison: Price, Features and AI

The Google Fitbit Air is very much the talk of the fitness tracking town right now, not only because it’s the first new Fitbit device that we’ve had in years, but it’s also one of the first big brands to go head-to-head with the established Whoop Strap (if you don’t count the Polar Loop and

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