preview
Statistical Arbitrage Through Cointegrated Stocks (Part 10): Detecting Structural Breaks

Statistical Arbitrage Through Cointegrated Stocks (Part 10): Detecting Structural Breaks

MetaTrader 5Trading systems |
334 0
Jocimar Lopes
Jocimar Lopes

Introduction

While researching the topic of cointegration, we are often exposed to a recurrent analogy: a drunk man walking his dog on a leash. They may move away sometimes, the man may walk in a tortuous way, the dog may jump faster and come back to the man, but they stay connected, tied by the leash. Eventually, they arrive home together. But what if, for any reason, the leash is broken? 

Cointegration is a long-term relationship. The spread fluctuates constantly, but as we adjust the portfolio weights, we can stay in the business trading the same pair or basket for a relatively long time. Even a pair tied by simple correlation may sustain the correlation for a relatively long time, as long as we keep correcting the spread between them. Anyway, be it a correlation or a cointegration relationship, no relationship is forever. We know that at some point, it starts losing power, the pairs or assets in the basket start drifting away, the hedges start making no economic sense for trading, eventually leading to the removal of the pair or basket from our portfolio. 

Usually, this process is a progressive one. It can be monitored and detected by the tools we have been using so far, like the rolling window eigenvector comparison (RWEC) and the in-sample/out-of-sample ADF (IS/OOS ADF). In the last article of this series, we saw how we can backtest the portfolio weights updates based on the live trading monitoring of these progressive deviations from the model.

However, sometimes the connection between the assets breaks in an unexpected way. The leash that once connected the man and the dog snapped. Not progressively, but suddenly. Not step-by-step in a couple of days or weeks, but as a single event in time, a breakpoint.

When this happens, we would like to be informed as early as possible. Otherwise, we may continue updating our portfolio weights for a pair or basket whose cointegration or correlation relationship was flipped or no longer holds. But how can we differentiate the usual fluctuations from a relationship break? How can we take apart the permanent change from the market noise?

Take, for example, the announcement made by the President of the United States on April 2, 2025, regarding foreign trade tariffs. That was a high-impact news on steroids. It changed several markets around the world. The so-called “Liberation Day” triggered one of the most significant regime shifts of our lives. It is reasonable to assume that many cointegrated portfolios were "dismantled" by the next day. It was an unexpected shock that altered the correlations and hedge ratios between global assets. It was an Executive Order that only those in the inner circle of the United States government had access prior to the announcement. For all practical matters, it was totally unexpected. The effects were horizontal, changing relationships on FX pairs (USD/CNH), commodities (Iron, Oil), and stocks as well. As a consequence, index relationships were changed dramatically, as happened with the S&P500 and the JPN225 (Nikkei).

A similar example would be the recent partnership between Nvidia and Intel. It caused an immediate rally in Intel shares and inverted the usual correlation between the stock prices. But while the “Liberation Day” announcement was, at least theoretically, totally unexpected, an investment decision by a major player in the semiconductor industry is never “totally unexpected”. This kind of decision follows board decisions, stakeholder meetings, and interviews published in the specialized press. It is always tracked by the market, priced in by the big players, until the partnership announcement is properly published.

But, despite the differences between the “totally unexpected” US government high-impact news on steroids and the tracked and priced in corporate high-impact news, both caused what is called a structural break in the respective markets. Both events resulted in changes bigger than those provoked by the usual market fluctuations.

Below, we will see what a structural break is, how the statistical tests we’ve been using so far can alert us to possible structural breaks, how we can use Chow tests to confirm them, and how we can early detect them by recursively calculating the cumulative sum of squares.



What is a structural break?

The expression structural break has an intuitive meaning. Anyone can understand the words and realize that some structure has been broken. But despite this intuitive meaning, in econometrics and statistics, there is a formal definition of a structural break.

“an unexpected change over time in the parameters of regression models”

Although we have been avoiding formal math or statistics, instead keeping our focus on the use of the statistics tools and methods, it is relevant that we have a clear understanding of the formal definition of structural break to differentiate our perception of it from the common sense associated with the expression. That’s because one of the “parameters” that are targeted by an unexpected change is the spread we will be trading. So, the definition is saying that, among other possible parameters, a structural break occurs when our correlated or cointegrated spread changes in an unexpected way.

