OPEN-SOURCE SCRIPT
업데이트됨 Stable Yield Curve Regime

Overview
The Stable Yield Curve Regime Indicator identifies the dominant Treasury yield-curve regime while filtering out the noise produced by daily regime classifiers.
Instead of changing regimes after every small yield movement, it uses:
The default curve compares the US 2-year and 10-year Treasury yields, but both symbols are customizable.
Regime Definitions
Bull Steepener
Yields are generally falling while the long-minus-short spread is widening. This commonly occurs when short-term yields fall faster than long-term yields.
Bull Flattener
Yields are generally falling while the long-minus-short spread is narrowing. This commonly occurs when long-term yields fall faster than short-term yields.
Bear Steepener
Yields are generally rising while the long-minus-short spread is widening. This commonly occurs when long-term yields rise faster than short-term yields.
Bear Flattener
Yields are generally rising while the long-minus-short spread is narrowing. This commonly occurs when short-term yields rise faster than long-term yields.
“Bull” and “bear” refer to bond prices, not necessarily equities.
Calculation Method
The indicator smooths the selected short-end and long-end yields, then measures their changes over the selected observation horizon.
Level Move = (change in short yield + change in long yield) / 2
Curve Move = change in long yield − change in short yield
Bull versus bear is determined by the average movement of both yields. Therefore, an observation can still be classified when the two yields move in opposite directions, provided their average movement passes the selected threshold.
Each analysis bar creates one regime observation. When the observation horizon is greater than one, consecutive observations overlap.
Stability Filters
Minimum Movement Thresholds
An observation is treated as neutral when either the Level Move or Curve Move is smaller than its selected basis-point threshold.
Rolling Dominance
The indicator evaluates regime observations over a configurable rolling window. The regime with the highest score becomes the current leader.
Observation Weighting
Equal voting gives every valid observation one vote.
Magnitude weighting gives larger combined yield-level and curve movements more influence.
Minimum Coverage
A minimum percentage of the rolling window must contain valid, non-neutral observations.
Minimum Dominance
The leading regime must control a minimum share of the classified vote weight.
Minimum Lead
The leading regime must exceed the runner-up by the selected percentage-point margin.
Confirmation Bars
A new regime must remain qualified for several consecutive analysis bars before replacing the stable regime.
Main Settings
Default Configuration
With daily analysis, the default dominance window represents 30 daily regime observations, with each observation measuring a five-day yield movement.
Indicator Outputs
The panel displays:
Default colors:
Non-Repainting Behavior
The script uses the previous completed analysis-timeframe bar. This prevents unfinished higher-timeframe data from changing historical results but introduces a one-analysis-bar delay.
The chart timeframe must be equal to or lower than the selected analysis timeframe for the intended calculation to operate correctly.
For example:
Interpretation Notes
The indicator measures changes in the curve, not only its current shape.
A curve can steepen while remaining inverted. For example, a move from −100 basis points to −70 basis points is a steepening even though the spread remains negative.
The dashboard’s curve-spread reading should therefore be considered alongside the regime.
The indicator is descriptive rather than predictive. It does not independently forecast recessions, inflation, central-bank decisions or asset prices.
Suggested Uses
It should not be treated as a standalone entry or exit signal.
Alerts
Alerts are available for confirmed changes into:
Alerts trigger only after the new stable regime passes all filters and confirmation requirements.
Disclaimer
This indicator is provided for informational and educational purposes only. It does not constitute investment advice or a recommendation to buy or sell any financial instrument.
Yield-curve regimes describe historical market behavior and do not guarantee future economic or investment outcomes.
The Stable Yield Curve Regime Indicator identifies the dominant Treasury yield-curve regime while filtering out the noise produced by daily regime classifiers.
Instead of changing regimes after every small yield movement, it uses:
- Smoothed yields
- Multi-period yield changes
- Minimum movement thresholds
- Rolling regime voting
- Optional magnitude weighting
- Dominance and confirmation filters
The default curve compares the US 2-year and 10-year Treasury yields, but both symbols are customizable.
Regime Definitions
Bull Steepener
Yields are generally falling while the long-minus-short spread is widening. This commonly occurs when short-term yields fall faster than long-term yields.
Bull Flattener
Yields are generally falling while the long-minus-short spread is narrowing. This commonly occurs when long-term yields fall faster than short-term yields.
Bear Steepener
Yields are generally rising while the long-minus-short spread is widening. This commonly occurs when long-term yields rise faster than short-term yields.
Bear Flattener
Yields are generally rising while the long-minus-short spread is narrowing. This commonly occurs when short-term yields rise faster than long-term yields.
“Bull” and “bear” refer to bond prices, not necessarily equities.
Calculation Method
The indicator smooths the selected short-end and long-end yields, then measures their changes over the selected observation horizon.
Level Move = (change in short yield + change in long yield) / 2
- Negative Level Move: yields are generally falling
- Positive Level Move: yields are generally rising
Curve Move = change in long yield − change in short yield
- Positive Curve Move: steepening
- Negative Curve Move: flattening
Bull versus bear is determined by the average movement of both yields. Therefore, an observation can still be classified when the two yields move in opposite directions, provided their average movement passes the selected threshold.
Each analysis bar creates one regime observation. When the observation horizon is greater than one, consecutive observations overlap.
Stability Filters
Minimum Movement Thresholds
An observation is treated as neutral when either the Level Move or Curve Move is smaller than its selected basis-point threshold.
Rolling Dominance
The indicator evaluates regime observations over a configurable rolling window. The regime with the highest score becomes the current leader.
Observation Weighting
Equal voting gives every valid observation one vote.
Magnitude weighting gives larger combined yield-level and curve movements more influence.
Minimum Coverage
A minimum percentage of the rolling window must contain valid, non-neutral observations.
Minimum Dominance
The leading regime must control a minimum share of the classified vote weight.
Minimum Lead
The leading regime must exceed the runner-up by the selected percentage-point margin.
Confirmation Bars
A new regime must remain qualified for several consecutive analysis bars before replacing the stable regime.
Main Settings
- Short-end yield: Default is
US02Y
- Long-end yield: Default is
US10Y
- Analysis timeframe: Timeframe used for all calculations
- Yield smoothing: Smooths each yield before measuring changes
- Observation horizon: Period over which yield changes are measured
- Dominance window: Number of regime observations evaluated
- Minimum yield move: Filters small general yield movements
- Minimum curve move: Filters small steepening or flattening movements
- Observation weighting: Equal votes or magnitude weighted
- Minimum coverage: Required proportion of valid observations
- Minimum dominant share: Required share held by the leading regime
- Minimum lead: Required advantage over the runner-up
- Confirmation bars: Consecutive bars required before switching
- Hold previous regime when unclear: Retains the last stable regime until another qualifies
Default Configuration
- Analysis timeframe: Daily
- Yield smoothing: 3 bars
- Observation horizon: 5 bars
- Dominance window: 30 bars
- Minimum yield move: 1 basis point
- Minimum curve move: 1 basis point
- Weighting: Magnitude weighted
- Minimum coverage: 50%
- Minimum dominant share: 45%
- Minimum lead: 10 percentage points
- Confirmation: 3 bars
With daily analysis, the default dominance window represents 30 daily regime observations, with each observation measuring a five-day yield movement.
Indicator Outputs
The panel displays:
- Dominant regime share
- Classified coverage
- Optional individual regime shares
- Background color representing the stable regime
- Labels when the stable regime changes
- A dashboard showing the leader, stable regime, confidence, curve spread and pending switches
Default colors:
- Green: Bull steepener
- Blue: Bull flattener
- Orange: Bear steepener
- Red: Bear flattener
- Gray: Unclear
Non-Repainting Behavior
The script uses the previous completed analysis-timeframe bar. This prevents unfinished higher-timeframe data from changing historical results but introduces a one-analysis-bar delay.
The chart timeframe must be equal to or lower than the selected analysis timeframe for the intended calculation to operate correctly.
For example:
- 1-hour chart with daily analysis: Supported
- Daily chart with daily analysis: Supported
- Daily chart with weekly analysis: Supported
- Weekly chart with daily analysis: Not supported reliably
Interpretation Notes
The indicator measures changes in the curve, not only its current shape.
A curve can steepen while remaining inverted. For example, a move from −100 basis points to −70 basis points is a steepening even though the spread remains negative.
The dashboard’s curve-spread reading should therefore be considered alongside the regime.
The indicator is descriptive rather than predictive. It does not independently forecast recessions, inflation, central-bank decisions or asset prices.
Suggested Uses
- Treasury and bond-futures analysis
- Equity-index macro analysis
- Sector-rotation analysis
- Duration positioning
- Monetary-policy expectations
- Cross-asset regime analysis
It should not be treated as a standalone entry or exit signal.
Alerts
Alerts are available for confirmed changes into:
- Bull steepener
- Bull flattener
- Bear steepener
- Bear flattener
Alerts trigger only after the new stable regime passes all filters and confirmation requirements.
Disclaimer
This indicator is provided for informational and educational purposes only. It does not constitute investment advice or a recommendation to buy or sell any financial instrument.
Yield-curve regimes describe historical market behavior and do not guarantee future economic or investment outcomes.
릴리즈 노트
OVERVIEWThe Yield Curve Regime Indicator identifies the dominant Treasury yield-curve regime while filtering out the noise produced by daily regime classifiers.
Instead of changing regimes after every small yield movement, it uses:
- Smoothed yields
- Multi-period yield changes
- Minimum movement thresholds
- Rolling regime voting
- Optional magnitude weighting
- Dominance and confirmation filters
The default curve compares the US 2-year and 10-year Treasury yields, but both symbols are customizable.
REGIME DEFINITIONS
Bull Steepener
Yields are generally falling while the long-minus-short spread is widening. This commonly occurs when short-term yields fall faster than long-term yields.
Bull Flattener
Yields are generally falling while the long-minus-short spread is narrowing. This commonly occurs when long-term yields fall faster than short-term yields.
Bear Steepener
Yields are generally rising while the long-minus-short spread is widening. This commonly occurs when long-term yields rise faster than short-term yields.
Bear Flattener
Yields are generally rising while the long-minus-short spread is narrowing. This commonly occurs when short-term yields rise faster than long-term yields.
“Bull” and “bear” refer to bond prices, not necessarily equities.
CALCULATION METHOD
The indicator smooths the selected short-end and long-end yields, then measures their changes over the selected observation horizon.
Level Move = (change in short yield + change in long yield) / 2
- Negative Level Move: yields are generally falling
- Positive Level Move: yields are generally rising
Curve Move = change in long yield − change in short yield
- Positive Curve Move: steepening
- Negative Curve Move: flattening
Bull versus bear is determined by the average movement of both yields. Therefore, an observation can still be classified when the two yields move in opposite directions, provided their average movement passes the selected threshold.
Each analysis bar creates one regime observation. When the observation horizon is greater than one, consecutive observations overlap.
STABILITY FILTERS
Minimum Movement Thresholds
An observation is treated as neutral when either the Level Move or Curve Move is smaller than its selected basis-point threshold.
Rolling Dominance
The indicator evaluates regime observations over a configurable rolling window. The regime with the highest score becomes the current leader.
Observation Weighting
Equal voting gives every valid observation one vote. Magnitude weighting gives larger combined yield-level and curve movements more influence.
Minimum Coverage
A minimum percentage of the rolling window must contain valid, non-neutral observations.
Minimum Dominance
The leading regime must control a minimum share of the classified vote weight.
Minimum Lead
The leading regime must exceed the runner-up by the selected percentage-point margin.
Confirmation Bars
A new regime must remain qualified for several consecutive analysis bars before replacing the stable regime.
MAIN SETTINGS
- Short-end yield: Default is
US02Y
- Long-end yield: Default is
US10Y
- Analysis timeframe: Timeframe used for all calculations
- Yield smoothing: Smooths each yield before measuring changes
- Observation horizon: Period over which yield changes are measured
- Dominance window: Number of regime observations evaluated
- Minimum yield move: Filters small general yield movements
- Minimum curve move: Filters small steepening or flattening movements
- Observation weighting: Equal votes or magnitude weighted
- Minimum coverage: Required proportion of valid observations
- Minimum dominant share: Required share held by the leading regime
- Minimum lead: Required advantage over the runner-up
- Confirmation bars: Consecutive bars required before switching
- Hold previous regime when unclear: Retains the last stable regime until another qualifies
Default Configuration
- Analysis timeframe: Daily
- Yield smoothing: 3 bars
- Observation horizon: 5 bars
- Dominance window: 30 bars
- Minimum yield move: 1 basis point
- Minimum curve move: 1 basis point
- Weighting: Magnitude weighted
- Minimum coverage: 50%
- Minimum dominant share: 45%
- Minimum lead: 10 percentage points
- Confirmation: 3 bars
With daily analysis, the default dominance window represents 30 daily regime observations, with each observation measuring a five-day yield movement.
INDICATOR OUTPUTS
The panel displays:
- Dominant regime share
- Classified coverage
- Optional individual regime shares
- Background color representing the stable regime
- Labels when the stable regime changes
- A dashboard showing the leader, stable regime, confidence, curve spread and pending switches
Default colors:
- Green: Bull steepener
- Blue: Bull flattener
- Orange: Bear steepener
- Red: Bear flattener
- Gray: Unclear
NON-REPAINTING BEHAVIOR
The script uses the previous completed analysis-timeframe bar. This prevents unfinished higher-timeframe data from changing historical results but introduces a one-analysis-bar delay.
The chart timeframe must be equal to or lower than the selected analysis timeframe for the intended calculation to operate correctly.
For example:
- 1-hour chart with daily analysis: Supported
- Daily chart with daily analysis: Supported
- Daily chart with weekly analysis: Supported
- Weekly chart with daily analysis: Not supported reliably
INTERPRETATION NOTES
The indicator measures changes in the curve, not only its current shape.
A curve can steepen while remaining inverted. For example, a move from −100 basis points to −70 basis points is a steepening even though the spread remains negative.
The dashboard’s curve-spread reading should therefore be considered alongside the regime.
The indicator is descriptive rather than predictive. It does not independently forecast recessions, inflation, central-bank decisions or asset prices.
SUGGESTED USES
- Treasury and bond-futures analysis
- Equity-index macro analysis
- Sector-rotation analysis
- Duration positioning
- Monetary-policy expectations
- Cross-asset regime analysis
It should not be treated as a standalone entry or exit signal.
ALERTS
Alerts are available for confirmed changes into:
- Bull steepener
- Bull flattener
- Bear steepener
- Bear flattener
Alerts trigger only after the new stable regime passes all filters and confirmation requirements.
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.