1. Introduction
Forecasting stock price movements is vital for effective investment decision making and risk management, yet it remains inherently challenging due to the complexity and volatility of financial markets [
1]. Traditional financial theories, such as the Efficient Market Hypothesis (EMH) [
2], argue that stock prices fully reflect all available information, suggesting limited potential for accurate prediction. However, increasing empirical evidence [
3,
4,
5] shows that certain price movements exhibit recurrent patterns and predictive signals, higighting the need for more advanced models that can effectively capture these underlying structures.
Among practical forecasting approaches, technical analysis based on rule-based chart patterns—such as Head-and-Shoulders/Inverse Head-and-Shoulders (HS/IHS), broadening tops and bottoms (BTOP/BBOB), triangle tops and bottoms (TTOP/TBOT), rectangle patterns, and double tops/bottoms (DTOP/DBOT) [
6]—has been widely used in real-world trading. However, existing chart-based forecasting methods typically rely on predefined chart patterns, using traditional patterns as direct prediction inputs or by identifying specific chart formations, thus limiting their generalizability. Furthermore, although recent advances have employed deep learning and image recognition (e.g., CNNs) on candlestick chart images to improve generalization [
7,
8], these models require image-based inputs instead of raw numerical data and often entail high computational costs.
This study aims to address the following central research question: Can we develop a rule-based yet flexible forecasting framework that avoids reliance on predefined chart templates, operates directly on numerical data, and retains interpretability with low computational costs?
To this end, we propose a novel method—Rising Visibility Graph with Weisfeiler–Lehman kernel (RVGWL)—that inherits the interpretability of rule-based chart analysis while overcoming its rigidity. By transforming financial time series into structured graphs and evaluating graph similarity via the WL kernel, our method captures implicit recurring trend structures in a computationally efficient manner without requiring large-scale training or predefined patterns.
The key contributions of this study are summarized as follows:
Our method overcomes the limitations of conventional rule-based methods by moving beyond a fixed set of predefined visual templates. Our approach enables the recognition of emerging or previously unseen trend structures, allowing for more flexible and generalizable pattern detection in stock price movements.
Our method introduces a quantifiable similarity measure between historical and current patterns by leveraging graph-based representations. This allows for the objective evaluation of structural resemblance, facilitating more precise trend forecasting.
Our approach provides a low-computational-cost alternative to machine learning models, avoiding the need for extensive training, hyperparameter tuning, or large labeled datasets, while still capturing essential structural information in financial time series.
The remainder of this paper is structured as follows.
Section 2 presents a review of the relevant literature on technical chart patterns and graph-based modeling.
Section 3 introduces the proposed RVGWL method in detail.
Section 4 outlines its application to stock trend forecasting.
Section 5 reports the experimental design and evaluation results. Finally,
Section 6 concludes the study and discusses future research directions.
2. Literature Review
This section provides a broader review of stock forecasting methods, with a particular focus on chart-pattern-based approaches and graph-based modeling.
In the field of stock price forecasting, financial time series data can be utilized not only in its numerical form [
9] but also as image-based representations transformed for prediction tasks [
7]. A wide range of traditional technical analysis tools relies on chart patterns such as candlesticks, head-and-shoulders, triangles, rectangles, and double tops/bottoms [
6]. Based on this, identifying established chart patterns mentioned above has proven effective in extracting meaningful signals from price trends to facilitate prediction [
10]. Sequential chart patterns clustered by correlation have also been found to be effective in predicting stock price trends [
11]. These rule-based methods are interpretable and intuitive, yet often rely on subjective visual definitions and lack flexibility.
Recent efforts to improve predictive performance have explored the use of deep learning, particularly convolutional neural networks (CNNs), on candlestick chart images [
7,
8,
12]. While these approaches automate pattern detection and have shown promising results, they come with significant drawbacks: They require image-based inputs, demand large-scale training data, and impose substantial computational overhead. More importantly, they often sacrifice interpretability for performance.
In parallel, with the growing interest in network-based modeling, some studies have begun to represent stock markets as graphs to alleviate the computational burden associated with image-based inputs. These graph-based methods typically extract structural features—such as degree distribution, edge density, and centrality metrics—to qualitatively interpret market behavior [
13,
14,
15]. However, these approaches primarily focus on descriptive analysis of the market structure and are not directly applied to predictive tasks. Furthermore, when graph neural networks (GNNs) are adopted to capture deeper graph-level dependencies [
16], they still involve high computational complexity and often lack transparency in their decision-making processes.
Despite the popularity of rule-based chart pattern methods, there is a noticeable gap: There has been little effort to develop low-cost, rule-based methods that avoid reliance on static visual templates. This creates a pressing need for flexible and computationally efficient frameworks that preserve interpretability while generalizing better to new patterns.
Recent advances in network theory offer promising alternatives [
17]. By converting time series into graphs, such as through the visibility graph (VG) method [
18], researchers can utilize powerful graph-based tools to uncover latent structures in sequential data [
19,
20,
21]. The VG approach has been applied successfully in diverse fields, including EEG analysis [
22], biological time series [
23], and maritime route planning [
24]. In finance, VG has shown promise in modeling the structural patterns of price changes [
25,
26].
However, a critical limitation remains: Conventional VGs cannot distinguish between upward and downward price trends, as their structures may appear topologically similar. This directional ambiguity limits VG’s utility in financial forecasting.
To address this, we adopt a rising visibility graph (RVG), a directional extension of VGs that retains structural information while encoding price movement trends. We further enhance the forecasting process by incorporating the Weisfeiler–Lehman kernel, which enables fast and powerful graph similarity computation, thus facilitating pattern-matching in a nonparametric, data-driven way.
3. Methodology
In the visibility graph (VG) framework [
18], a time series
is converted into a network by connecting two time points
and
with an edge, provided that for all intermediate points
where
, the following condition is satisfied:
This inequality ensures that the intermediate value does not obstruct the direct line-of-sight between and , following a linear interpolation assumption.
To address the limitation of VG in capturing directional price movements, we extend it by introducing the rising visibility graph (RVG). Unlike the original VG, the RVG emphasizes upward trends by incorporating an additional constraint. Specifically, an edge is established between
and
only if both the VG condition holds and the value at
is strictly greater than all values between
and
. This leads to the following additional criterion:
Figure 1 visualizes the transformation of a time series into network structures using a VG and RVG. The VG (a) captures all visible connections, forming an undirected graph, whereas the RVG (b) selectively links nodes following an upward sequence, emphasizing rising trends. Both representations include overlaid and standalone network layouts, with the Kamada–Kawai algorithm enhancing clarity by positioning nodes to minimize edge crossings and evenly distribute them in space. In the visualizations, blue lines represent the original time series connections, while gray lines indicate the corresponding graph edges.
Figure 2 demonstrates the rationale for adopting a rising visibility graph (RVG) in this study. First, the standard visibility graph (VG) struggles to differentiate between upward and downward trends, as its structure remains largely similar regardless of the overall trend direction. In contrast, the RVG effectively captures the intrinsic trend characteristics through its topological structure. This distinction is evident in
Figure 2, where the VG representations of the increase and decrease time series appear structurally similar, making it difficult to infer trend directions. However, the RVG clearly distinguishes between these two cases by preserving only upward connections, thereby providing an intuitive graphical representation of the underlying trend.
Second, the VG is higy susceptible to noise, which makes it less suitable for analyzing real-world financial time series that inherently contain small fluctuations. The RVG, by contrast, effectively higights long-term trends, as demonstrated in
Figure 2c. In this case, VG exhibits dense interconnections, forming clustered communities even when no sustained upward trend is present, leading to misleading interpretations. Conversely, the RVG demonstrates superior robustness to noise and enhanced trend discernment by selectively retaining meaningful upward connections while filtering out spurious links caused by oscillations.
Furthermore, in the horizontal noise case, the RVG forms a linear chain with a triangular substructure, offering insight into the fluctuations. The linear chain indicates an overall downward trend, while the triangle higights localized upward movements. This structure helps RVG distinguish minor oscillations from real upward trends, making it useful for detecting subtle patterns in financial and dynamic systems.
3.1. Weisfeiler–Lehman (WL) Kernel
The Weisfeiler–Lehman (WL) algorithm, originally developed for testing graph isomorphism [
27], updates vertex labels in an iterative fashion to encode hierarchical structural features. This iterative process has since been adapted beyond isomorphism testing, most notably by Shervashidze et al. [
28], enabling its use in a wide range of graph-based machine learning applications [
29,
30,
31].
Among its key adaptations, the Weisfeiler–Lehman subtree kernel [
28] stands out for comparing graphs by examining the frequency distribution of subtree label patterns over several refinement steps. In this work, we adopt the WL subtree kernel to evaluate structural similarities between graphs.
3.1.1. Weisfeiler–Lehman Label Refinement
Each vertex v in a graph G is initially assigned a label , which is either derived from its features or set uniformly if such attributes are absent.
At the
i-th iteration (
), the label of vertex
v is updated by aggregating its neighbors’ labels as follows:
where
H is a hashing function that compresses the label of
v and the multiset of its neighbors’ labels into a new identifier. Through repeated iterations, vertex labels increasingly encode wider local contexts and structural information.
3.1.2. Weisfeiler–Lehman Subtree Kernel
To measure the similarity between two graphs, the Weisfeiler–Lehman subtree kernel compares their label distributions across all iterations.
Given two graphs
G and
, let
represent the set of all unique vertex labels observed at the
i-th iteration:
where
and
denote the sets of vertices in
G and
, respectively.
After
h iterations, the kernel is computed as follows:
where
counts how many times label
appears in
G at iteration
i:
Alternatively, the kernel value can be expressed as the inner product of feature vectors:
with
representing the concatenated count vector across all iterations:
This kernel computes similarity efficiently with time complexity , where n and m are the number of vertices and edges, respectively. Due to its balance of expressiveness and scalability, it is a widely used method in graph classification tasks.
4. The Proposed Method
This section outlines the proposed RVGWL-based forecasting method, including the definition of stock trend patterns, the design of the forecasting framework, and the validation of its structural and predictive capabilities.
4.1. Stock Trend Patterns
The historical analysis of stock prices for forecasting future market behavior has consistently attracted interest from scholars and financial professionals. Technical analysis, for instance, attempts to anticipate market movements by identifying patterns in past price data, which often reflect recurring investor behaviors and market sentiment [
32].
Although studies on the stock trend prediction (STP) problem typically use only three outcomes, which are downward, stationary, and upward trends [
33,
34,
35], our research considers more detailed price fluctuations. Therefore, we adopt nine distinct outcomes derived by combining these three movements over two consecutive intervals (3 × 3 = 9), as shown in
Figure 3. These nine outcomes serve as prediction targets and form the basis for our backtesting strategies.
When matching predicted stock trends to these nine patterns, we also apply a graph similarity measure. To achieve this, our patterns cannot be straight lines. According to the definition of a visibility graph (VG), data points arranged in a straight line do not generate intermediate visibility edges, resulting in graphs lacking meaningful structure. Thus, to ensure that our patterns can be effectively transformed into graphs for similarity measurements, we intentionally introduce small fluctuations (noise) to the originally straight segments. These controlled deviations allow for the proper construction of visibility edges while preserving the fundamental shape and distinguishability of each pattern.
When generating template patterns, we introduce controlled noise to ensure that they remain suitable for graph-based pattern recognition without compromising their distinguishability. Specifically, for a given time scale, we set the amplitude of each pattern equal to three times the standard deviation of the noise. This ensures that intended patterns, such as upward and downward movements, can be reliably distinguished from noise and classified correctly with approximately 99% confidence. For stable patterns, we set the slope to zero, representing horizontal movements. All composite patterns are formed by combining these three fundamental types (upward, downward, and stable).
4.2. RVGWL-Based Forecasting Framework
Figure 4 illustrates the architecture of the proposed RVGWL forecasting framework, which comprises three principal stages: graph generation, similarity computation, and forecast pattern estimation.
In the graph generation stage, the entire time series of the target stock, denoted as , is directly transformed into a graph representation using the rising visibility graph (RVG) algorithm. This transformation captures trend-sensitive structural features. Simultaneously, historical price data from N reference stocks are segmented into overlapping intervals of fixed length t, denoted as , where and j indexes the segments. Each segment is then converted into a graph , resulting in a historical graph library .
In the
similarity computation stage, the Weisfeiler–Lehman (WL) graph kernel
is employed to compute the topological similarity between the target graph and each historical graph, yielding a kernel matrix
K, where
. The similarity scores are then normalized across all historical segments to mitigate scale differences:
A threshold is applied to select a subset of structurally similar graph segments, . For each retained pair , the subsequent time segment is extracted and transformed into its graph representation , serving as a proxy for the evolution of the corresponding pattern.
In the
forecast, these successor graphs are compared against a predefined library of nine canonical stock movement templates
. For each retained pair, the WL kernel is used to compute the similarity
, which is aggregated as
The resulting scores are normalized to produce a probability distribution over pattern classes:
The final output provides an interpretable estimation of the likelihood that the target stock’s upcoming behavior aligns with each canonical pattern, thereby enabling the structure-aware, explainable forecasting of financial time series.
4.3. Graph-Based Similarity and Predictive Validation
To systematically determine the robustness of our method, we investigate the statistical relationship between the similarity of historical price movements and the similarity of their corresponding future trajectories. This analysis is grounded in the hypothesis that financial time series exhibit temporal recurrence, i.e., structurally similar historical patterns are likely to be followed by similar future behaviors.
The idea that historical patterns in financial time series tend to repeat has been widely explored in the literature. Studies have shown that stock price movements exhibit temporal structures that are statistically associated with future trends [
36,
37]. Recent advances also leverage graph-based representations to capture and exploit such recurring structures for prediction [
38].
To rigorously assess whether structurally similar historical patterns can imply similar future price movements, we integrate both qualitative and quantitative perspectives using graph-based representations of time series.
To empirically validate the hypothesis that structurally similar historical price movements may imply similar future behaviors, we adopt a graph-based representation of time series and evaluate the predictive correspondence between segments using the Weisfeiler–Lehman (WL) graph kernel. This approach enables the extraction of topological features from time series and facilitates structure-aware similarity comparisons beyond raw value alignment.
As illustrated in
Figure 5, the top panel presents a comparative analysis between the target stock (MMM) and a historical sequence from the S&P 500 index. The MMM time series, spanning from 1 January 2023 to 1 May 2023, is partitioned into two consecutive intervals:
(representing the reference/past segment) and
(the continuation/future segment). The historical time series from the S&P 500 index, ranging from 30 March 2022 to 1 August 2022, is similarly divided into
and
.
Each segment is converted into a visibility graph, a transformation that preserves temporal and structural information inherent in the original time series. The pairwise similarities between graph segments are computed using the WL graph kernel, a widely used metric that captures hierarchical neighborhood structures and is invariant to isomorphic transformations. Specifically, we compute and to assess the alignment of both past and future components.
The corresponding similarity scores for this pair are visualized in the bottom panel of
Figure 5, where each blue dot represents a graph pair. The x-axis denotes the WL similarity between past graph segments (i.e.,
), while the y-axis indicates the similarity between their corresponding future segments (i.e.,
). The red curve represents a second-degree polynomial regression fitted to all data points, capturing the general trend between past and future similarities. A red reference point is marked at
, which serves as a threshold for determining statistically meaningful similarities.
Importantly, the selected example from the top panel is higighted in the bottom plot and falls within the upper-right quadrant, where both similarity values exceed 0.5. This indicates that the structurally aligned historical segment is not only similar to the target segment but its continuation also closely resembles the actual future . This observation provides quantitative support for the hypothesis that structural similarity in the past is predictive of future behavior—an insight consistent with the broader principle that financial time series often exhibit recurring patterns.
The integration of the WL graph’s similarity and empirical similarity distribution provides a rigorous and interpretable framework for identifying informative historical analogs. This method thus supports adaptive, data-driven time series forecasting based on graph-structured pattern retrieval.
5. Evaluation
This section presents the empirical evaluation of the proposed RVGWL method. We first describe the datasets and time window selection procedure, followed by the backtesting setup, evaluation metrics, and baseline strategies. Finally, we report and analyze the experimental results across multiple stock indices to assess the predictive and financial performance of our approach.
5.1. Datasets
We first describe the data sources used in this study. Four stock datasets were collected from major global stock markets. All data consist of daily closing prices of the respective indices. A summary of the datasets is provided in
Table 1.
The Graph Library was created using daily closing prices for all datasets above from 1 January 2018 to 1 January 2023. The total number of trading days in this period is 1261. The target stock data are from 1 January 2023 to 1 January 2024 for forecasting. This forecasting period spans 252 trading days, corresponding to 1 full trading year.
Although the dataset’s construction began on 1 January 2018, we acknowledge that some component stocks in the indices were not publicly listed or included in the index constituents at that time. Consequently, for these stocks, historical data prior to their initial public offering (IPO) or index inclusion is unavailable. These stocks were excluded from the training set during graph library construction to ensure consistency in data length and quality across all samples.
The selection of the year 2023 as the target forecasting period is intentional and grounded in both practical and empirical considerations. First, it represents the most recent complete calendar year at the time of our study, allowing for up-to-date performance evaluation under current market dynamics. More importantly, 2023 exhibited a diverse set of market regimes across the four studied equity markets, offering a rich and varied testing environment for assessing model robustness under heterogeneous conditions.
In the U.S. (S&P 500), the market experienced a notable recovery from 2022 lows, largely driven by the resilience of large-cap technology stocks and growing investor optimism around AI-driven innovation. However, this rally was concentrated, with much of the gains attributed to a few “mega-cap” stocks, reflecting a skewed internal structure.
Japan’s Nikkei 225, by contrast, saw its strongest performance in over three decades, fueled by corporate governance reforms, a weak yen supporting exports, and renewed interest from foreign institutional investors. This bullish regime offered a high-momentum environment distinct from the more selective U.S. rally.
The UK’s FTSE 100 remained relatively range-bound, reflecting macroeconomic uncertainty driven by persistent inflationary pressures, energy price volatility, and cautious monetary policies from the Bank of England. The market largely reflected a value-oriented, defensive regime.
In China, the CSI 300 exhibited prolonged weakness throughout 2023, driven by concerns over property sector instability, deflation risks, and sluggish domestic consumption recovery despite the lifting of COVID-19 restrictions. The market was characterized by low investor confidence and declining liquidity—a markedly bearish regime.
The selection of 2023 thus allows the proposed forecasting model to be evaluated under sharply contrasting market conditions—ranging from bullish rebounds to bearish contractions and stagnation—thereby demonstrating its adaptability and generalizability.
5.2. Time Window Selection
Selecting an appropriate time window t is critical to capturing meaningful structural patterns in financial time series. A short window may fail to encode sufficient temporal information, whereas an overly long window can introduce irrelevant noise and obscure local dynamics. To determine the optimal window length, we propose two complementary evaluation metrics that assess both the structural consistency of retrieved historical patterns and the correctness of their predictive alignment.
To quantify how reliably past similarity implies future similarity, we define the metric
as the conditional probability that a graph pair with high past similarity also exhibits high future similarity. This reflects the intuition that historical patterns structurally aligned with the present may contain predictive information about the future. The metric is calculated as follows:
Here,
denotes the graph similarity between two segments computed using the Weisfeiler–Lehman (WL) kernel, and
is the threshold used to define “high similarity.” The numerator counts the number of graph pairs for which both past and future segments exceed this threshold, while the denominator includes all graph pairs for which their past similarity exceeds
. This corresponds to the conditional density within the upper-right quadrant in
Figure 5, normalized by the region where
(i.e., the right half of the plot).
This formulation allows us to focus on the reliability of future similarities given past similarities rather than the absolute frequency across all graph pairs. A higher value of thus implies stronger structural recurrence over time and greater potential for pattern-based forecasting.
While
captures the statistical co-occurrence of past–future structural similarity, it does not directly measure prediction correctness. We therefore introduce a second metric,
, which evaluates how often the future segment
associated with the most similar historical past
also best matches the actual future
of the target time series. This gives a more direct estimate of predictive performance and is defined as follows:
In this formulation, denotes the number of cases in which the predicted future pattern (associated with the top-ranked past ) is also the most structurally similar to the true future among all available candidates. Intuitively, this reflects the system’s ability to retrieve not only a past pattern that looks similar but also one for which its continuation correctly anticipates future behavior.
Table 2 reports the computed values of both metrics across different window lengths. We observe that both
and
reach their respective maxima when
, suggesting that this window size best balances structural recurrence with predictive reliability. This dual-criterion selection framework provides a rigorous basis for time window optimization in structure-aware time series forecasting.
Importantly, this time window selection process is conducted prior to the main backtesting experiments. This is because the evaluation metrics used here—particularly —measure direct predictive accuracy based on structural similarity, independently of any specific trading strategy. In contrast, backtesting results can be influenced by extraneous factors, including trade execution logic, holding period effects, and even cases where incorrect forecasts happen to yield profits by coincidence. Therefore, identifying the optimal window size beforehand ensures that the core forecasting mechanism is tuned based on objective structural criteria and is not confounded by strategy-specific randomness.
Based on this empirical analysis, we select as the default time window length for all subsequent experiments. This setting is used throughout the remainder of the study for graph construction, similarity evaluation, and pattern-based forecasting.
5.3. Backtesting Setup
To assess the practical applicability of the identified pattern classes, we design tailored backtesting strategies based on the typical trend dynamics observed in each class.
Table 3 summarizes the trading strategy associated with each of the nine patterns discovered through classification. These strategies are informed by the underlying trend type—categorized as
Upward,
Downward,
Flat, or
Reversal—and are designed to exploit the structural characteristics of each trend.
For instance, patterns classified as Upward suggest a standard long-position strategy: buying at the start of the window and selling at the end. Conversely, Downward trends warrant a short-position strategy, selling early and buying back later. Flat trends are associated with uncertain or sideways movements and are treated with caution. Reversal patterns are characterized by transitions in direction and are handled with more nuanced strategies, such as buying after a dip and exiting before a predicted decline.
This strategy design allows the model to transition from pattern recognition to actionable trading insights, facilitating simulation-based evaluation through historical back testing.
The backtesting framework is initialized with a notional capital of USD 100,000. Each trade involves a fixed quantity of 100 shares, and a transaction fee of 0.1% is imposed on both the buying and selling operations. The portfolio is updated dynamically based on the executed trades and incurred transaction costs, thereby providing a realistic evaluation of strategy performance under market-like conditions.
5.4. Evaluation Metrics
To validate the effectiveness of the model design in a realistic trading context, we conduct a backtesting experiment on historical price data using the nine classified patterns and their corresponding trading strategies (as detailed in
Table 3). For each occurrence of a pattern within the test dataset, the pre-defined strategy is applied over the same temporal window to simulate trade execution.
To assess the quality of the strategies, we employ several standard financial evaluation metrics:
Cumulative Return (CR): Measures the total return over the entire backtesting period.
Annualized Sharpe Ratio (SR): Evaluates the risk-adjusted return using the standard deviation of daily returns and assuming a zero risk-free rate:
where
and
are the mean and standard deviation of daily returns, respectively.
Win Rate (WR): The percentage of trades that result in a positive return.
Maximum Drawdown (MDD): The largest observed peak-to-trough decline during the evaluation period, representing the worst-case loss scenario.
Annualized Volatility (Vol): Measures the standard deviation of daily returns scaled to an annual level, reflecting the total risk of a strategy.
Downside Deviation (DD): Quantifies the standard deviation of negative returns only, penalizing downside volatility while ignoring gains.
where
denotes the individual daily returns over a period.
These metrics collectively capture both profitability and risk, enabling a comprehensive evaluation of the pattern-driven trading framework.
5.5. Counterpart Methods
To evaluate the effectiveness of the proposed RVGWL method, we compare it with two groups of counterpart strategies: (1) classical rule-based technical chart patterns and (2) widely used technical indicators in quantitative trading. These baseline methods are selected for their interpretability, simplicity, and prevalence in both academic and practical financial forecasting.
- (1)
Rule-Based Chart Pattern Methods
These patterns are well-established in the literature and are grounded in the geometric relationships among local extrema to capture the meaningful structural characteristics of price series. Each pattern is defined using five-point local extremum sequences, following the formal criteria introduced by Lo et al. [
6]. We apply a fixed sliding window of
trading days and the number of local extrema as
, as suggested in their methodology.
Consider the systematic component
of a price history
, and suppose we have identified
n local extrema—i.e., the local maxima and minima—of the price series
. Denote these extrema by
and the corresponding dates on which these extrema occur by
Using these
n extrema and their respective time indices, a series of structural chart patterns can be defined based on their geometric and temporal arrangements.
Under this framework, the rule-based chart patterns considered in this study include the following:
Head-and-Shoulders/Inverse Head-and-Shoulders (HS/IHS): A five-point local extremum pattern where the central point () forms the head—being the highest (HS) or lowest (IHS)—flanked symmetrically by two shoulders ( and ) at approximately equal levels. Points and serve as intermediate troughs or peaks. The pattern is confirmed upon a price breakout through the neckline connecting and .
Broadening Tops and Bottoms (BTOP/BBOB): A diverging pattern where the sequence of highs increases () and the lows decrease () in BTOP, forming a megaphone shape. BBOB follows the inverse order. These patterns typically indicate rising volatility and a potential reversal near the breakout.
Triangle Tops and Bottoms (TTOP/TBOT): A converging five-point formation in which the highs (TTOP: ) or lows (TBOT: ) become progressively narrower, while the intermediate extrema () exhibit directional symmetry. This structure reflects market compression and often precedes a breakout.
Rectangle Tops and Bottoms (RTOP/RBOT): A horizontal consolidation pattern where the top points (e.g., ) and bottom points (e.g., ) remain within 0.75% of their respective averages. The pattern is valid only when the lowest top is higher than the highest bottom, forming a bounded range.
Double Tops and Bottoms (DTOP/DBOT): Defined by two similar local extrema—either two peaks (DTOP) or two troughs (DBOT)—that are within 1.5% of each other in value and separated by at least 22 trading days. This time separation distinguishes the pattern from short-term noise and supports its interpretation as a potential trend reversal signal.
The corresponding trading logic for each pattern is summarized in
Table 4. Entry signals are generated based on structural breakout conditions, and the holding period is typically five trading days unless otherwise noted.
- (2)
Technical Indicator Baselines
We further carry out comparisons with classical technical indicator-based strategies, known for their simplicity and popularity in both retail and institutional trading:
Moving Average (MA): Uses crossovers between 5-day short-term and 20-day long-term moving averages. Buy when short-term crosses above long-term; sell on the reverse.
Relative Strength Index (RSI): A 14-day momentum oscillator. Buy when RSI < 30 (oversold); sell when RSI > 70 (overbought).
Moving Average Convergence Divergence (MACD): Uses the difference between 12-day and 26-day EMAs. Buy or sell signals are generated when the MACD line crosses the 9-day signal line.
These strategies serve as practical, interpretable benchmarks for assessing the predictive value of our proposed graph-based approach.
5.6. Results
We evaluate the predictive performance of the proposed RVGWL model against a series of classical rule-based technical pattern strategies across four major equity markets: S&P 500, Nikkei 225, FTSE 100, and CSI 300.
Table 5 summarizes the cumulative return (CR), Sharpe ratio (SR), and win rate (WR) of each strategy over the testing period. In addition to these standard metrics, we also report the maximum drawdown (MDD), annualized volatility (Vol), and downside deviation (DD) to capture the risk characteristics more comprehensively.
The RVGWL method demonstrates superior performance across all markets. In the S&P 500, it achieves a cumulative return of 3.19 and a Sharpe ratio of 1.29, indicating both high profitability and strong risk-adjusted returns. Similar results are observed in the Nikkei 225 (CR = 2.87, SR = 1.11), FTSE 100 (CR = 1.73, SR = 0.67), and CSI 300 (CR = 2.05, SR = 0.85), all with win rates exceeding 74%. Notably, RVGWL also maintains low maximum drawdowns (1.21–1.59), moderate volatility (0.88–0.95), and small downside deviation (0.20–0.29), demonstrating its resilience under adverse market conditions. These consistent results higight the robustness and generalizability of the RVGWL model.
In contrast, rule-based strategies exhibit weaker and more volatile performance. For instance, the head-and-shoulders pattern (HS/IHS) yields relatively low returns across markets and shows underperformance in the CSI 300 with a negative cumulative return of −0.23 and a win rate of only 48%. Similarly, triangle-based patterns (TTOP/TBOT) report the lowest average CR values, reaching as low as −0.27 in the FTSE 100. These methods also tend to suffer from larger drawdowns (often exceeding 3.0) and higher volatility and downside deviation values, indicating their limited robustness and higher exposure to tail risks.
Among the classical patterns, double tops and bottoms (DTOP/DBOT) and rectangles (RTOP/RBOT) show comparatively better performance, achieving CR values of up to 0.55 and win rates up to 63%. However, their risk-adjusted returns, as measured by the Sharpe ratio, remain modest. While they offer moderate risk levels, their volatility (approximately 1.0–1.2) and downside deviation (0.45–0.54) are still higher than those of RVGWL.
In addition to rule-based patterns, we also benchmarked three widely used technical indicators: Moving Average (MA), Relative Strength Index (RSI), and MACD. Although these indicators outperform some traditional patterns in terms of CR and SR, they still lag behind RVGWL in both return and risk metrics across all markets. For example, MACD reaches a CR of 1.29 in the S&P 500, but its drawdown and volatility remain higher than those of RVGWL.
Overall, the results demonstrate the clear advantage of the proposed RVGWL approach over both traditional pattern-matching techniques and classical technical indicators. By learning latent representations from the visibility graph structure, RVGWL effectively captures complex market dynamics that static rule-based methods fail to generalize. Its strong performance across multiple risk-return dimensions underscores its suitability as a practical and interpretable solution for financial forecasting.
6. Discussion and Conclusions
This work presents RVGWL, a structure-aware financial forecasting framework that leverages rising visibility graphs and the Weisfeiler–Lehman kernel to extract and utilize topological patterns embedded in historical price movements. The empirical evaluation across four major stock markets demonstrates that RVGWL achieves consistent and robust predictive performance in terms of cumulative return, Sharpe ratio, and win rate.
By transforming time series into visibility graphs, the model captures latent geometric structures that are not readily observable through raw price data. The integration of the WL kernel enables a principled comparison of graph topologies, facilitating the efficient retrieval of structurally similar historical episodes. This allows the system to generalize beyond literal template matching and uncover recurring structural patterns that may signal future price trajectories.
Compared with traditional rule-based methods such as head-and-shoulders and double top patterns [
6], RVGWL eliminates the reliance on manually defined geometric templates and fixed visual heuristics. This generalization capability allows it to detect more flexible and non-obvious structural similarities across market conditions.
Additionally, while prior deep learning approaches based on image-transformed candlestick data [
7,
8,
12] have demonstrated strong performance, they typically require large-scale training datasets and suffer from limited interpretability. In contrast, RVGWL operates directly on numerical data, uses no black-box training, and retains full traceability of its predictions via interpretable graph similarities. This reduces both computational cost and model opacity—two major drawbacks of image-based models.
Compared to previous network-theoretic studies that apply complex network measures (e.g., degree distribution or centrality) to stock correlation graphs [
13,
14,
15], RVGWL directly models price dynamics through time-series-derived visibility graphs. Moreover, unlike GNN-based models [
16] that embed entire graphs through learned parameters, RVGWL retains interpretability by explicitly comparing graph structures via the WL kernel without parameter training.
Unlike deep learning-based models such as CNNs and GNNs, which primarily focus on pointwise prediction (e.g., forecasting the next price or return) and optimize for accuracy-related metrics, RVGWL emphasizes the identification of broader trend structures and integrates rule-based trading logic. This distinction allows the model to provide directly actionable insights, bridging the gap between structural pattern recognition and real-world decision-making in financial markets.
Beyond methodological contributions, the proposed framework also has practical implications for both private market participants and public policy makers. For individual traders and institutional investors, RVGWL offers an interpretable and low-cost way to detect flexible structural patterns beyond traditional rule-based templates, enabling more adaptive trading strategies. Its ability to retrieve historical analogs with similar topologies also supports risk management through more explainable trade signals.
From a policy perspective, the discovery of stable and recurring topological structures in price movements suggests the presence of semi-predictable dynamics in financial markets, even under different market regimes. This could inform financial regulators’ early warning systems and macroprudential tools by identifying systemic signals that are not easily captured by classical volatility or correlation measures. Furthermore, the model’s nonparametric and market-agnostic nature makes it well-suited for comparative market surveillance and stress testing in both developed and emerging markets.
The consistent performance across diverse markets suggests that RVGWL effectively identifies universal features of financial dynamics. Its ability to operate without prior assumptions about specific patterns or time scales provides strong adaptability in the face of market volatility and structural regime shifts. Furthermore, its design supports interpretability by explicitly grounding predictions in learned structural similarities, which is particularly valuable in practical financial decision-making.
While RVGWL shows promising results, there are several potential avenues for future extension. First, incorporating multivariate features such as volume, volatility, or sentiment indices may enrich the graph’s representation and further improve forecasting accuracy. Second, the current use of a fixed sliding window and holding period may be relaxed by introducing adaptive mechanisms based on context-aware decision rules or reinforcement learning. Finally, extending RVGWL to probabilistic prediction outputs or uncertainty quantification may enhance its applicability to risk-sensitive domains such as portfolio optimization or market-making.
In summary, RVGWL provides a flexible and interpretable graph-based approach to financial time series modeling. By utilizing rising visibility graphs (RVGs), it explicitly addresses the inherent limitation of standard visibility graphs (VGs), which fail to distinguish between structurally identical rising and falling trends. Integrating the Weisfeiler–Lehman kernel further enables RVGWL to generalize beyond literal template matching, uncovering recurring structural patterns that standard pattern recognition methods might overlook. This enhanced generalization capability allows RVGWL to maintain robust predictive performance even in the presence of market volatility and structural regime shifts, without relying on predefined assumptions about specific patterns or time scales. Consequently, the framework offers a principled, data-driven alternative to conventional heuristics, demonstrating potential for broader applications in algorithmic trading, quantitative analysis, and economic forecasting.