Two things to note: although unexpected news and market movements are usually the source of the change, the term “unexpected” in the definition of structural break has nothing to do with unexpected news or unexpected market movements. It is unexpected from the regression model perspective. The regression was going in some direction and suddenly turned to another; the slope changed in an unexpected way.

Also, the term “parameter” has a different meaning than that we use in general math or software development. In this context, a mean or a standard deviation is a parameter, as is our spread.

Let’s make things concrete by taking the, in a sense, expected partnership announcement between Nvidia Co. (NVDA) and Intel Co. (INTC). This partnership led to an unexpected change in the regression parameters of the Pearson correlation test of these stocks.

Nvidia Co. (NVDA) partnership with Intel Co. (INTC)

On September 18, 2025, Nvidia announced a major partnership with Intel Co. to develop chips for PC and data centers. The five billion dollar investment caused a rally in Intel stocks, changed the relationship between the two companies, and consequently changed their correlation relationship. At this point, any portfolio relying on a stable Beta between NVDA and INTC should run a check for a structural break as soon as possible.

Until the week before the announcement, there was a negative correlation between NVDA and INTC, meaning they were fluctuating in opposite directions. Although the correlation was not high enough in this period in the daily timeframe, one may conceivably have them being traded in a semiconductor industry portfolio, buying one while selling the other. At this point, the companies were seen as competitors in a zero-sum game. If one of them were to be winning, the other would be losing, and vice versa. They were seen by the investors as two big players fighting for the same market share.

The plot below shows a visual map of the Pearson correlation between Nvidia and Intel from the beginning of 2024 to the week before the partnership announcement. It indicates a negative correlation of -0.71.

Fig. 1 - Plot of NVDA and INTC Pearson correlation matrix heatmap from Jan 01, 2024, to Sep 13, 2025

Fig. 1: Plot of NVDA and INTC Pearson correlation matrix heatmap from Jan 01, 2024, to Sep 13, 2025

After the partnership announcement, the correlation was flipped. The plot below shows a visual map of the Pearson correlation between Nvidia and Intel from the week the partnership was announced to three months ahead. It indicates a positive correlation of 0.75.

Fig. 2 - Plot of NVDA and INTC Pearson correlation matrix heatmap from Sep 15, 2025, to Dec 17, 2025

Fig. 2: Plot of NVDA and INTC Pearson correlation matrix heatmap from Sep 15, 2025, to Dec 17, 2025

Although the absolute value remained almost the same, from this point in time onwards, the correlation became positive, meaning that both stocks started fluctuating in the same direction. Now, the companies that were seen as competitors by the market as a whole, now are perceived as strategic partners; if one succeeds, the other succeeds as well. Suddenly, they are not fighting for the same market share anymore, but joining forces to become stronger. That’s a radical and, from a purely mathematical point of view, totally unexpected change in their correlation relationship. Any portfolio that includes this pair needs to be recalibrated or stopped.

And here we are facing the most relevant issue for our statistical arbitrage strategy. Note that although the foreign trade tariff announcement by the US government was absolutely unexpected in its reach and magnitude by the average retail trader, the Nvidia/Intel partnership was not. It could be tracked from C-Level press releases, interviews, and expert analysis, among other sources. The simple common sense says that, in fact, it was tracked and priced in weeks before the effective announcement. The correlation flip may be unexpected from a strict mathematical perspective, or may have gone beyond expectations, but the radical change in the assets' relationship was not unexpected at all.

The market was not sleeping while both companies negotiated a deal. Instead, as the news evolved from purely rumors at the beginning to the effective announcement on September 18, 2025, the partnership was progressively embedded in the correlation relationship. It was not an instantaneous change. Instead, it was the result of an accumulation of signals until the peak event.

The most relevant issue for our statistical arbitrage strategy is how we can detect those minor changes in the correlation relationship that have led to a structural break?



RWEC alerts

