Rolling KPSS Statistic
Mar 24, 2026

The Rolling KPSS Statistic indicator is a trading indicator built to measure whether price action is behaving like a stable range, a controlled trend, or an unstable breakout environment. By applying the Kwiatkowski-Phillips-Schmidt-Shin (KPSS) test over a rolling window, it gives traders a real-time statistical view of market stationarity, helping them adapt their trading strategy to mean reversion, trend continuation, or regime change conditions.
How to Use the Rolling KPSS Statistic Trading Indicator
This trading indicator is designed to separate calm, statistically stable price behavior from unstable, expansion-driven price action. Instead of relying only on visual chart interpretation, the script continuously tests whether the market is reverting around a mean or trend, or moving in a way that suggests breakdown, breakout, or structural change.
For traders, this can be especially useful when deciding whether to use a range trading strategy, a trend-following strategy, or a breakout trading strategy. A lower KPSS reading generally points to a more stable environment, while a higher reading warns that the market may be entering a less predictable phase.
The script offers two main operating modes so traders can tailor the analysis to the type of market they want to detect.
Level Mode for Range Trading and Mean Reversion
Level Mode tests whether price is stationary around a constant mean. In simpler terms, it checks whether the market is repeatedly returning to the same general area instead of developing a persistent directional move.
This is the preferred setting for traders looking to identify:
- Ranging markets
- Mean-reverting behavior
- Horizontal support and resistance conditions
- Markets where fade setups may work better than breakout entries
When the KPSS statistic is low in Level Mode, it suggests price is staying contained within a relatively stable corridor. That can support trading strategies built around buying support, selling resistance, and expecting price to rotate back toward the center of the range.
Trend Mode for Stable Trend Analysis
Trend Mode tests whether price is stationary around a linear trend rather than a flat mean. This makes it more useful for traders who want to know whether an uptrend or downtrend is orderly and statistically stable, rather than chaotic or unsustainable.
A low KPSS value in Trend Mode suggests that price may be trending, but doing so in a controlled and mathematically consistent way. This can help traders identify:
- Stable trending channels
- Cleaner continuation conditions
- Markets where pullback entries may be more reliable
- Trends that are developing with structure instead of pure momentum disorder
This makes Trend Mode especially useful for swing traders and trend traders who want confirmation that a move still has statistical integrity.
Understanding the KPSS Test in Trading
The KPSS test works differently from many popular stationarity tests used in market analysis. Its null hypothesis assumes the series is stationary. That means the interpretation is inverted compared with tools like the Augmented Dickey-Fuller test.
For this indicator:
- A low KPSS value suggests price action is stationary
- A high KPSS value suggests non-stationary behavior
- Rising KPSS values often signal breakout conditions, instability, or regime change
This distinction matters because it helps traders avoid misreading market structure. A quiet market is not always tradable, and a trending market is not always unstable. The real value of this indicator is that it helps determine whether the current behavior is statistically consistent enough to support a specific trading strategy.
Critical Levels and What They Mean
The indicator plots three key significance thresholds: 10%, 5%, and 1%. These levels help traders judge whether the current market state still fits a stationary framework or whether that assumption has likely broken down.
- KPSS < 5% Level: The market is considered stationary. In Level Mode, this usually points to a range or mean-reverting structure. In Trend Mode, it points to a stable and orderly trend.
- KPSS > 5% Level: The null hypothesis of stationarity is rejected. This suggests non-stationary price action, which may reflect a breakout, reversal, expansion, or transition into a less structured environment.
- KPSS > 1% Level: This is a stronger warning that price is deviating significantly from stationarity. Traders may see this during aggressive directional moves, volatility expansions, or structural regime shifts.
These thresholds make the indicator practical for real chart work because they transform statistical output into actionable trading context.
Visual Feedback and Market State Clarity
The indicator uses a Viridis gradient theme to make interpretation faster during live analysis.
- Brighter colors (yellow/green): More stationary behavior, often associated with range conditions or stable trend structure depending on the selected mode
- Darker colors (purple/blue): More non-stationary behavior, often associated with breakouts, instability, or trend acceleration
This visual system helps traders quickly scan for changing market regimes without needing to interpret every reading manually. The included real-time dashboard adds another layer of clarity by summarizing the current state of the market at a glance.
Indicator Details for Statistical Market Analysis
The Rolling KPSS Statistic indicator recalculates its test value across a moving window, which allows it to update as new price data comes in. This rolling design is what makes it useful as a live trading indicator rather than a one-time statistical study.
Because the market is always changing, the script gives traders a way to monitor whether the current environment is becoming more mean-reverting, more trend-stable, or more unstable over time. This can be valuable for filtering entries, avoiding the wrong strategy in the wrong regime, and improving trade selection.
For example:
- A trader using Bollinger Bands or support/resistance may prefer lower KPSS readings in Level Mode
- A trend trader using pullbacks may prefer lower KPSS readings in Trend Mode
- A breakout trader may become more interested when KPSS rises above the key rejection thresholds and signals a loss of stationarity
Settings
Main Settings
- Window Length: The number of bars used for the rolling calculation. The default value of 100 offers a strong balance between responsiveness and statistical stability across many chart timeframes.
- Source: The selected price input for the calculation, with Close used by default.
- Test Type: Choose between Level for range and mean-reversion analysis, or Trend for evaluating trending stationarity.
- Newey-West Bandwidth: A lag truncation parameter that helps account for serial correlation in the residuals, improving the robustness of the KPSS calculation.
Visuals & Dashboard
- Show Critical Levels: Turns the 10%, 5%, and 1% significance lines on or off.
- Dashboard: Enables or disables the summary table displayed on the chart.
- Position/Size: Lets traders adjust the dashboard location and scale for better chart visibility.
Why Traders Use the Rolling KPSS Statistic Indicator
This trading indicator can be useful for traders who want more than basic price action interpretation. It adds a layer of statistical market analysis that helps answer an important question: is the market behaving in a stable way that suits my trading strategy, or is it becoming unstable and harder to model?
That makes it relevant for several styles of trading:
- Mean reversion trading
- Range trading
- Trend-following strategies
- Breakout trading
- Regime filtering and market condition analysis
Rather than treating every chart the same way, traders can use the Rolling KPSS Statistic indicator to align their approach with the current environment.
FAQ
What does the Rolling KPSS Statistic indicator measure?
It measures the stationarity of price action over a rolling window using the KPSS test. In trading terms, it helps determine whether the market is acting like a range, a stable trend, or a non-stationary expansion or regime shift.
What is the difference between Level Mode and Trend Mode?
Level Mode checks whether price is stationary around a flat average, making it better for spotting ranges and mean-reverting behavior. Trend Mode checks whether price is stationary around a linear trend, making it more useful for identifying orderly and sustainable trends.
Is a high KPSS value bullish or bearish?
A high KPSS value is not inherently bullish or bearish. Instead, it signals non-stationary behavior. That usually means the market is becoming less stable and may be breaking out, reversing, or shifting regime. Traders should combine it with price action and trend context.
How can this trading indicator improve a trading strategy?
It can improve a trading strategy by helping traders choose the right approach for the current market regime. For example, low KPSS values may support mean reversion or stable trend strategies, while high KPSS values may warn that breakout or expansion conditions are taking over.
How do you access the Rolling KPSS Statistic indicator?
You can get access on the LuxAlgo Library for charting platforms like TradingView, MetaTrader (MT4/MT5), and NinjaTrader for free.
Trading & investing are risky and many will lose money in connection with trading and investing activities. All content on this site is not intended to, and should not be, construed as financial advice. Decisions to buy, sell, hold or trade in securities, commodities and other investments involve risk and are best made based on the advice of qualified financial professionals. Past performance does not guarantee future results.
Hypothetical or Simulated performance results have certain limitations. Unlike an actual performance record, simulated results do not represent actual trading. Also, since the trades have not been executed, the results may have under-or-over compensated for the impact, if any, of certain market factors, including, but not limited to, lack of liquidity. Simulated trading programs in general are designed with the benefit of hindsight, and are based on historical information. No representation is being made that any account will or is likely to achieve profit or losses similar to those shown.
Testimonials appearing on this website may not be representative of other clients or customers and is not a guarantee of future performance or success.
As a provider of technical analysis tools and strategies, we do not have access to the personal trading accounts or brokerage statements of our customers. As a result, we have no reason to believe our customers perform better or worse than traders as a whole based on any content, tool, or platform feature we provide.
Charts used on this site are by TradingView in which the majority of our technical indicators are built on. TradingView® is a registered trademark of TradingView, Inc. www.TradingView.comTradingView® has no affiliation with the owner, developer, or provider of the Services described herein.
Market data is provided by CBOE, CME Group, BarChart, CoinAPI. CBOE BZX real-time US equities data is licensed from CBOE and provided through BarChart. Real-time futures data is licensed from CME Group and provided through BarChart. Select cryptocurrency data, including major coins, is provided through CoinAPI. All data is provided “as is” and should be verified independently for trading purposes.
This does not represent our full Disclaimer. Please read our full disclaimer.
© 2026 LuxAlgo Global, LLC.