Let’s suppose we have been monitoring this pair with a Rolling Window Eigenvector Comparison (RWEC for short). We saw a detailed description of its features and interpretation in Part 8 of this series, so we will not repeat ourselves here. It is enough to remember that this tool calculates the portfolio weights stability by comparing the cosine distance of successive eigenvectors’ angles against a defined threshold. It computes the cointegration vector over rolling windows and compares eigenvectors across these windows. So, if we were using RWEC to monitor this pair, we would be alerted to an unusual change in the pair relationship.

The plot below shows the cointegration vector evolution and the vector stability for the NVDA/INTC pair from the beginning of 2025 to the start of 2026, the time of writing. We can see that the radical change that will peak in September, the month of the partnership announcement, starts being detected nearly two weeks before, around August 20. At that moment, we would have no means to know if the changes were market noise, normal fluctuation, or the first movements of a structural break. The interpretation we would be making about these changes would be entirely dependent on the level of information we would have at that moment about the eventual partnership. The data alone would not be enough to drive our action.

Fig. 3 - Plot of a Rolling Windows Eigenvector Comparison for NVDA/INTC pair in the H4 timeframe and 504 lookback days
Fig. 3: Plot of a Rolling Windows Eigenvector Comparison for NVDA/INTC pair in the H4 timeframe and 504 lookback days

These plots were obtained with 504 lookback days in the H4 timeframe, NOT in the daily timeframe, since I’m assuming we were using it for monitoring a real-time trading portfolio. Note that it detects the relationship inversion in September 2025. The angle between consecutive vectors goes from a stable near-zero before the partnership date to more than 150 degrees after the announcement. A month later, it was stable again.

The question is that, although RWEC can detect and inform us about the weird movement on the spread, it cannot tell us if the change is structural. For it was not developed with this purpose. Instead, the RWEC is, in a sense, short-sighted: it looks for variations over time and compares the nearest fluctuations with the chosen threshold. But it says nothing about the history of the spread and how it relates to the nearest fluctuations. Here enters the Chow test.



Chow test

The Chow test was developed with the explicit goal of checking if a specific break caused a structural change. It does this in a very intuitive way, by running three linear regressions over the data: one that stops right before the break, one that starts right after the break, and a third regression over the full period as if there was no breakpoint. The test then compares the former two linear regressions with the latter to provide an F-statistic and a p-value. The higher the F-stat, the lower the p-value, the higher the probability of a structural break in the data analysed.

The Chow test requires that we provide a breakpoint date (a point in the timeseries). This is the date we hypothesize the structural break. It needs this date to run the first two linear regressions that end and start around the breakpoint.

At the end of this article, you will find the Python scripts for running the previous Pearson correlation and RWEC tests. These tests were discussed extensively in the previous parts of this series of articles. Please refer to them if you are starting here.

In the attachments below, you will also find the Python script to run a Chow test. This is the Chow test's main function. Note that the only required parameter, besides the price data, is the date breakpoint. 

    def run_chow_test(self, data: pd.DataFrame, break_point_date: str):
        """
        Performs the Chow test on the asset pair Y and X.
        
        Parameters:
        - data: DataFrame with columns [Y, X] (first column is Y, second is X)
        - break_point_date: String date (e.g., 'YYYY-MM-DD') for the structural break.
        """
        if data.shape[1] != 2:
            raise ValueError("Input data must have exactly two columns (Y and X).")
        
        # Assign Y and X based on column order
        symbol_y = data.columns[0]
        symbol_x = data.columns[1]
        
        Y_full = data[symbol_y]
        X_full = sm.add_constant(data[symbol_x])
        N = len(data)
        k = 2 # Number of parameters (intercept + slope)

        # 1. Split data at suspected break point
        break_date = pd.to_datetime(break_point_date)
        
        # Check if the break date is valid
        if break_date <= data.index.min() or break_date >= data.index.max():
             raise ValueError("Breakpoint date is outside the data range.")

        # Data split
        df_pre = data[data.index < break_date]
        df_post = data[data.index >= break_date]

        N1 = len(df_pre)
        N2 = len(df_post)
        
        if N1 < k or N2 < k:
            raise ValueError("Insufficient data points in one or both sub-periods to estimate the model.")

        # 2. Full sample regression (restricted model)
        full_model = sm.OLS(Y_full, X_full).fit()
        ssr_full = full_model.ssr
        
        # 3. Separate regressions (unrestricted models)
        Y_pre = df_pre[symbol_y]
        X_pre = sm.add_constant(df_pre[symbol_x])
        pre_model = sm.OLS(Y_pre, X_pre).fit()
        ssr_pre = pre_model.ssr

        Y_post = df_post[symbol_y]
        X_post = sm.add_constant(df_post[symbol_x])
        post_model = sm.OLS(Y_post, X_post).fit()
        ssr_post = post_model.ssr
        
        # 4. Compute Chow test statistic
        numerator = (ssr_full - (ssr_pre + ssr_post)) / k
        denominator = (ssr_pre + ssr_post) / (N - 2 * k)
        F_stat = numerator / denominator
        
        # p-value
        p_value = f.sf(F_stat, k, N - 2 * k)
        
        results = {
            'symbol_y': symbol_y,
            'symbol_x': symbol_x,
            'break_date': break_point_date,
            'F_stat': F_stat,
            'p_value': p_value,
            'pre_beta': pre_model.params[1],
            'post_beta': post_model.params[1],
            'full_beta': full_model.params[1],
            'N1': N1,
            'N2': N2,
            'ssr_full': ssr_full,
            'ssr_pre': ssr_pre,
            'ssr_post': ssr_post
        }
        results['full_intercept'] = full_model.params[0]
        results['pre_intercept'] = pre_model.params[0]
        results['post_intercept'] = post_model.params[0]

        # Determine the conclusion
        if p_value < 0.05:
            results['conclusion'] = "Reject H0 (Structural break detected)"
        else:
            results['conclusion'] = "Fail to reject H0 (No structural break evidence)"

        return results

 By running this script for the NVDA/INTC pair on September 18, 2025, as the date breakpoint, we will get an output and plot like this.

--- Chow Test Analysis ---
Pair: NVDA vs INTC
Breakpoint: 2025-09-18
F-statistic: 568.7312
p-value: 0.000000
Conclusion: Reject H0 (Structural break detected)
Pre-break Beta: -2.5947
Post-break Beta: 0.9506
Inserted Chow test result for NVDA/INTC into 'chow_results' table.

Fig. 4: Plot of the Chow test for the NVDA/INTC pair with September 18, 2025, as the breakpoint date.

Fig. 4: Plot of the Chow test for the NVDA/INTC pair with September 18, 2025, as the breakpoint date


The plot is crystal clear: two very different regimes emerge when we set the partnership announcement date between Nvidia and Intel as a breakpoint. From negative to positive correlation, from inverse to synchronized. Let’s try to understand how it is telling this story.

The Pre-Break line (blue) has a slope of -2.59. This is the Beta we would be trading before the partnership. At that moment, when Intel’s price was moving up, Nvidia’s price tended to move down. In this regime, the market was pricing them as competitors. This is what we would be trading if we ignored the change.

Following the five billion dollar investment news, the relationship inverted. The Post-Break line (red) flipped, and now the slope is 0.95. Now, their prices are moving in the same direction, and the market is pricing them as partners, or at least as a beneficiary of each other's success. This is what we should be trading after learning about the change.

The dashed black line represents the so-called “Restricted Model”, in Chow test parlance. It shows how the regression would be if the relationship never changed. We can think of it as the average of the two regimes, the average of the errors, progressively increasing the losses, for it is based on a relationship that no longer exists.

If we were using this analysis for live trading monitoring, the F-statistic with a value of 568 should sound like a “get out” signal. It is informing us that this isn’t just market noise. It is a permanent regime shift. Also, the p-value tells us what is the probability that we would see an F-stat with this value if there were no structural break. It is zero.

So, if we were running a mean-reversion strategy with this couple in our portfolio, this plot shows the moment we should stop the old model represented by the blue line and start a new model represented by the red line. Otherwise, we would be progressively increasing our error, as represented by the black dashed line.

We can think of it as a mathematical proof that a fundamental shift occurred in the relationship, and we can use the Chow test whenever we suspect a permanent regime shift has occurred. Some examples of events prone to cause regime shifts are corporate mergers and acquisitions, changes in monetary policy (for FX traders, in particular), unexpected high or low earnings reports, and regulatory changes.

However, as powerful as the Chow test can be in detecting structural breaks, it also has some limitations. One of them we already saw, which is that we need to have a breakpoint date in advance. Also, it can only be applied to two assets at a time, meaning we cannot use it to test a basket of three, four, or more stocks. Besides these absolute limitations, there is one that is relative to the timeframe, which is that we need some “reasonable” amount of data after the chosen breakpoint to run a Chow test with minimum accuracy.



How early can the Chow test detect a structural break?

The Chow test is technically a confirmatory tool, not an early-warning tool. Because of how it is calculated, it cannot detect a structural break the moment it happens. It requires a "buffer" of data after the suspected event to prove that a shift in the relationship has actually occurred. There is a mathematical minimum, and a practical minimum for the required amount of data after the break. The mathematical minimum of data points after the break is equal to the number of parameters in our model. For a simple pairs trading, this is two parameters.

Theoretically, we could run the test with just two days of data after "Liberation Day." However, with only two days, the restricted model, the regression that goes through data from start to end as if the breakpoint never existed, would have stopped just two days after the event, so it would have no statistical power, and our results would be meaningless. The mathematical minimum has no practical application for our use case.

To have confidence in the result, that is, to obtain a p-value below 0.05, we need enough data after the break to distinguish a new regime from temporary noise. In daily trading, we can start seeing a high F-statistic within 5 to 10 bars. Moreover, if the break is violent, as seen in the “Liberation Day” (145% tariff). But the literature we researched and most of our tests suggest that from 20 to 30 bars after the breakpoint is required to ensure the OLS estimates for the second period are stable enough to be compared to the first.

Back to the “Liberation Day” event, the huge rise in the foreign trade tariffs announced by the President of the United States on April 2, 2025, we would not have a meaningful Chow test by the next day, or even by the end of the week on April 4. We would need to wait for something like ten to fifteen trading days for a Chow test to be able to return a significant F-statistic.

For example, let’s run a Chow test for the S&P500 (US500) and the Nikkei225 (JPN225). Remember that Japanese products were threatened with 25% baseline tariffs, later settled on the 15% level baseline, with several sector exceptions and specific agreements. These disturbed the usually stable correlation between the American and the Japanese indices. So we can expect some structural change in their correlation since April 3, 2025.

--- Chow Test Analysis ---
Pair: US500 vs JPN225
Breakpoint: 2025-04-02
F-statistic: 57.5019
p-value: 0.000000
Conclusion: Reject H0 (Structural break detected)
Pre-break Beta: 0.0656
Post-break Beta: 0.0822
Inserted Chow test result for US500/JPN225 into 'chow_results' table.

Fig. 5 - Plot of a Chow test for the S&P500/Nikkei225 with April 03, 2025, as the breakpoint date
Fig. 5: Plot of a Chow test for the S&P500/Nikkei225 with April 03, 2025, as the breakpoint date

Slope inversion X intercept shift

The test confirms that we had a structural break in the correlation between the S&P 500 and the Nikkei 225. However, here we have a different kind of structural break than that of the Nvidia/Intel after the partnership announcement, represented by the plot in Figure 4. Note that we do not have an inversion in the relationship, nor a significant change in the Betas. Instead, both assets remain with a positive correlation after the breakpoint, and the Betas pre-break (0.07) and post-break (0.08) are practically the same.

While the Nvidia/Intel partnership created a slope inversion, the US change in foreign trade policy caused an intercept shift in the linear regressions for these indices. They are still moving together with almost the same sensitivity to each other (the slope), but the gap has widened. The blue and red lines are physically separated by such a distance that the black dashed line cannot pass through them without significant errors. 

We can assess all this information by simply looking at the plot, since it is pretty intuitive in showing the break, but it is the F-stat of 56 and the p-value with a value of zero that indicate with mathematical certainty that a structural break occurred.

Since we need at least two weeks to confirm a structural break in the frequency/timeframe we’ve been using (daily to H4), how could we be informed early about the changes that may lead to a structural break? How could we have an alert as early as possible, as the RWEC did for the NVDA/INTC pair’s partnership announcement?



Find a break as early as possible with recursive detection

By monitoring the cumulative sum of residuals, as soon as the errors in the different regressions (pre-break, post-break, and restricted/full model) start stacking up consistently in one direction, we can be warned by the system, that is, the test can trigger an alarm. This technique is known as CUSUM, standing by “cumulative sum”.

While the Chow test is static, checking if there is a structural break on a specific breakpoint/date, the CUSUM is recursive. It continuously checks if the model is starting to fail.

You’ll find it in the cusum_monitor.py script attached below. The main function is very simple, from a trader’s perspective, because the hard work is done by the RecursiveLS() function from statsmodels library.

   def run_early_warning(self, data: pd.DataFrame):
        # Regression: Y = a + bX
        y = data.iloc[:, 0]
        x = sm.add_constant(data.iloc[:, 1])

        # We use simple OLS residuals for the CUSUM calculation
        res = RecursiveLS(y, x).fit()
        
        cusum_values = res.cusum
        nobs = len(cusum_values)
        
        # Manually calculate the 5% significance bound
        # The threshold for the CUSUM test at index 't'
        critical_val = 0.948
        limit = critical_val * (np.sqrt(nobs) + (2 * nobs / np.sqrt(nobs)))
        
        current_val = cusum_values[-1]
        is_breaking = np.abs(current_val) > limit
        
        return is_breaking, res

We checked NVDA and INTC in the daily timeframe with the CUSUM monitor as if we were monitoring a live trading, starting on June 01, 2025, through December 30, 2025. The goal, obviously, was to check if the recursive monitoring would be of some help in the early detection of the structural break that would occur on September 18, 2025, the partnership announcement date.

MT5 ConnectedStarting simulation for ['NVDA', 'INTC']...
Initial training window: 70 bars.
CRITICAL SIGNAL on 2025-09-19
The model has deviated beyond the 95% confidence interval.

Fig. 6 - Plot of the cumulative sum of squares (CUSUM) for the pair NVDA/INTC showing that the alarm was triggered on September 19, 2025.

Fig. 6: Plot of the cumulative sum of squares (CUSUM) for the pair NVDA/INTC showing that the alarm was triggered on September 19, 2025

This plot shows clearly the power of this technique to monitor model deviations. Note that the alarm was triggered on September 19, 2025, one day after the NVDA/INTC partnership announcement. If anything, we could say about the alarm is that it was as early as possible. But let us understand better how it was possible that it worked with that accuracy and so fast.

The dashed lines represent the 95% confidence interval for stability. As long as our model stays inside this tunnel, the relationship between assets is statistically consistent.

The blue line is the cumulative sum of our model's errors. If it crosses outside the dashed tunnel, it means the model is no longer predicting the relationship accurately. This marks our trigger date.

Remember what we said above about the difference between the US Gov tariff announcement and the NVDA/INTC partnership announcement in terms of the expected/unexpected character. The tariff announcement by the US government was, at least theoretically, unexpected. Even if it was expected in some sense, it was unexpected in its magnitude. On the other hand, the Nvidia partnership with Intel, an agreement between two private companies, could be, and probably was, anticipated by the market. Although it had an announcement day, the signals of the then-probable partnership were priced in by the market. This progressive anticipation is reflected in the plot, as the relationship had been changing progressively until the announcement date on September 18, 2025.

Then, the next day, we have the explosion confirming the accumulation of “errors” in the model. The cumulative sum result is the trigger. Because we would be monitoring, we would be warned earlier. That’s why the CUSUM technique can work with great accuracy in a few hours: because it has been following the accumulation of errors. If we were using this tool in live trading monitoring, we would be able to act even before the announcement. This is, without any doubt, a trading edge.

Note that the RWEC in Figure 3 also captured this warning movement in the weeks before the partnership announcement. As we saw in Part 8 of this series, we can use RWEC along with IS/OOS ADF to monitor and rebalance live trading portfolios. By using them in tandem, we can track the model drift much like we are doing with the recursive CUSUM. The RWEC can provide us with the real-time hedge ratio evolution. By using the rolling window technique, the RWEC looks at small, overlapping windows and calculates the eigenvectors for that specific slice of time.

In a perfect pair trade, this eigenvector (our weights) should remain stable. When the RWEC starts showing consistent shifts in these successive eigenvectors, it signals vector drift. This is often the early warning system that tells us our hedge is becoming inefficient. Before the massive structural break we saw in the NVDA/INTC Chow test, the RWEC analysis had shown the eigenvectors drifting as the market began to speculate on the partnership.

So, why not simply stick with RWEC instead of Chow and recursive CUSUM?

It is not a matter of choice. In fact, we should end using both of them, for different reasons and in different circumstances. The Chow test is a static tool that tells us the model is dead. Its role is confirmatory. On the other hand, the RWEC is a dynamic tool that tells us the model needs updating or rebalancing. It is already included in our tools of the trade for monitoring. Finally, the CUSUM is the fastest dynamic tool to alert us before a structural break. It really shines when included as part of the main pipeline for live trading monitoring, which is the subject of our next instalment: the automation of live trading monitoring.



Conclusion

In this article, we introduced the recursive CUSUM evaluation as a technique to help in the early detection of structural breaks in asset pairs’ hedge ratios or spreads. We compared it with the rolling windows eigenvector comparison (RWEC) as a tool with a similar application and verified its accuracy for almost real-time detection.

We used the partnership between Nvidia Co. (NVDA) and Intel Co. (INTC) as an example of a not-so-unexpected event that may cause a structural break, and we saw how this already priced-in announced partnership could be detected with great accuracy by the CUSUM technique.

With this method to detect structural breaks we conclude the basic knowledge required for an average retail trader to start experimenting with statistical arbitrage strategies. However, we cannot close this series without talking about the use of a specialized database for data analysis. This is a required tool if we want to go from local prototypes to real world trading. So, the inclusion of a specialized database in our pipeline will be the subject of our final article in this series.

Stay tuned because in the last part we’ll see how we can have a fully automated pipeline for screening, scoring, and live monitoring a virtually unlimited portfolio of symbols backed by data from several data sources beyond the regular price feed.

FilenameDescription
chow.pyPython script for running a Chow test over an asset pair
cusum_monitor.pyPython script for running a Chow test with CUSUM recursive (early warning) over an asset pair
pearson.pyPython script for running a Pearson correlation test over an asset pair
rwec_plot.pyPython script for running a Rolling Windos Eigenvector Comparison (RWEC) over asset pair or basket
Attached files |
Neural Networks in Trading: Hybrid Graph Sequence Models (GSM++) Neural Networks in Trading: Hybrid Graph Sequence Models (GSM++)
Hybrid graph sequence models (GSM++) combine the advantages of different architectures to provide high-fidelity data analysis and optimized computational costs. These models adapt effectively to dynamic market data, improving the presentation and processing of financial information.
Developing Market Memory Zones Indicator: Where Price Is Likely To Return Developing Market Memory Zones Indicator: Where Price Is Likely To Return
In this discussion, we will develop an indicator to identify price zones created by strong market activity, such as impulsive moves, structure shifts, and liquidity events. These zones represent areas where the market has left “memory” due to unfilled orders or rapid price displacement. By marking these regions on the chart, the indicator highlights where price is statistically more likely to revisit and react in the future.
Features of Experts Advisors Features of Experts Advisors
Creation of expert advisors in the MetaTrader trading system has a number of features.
Python-MetaTrader 5 Strategy Tester (Part 04): Tester 101 Python-MetaTrader 5 Strategy Tester (Part 04): Tester 101
In this fascinating article, we build our very first trading robot in the simulator and run a strategy testing action that resembles how the MetaTrader 5 strategy tester works, then compare the outcome produced in a custom simulation against our favorite terminal.