INVITE-ONLY SCRIPT

[GYTS-Pro] Market Regime Detector

33
🧊 Market Regime Detector (Professional Edition)
🌸 Part of GoemonYae Trading System (GYTS) 🌸


🌸 --------- INTRODUCTION --------- 🌸

💮 What is the Market Regime Detector?
The Market Regime Detector (Pro) is an elite, consensus-based market state analyzer designed to filter noise and identify the true underlying market structure. By distinguishing between trending (bullish or bearish) and cyclic (range-bound) market conditions with high precision, this detector acts as the "brain" of your trading system. Instead of forcing a single strategy across incompatible market conditions, the detector empowers you to deploy the right tactic at exactly the right time.

💮 The Importance of Market Regimes
Markets constantly shift between different behavioural states or "regimes":
Bullish trending markets - characterised by sustained upward price movement
Bearish trending markets - characterised by sustained downward price movement
Cyclic markets - characterised by range-bound, oscillating behaviour

Each regime requires fundamentally different trading approaches. Trend-following strategies excel in trending markets but fail in cyclic ones, while mean-reversion strategies shine in cyclic markets but underperform in trending conditions. However, detecting these regimes is easier said than done, and we have gone through hundreds of hours of testing to create the Market Regime Detector, using multiple very sophisticated methods in an easy-to-use indicator.

💮 Professional vs Community Edition
The Market Regime Detector comes in two versions: a comprehensive Professional Edition and a streamlined Community Edition.

Key advantages of the Professional Edition:
Enhanced detection accuracy - Utilises 5 advanced detection methods (compared to only 2 in the CE version)
Proprietary cycle measurement - Automatically detects the market's dominant cycle instead of requiring manual input
Superior consensus mechanism - Includes a unique "strength-weighted decision" mode that gives more influence to stronger signals
Reduced false signals - Multiple complementary methods working together provide more reliable regime identification
Advanced DSP algorithms - Implements sophisticated digital signal processing techniques for superior market analysis

The Professional Edition delivers significant improvements in detection accuracy, signal stability, and overall trading performance.


🌸 --------- KEY FEATURES --------- 🌸

💮 Consensus-Based Detection
Rather than relying on a single method, our detector employs multiple complementary detection methodologies that analyse different aspects of market behaviour:
• Advanced digital signal processing techniques
• Volatility and momentum analysis
• Adaptive filters and mathematical transformations
• Cycle identification
• Channel breakout detection

These diverse perspectives are synthesised into a robust consensus that minimises false signals while maintaining responsiveness to genuine regime changes.

💮 Proprietary Dominant Cycle Measurement (Pro Edition only)
At the heart of our Professional Edition detector is a proprietary dominant cycle measurement system that automatically and adaptively identifies the market's natural rhythm. This system provides a stable reference framework that continuously adapts to changing market conditions while avoiding the erratic behaviour of typical cycle-finding algorithms like Hilbert Transforms, Discrete Fourier Transforms, or autocorrelation measurements.

Unlike the Community Edition which requires manual input of a single, constant dominant cycle period, the Professional Edition automatically detects and continuously adapts this critical parameter. This automated and adaptive approach ensures optimal detection accuracy across different markets and timeframes without requiring user expertise in cycle analysis, and provides significantly better responsiveness to evolving market conditions.

💮 Intuitive Parameter System
We've distilled complex technical parameters into intuitive controls that traders can easily understand:
• Adaptability - how quickly the detector responds to changing market conditions
• Sensitivity - how readily the detector identifies transitions between regimes
• Consensus requirement - how much agreement is needed among detection methods

This approach makes the detector accessible to traders of all experience levels while preserving the power of the underlying algorithms.

💮 Visual Market Feedback
The detector provides clear visual feedback about the current market regime through:
• Colour-coded chart backgrounds (purple shades for bullish, pink for bearish, yellow for cyclic)
• Colour-coded price bars
• Strength indicators showing the degree of consensus
• Customisable color schemes to match your preferences or trading system

💮 Integration in the GYTS suite
What is of paramount importance, is that the Market Regime Detector is compatible with the GYTS Suite, i.e. it passes the regime into the Order Orchestrator where you can set how to trade the trending and cyclic regime. The intention is to integrate it with more indicators.


🌸 --------- CONFIGURATION SETTINGS --------- 🌸

💮 Adaptability
Controls how quickly the Market Regime detector adapts to changing market conditions. You can see it as a low-frequency, long-term change parameter:

• Very Low: Very slow adaptation, most stable but may miss regime changes
• Low: Slower adaptation, more stability but less responsiveness
• Normal: Balanced between stability and responsiveness
• High: Faster adaptation, more responsive but less stable
• Very High: Very fast adaptation, highly responsive but may generate false signals

This setting affects lookback periods and filter parameters across all detection methods.

💮 Sensitivity
Controls the conviction threshold required to trigger a regime change. This acts as a high-frequency, short-term filter for market noise:

• Very Low: Requires overwhelming evidence to identify a regime change.
• Low: Prioritizes stability; reduces false signals but may delay transition detection.
• Normal: Balanced sensitivity suitable for most liquid markets.
• High: Highly responsive; detects subtle regime changes early but may react to market noise.
• Very High: Extremely sensitive; detects minor fluctuations immediately.

Pro Feature Note: In the Strength-Weighted Decision mode, this setting acts as a dynamic calibrator. It not only adjusts individual method thresholds but also scales the global consensus threshold. A 'High' sensitivity lowers the barrier for the weighted consensus, allowing the system to react to early-stage breakouts even if not all methods fully agree yet.

💮 Consensus Mode
Determines how the signals from all detection methods are combined to produce the final market regime:

Any Method (OR): Signals bullish/bearish if any method detects that regime. If methods conflict, the stronger signal wins. More sensitive, catches more regime changes but may produce more false signals.
All Methods (AND): Signals only when all methods agree on the regime. More conservative, reduces false signals but might miss some legitimate regime changes.
Weighted Decision: Balances all methods with equal voting rights. Signals bullish/bearish when the weighted consensus reaches a fixed majority (0.5). Provides a middle ground between sensitivity and stability.
Strength-Weighted Decision (Pro Edition only): A "meritocratic" approach where methods reporting extreme confidence (high signal strength) are given proportionally more weight than those reporting weak signals. Unlike standard voting, a single clear signal from a highly reliable method can override indecision from others.
Note: The threshold for this decision is dynamically calibrated by your 'Sensitivity' setting, ensuring the logic adapts to your desired risk profile.

Each mode also calculates a continuous regime strength value that drives the color intensity in the 'unconstrained' display mode, giving you a visual heatmap of trend conviction.

💮 Display Mode
Choose how to display the market regime colours:

• Unconstrained regime: Shows the regime strength as a continuous gradient. This provides more nuanced visualisation where the intensity of the color indicates the strength of the trend.
• Consensus only: Shows only the final consensus regime with fixed colours based on the detected regime type.

imagen
imagen

The background and bar colours will change to indicate the current market regime:
Purple shades: Bullish trending market. In 'unconstrained' mode, darker purple indicates a stronger bullish trend.
Pink shades: Bearish trending market. In 'unconstrained' mode, darker pink indicates a stronger bearish trend.
Yellow: Cyclic (range-bound) market.

💮 Custom Color Options
The Market Regime Detector allows you to customize the color scheme to match your personal preferences or to coordinate with other indicators:

• Use custom colours: Toggle to enable your own color choices instead of the default scheme
• Transparency: Adjust the transparency level of all regime colours
• Bullish colours: Define custom colours for strong, medium, weak, and very weak bullish trends
• Bearish colours: Define custom colours for strong, medium, weak, and very weak bearish trends
• Cyclic color: Define a custom color for cyclic (range-bound) market conditions


🌸 --------- DETECTION METHODS --------- 🌸

💮 Five-Method Consensus Architecture
The Professional Edition employs a sophisticated multi-stage architecture to determine market regimes with high precision.

imagen

The detection process flows through four logical stages:

1. Market Data & Cycle Detection
Price data flows into the system where the Dominant Cycle Detector automatically identifies the market's natural rhythm. This adaptive cycle length calibrates all subsequent calculations, ensuring the detector remains in sync with changing market conditions without manual adjustments.

2. Five Detection Methods
Using the detected cycle, five complementary algorithms independently evaluate the market state:
Cyclic Centroid Analysis: Calculates the market's 'centre point' over its dominant cycle and measures price displacement to determine trend or equilibrium.
Spectral Momentum: Measures momentum across the market's frequency spectrum to identify trend concentration.
Energy Distribution Gauge: Gauges how price movement energy is distributed to flag cyclic or trending states.
Volatility Channel: Models the market's volatility state, using band breakouts to indicate a trend.
Phase Coherence Detector: Analyses phase relationships between adaptive low-pass filters to detect trend stability and identify early regime shifts.

3. Consensus Engine
The signals from all five methods are fed into the Consensus Engine. Depending on your configuration, it aggregates these votes using one of four logic modes (Any, All, Weighted, or Strength-Weighted) to filter out noise and confirm the true market regime.

4. Regime Output
The final result is broadcast as a clear market state:
Bullish (1): Trending upwards
Bearish (-1): Trending downwards
Cyclic (0): Range-bound or oscillating

This output drives the visual feedback on your chart and can be streamed directly to the Order Orchestrator for automated strategy switching.

💮 Synergy & Complementarity
What makes these methods powerful is not just their individual sophistication, but how they complement one another:
• Some excel at early detection while others provide confirmation
• Some analyse time-domain behaviour while others work in the frequency domain
• Some focus on momentum characteristics while others assess volatility patterns
• Some respond quickly to changes while others filter out market noise

This creates a comprehensive analytical framework that can detect regime changes more accurately than any single method. All methods utilize the automatically detected and continuously adaptive dominant cycle period, ensuring they remain precisely calibrated to current market conditions without manual intervention.


🌸 --------- USAGE GUIDE --------- 🌸

💮 Starting with Default Settings
The default settings (Normal for Adaptability, Sensitivity, and Consensus) provide a balanced starting point suitable for most markets and timeframes. Begin by observing how these settings identify regimes in your preferred instruments.

💮 Adjusting Parameters
• If you notice too many regime changes → Decrease Sensitivity or increase Consensus requirement
• If regime changes seem delayed → Increase Adaptability
• If a trending regime is not detected, the market is automatically assigned to be in a cyclic state. The majority of methods actually measure this explicitly.
• If you want to see more nuanced regime transitions → Try the "unconstrained" display mode (note that this will not affect the output to other indicators)

💮 Trading Applications

Regime-Specific Strategies:
Bullish Trending Regime - Use trend-following strategies, trail stops wider, focus on breakouts, consider holding positions longer, and emphasise buying dips
Bearish Trending Regime - Consider shorts, tighter stops, focus on breakdown points, sell rallies, implement downside protection, and reduce position sizes
Cyclic Regime - Apply mean-reversion strategies, trade range boundaries, apply oscillators, target definable support/resistance levels, and use profit-taking at extremes

Strategy Switching:
Create a set of rules for each market regime and switch between them based on the detector's signal. This approach can significantly improve performance compared to applying a single strategy across all market conditions. The Pro Edition's multiple detection methods and advanced consensus mechanisms provide more reliable regime transitions, leading to better strategy switching decisions.

GYTS Suite Integration:
• In the GYTS 🎼 Order Orchestrator, select the '🔗 STREAM-int 🧊 Market Regime' as the market regime source
• Note that the consensus output (i.e. not the "unconstrained" display) will be used in this stream
• Create different strategies for trending (bullish/bearish) and cyclic regimes. The GYTS 🎼 Order Orchestrator is specifically made for this.
• The output stream is actually very simple, and can possibly be used in indicators and strategies as well. It outputs 1 for bullish, -1 for bearish and 0 for cyclic regime.


🌸 --------- FINAL NOTES --------- 🌸

💮 Development Philosophy
The Market Regime Detector has been developed with several key principles in mind:

1. Robustness - The detection methods have been rigorously tested across diverse markets and timeframes to ensure reliable performance.
2. Adaptability - The detector automatically adjusts to changing market conditions, requiring minimal manual intervention.
3. Complementarity - Each detection method provides a unique perspective, with the collective consensus being more reliable than any individual method.
4. Intuitiveness - Complex technical parameters have been abstracted into easily understood controls.

💮 Ongoing Refinement
The Market Regime Detector is under continuous development. We regularly:
• Fine-tune parameters based on expanded market data using state-of-the-art Machine Learning techniques
• Research and integrate new detection methodologies
• Optimise computational efficiency for real-time analysis

Your feedback and suggestions are very important in this ongoing refinement process!

Exención de responsabilidad

La información y las publicaciones no constituyen, ni deben considerarse como asesoramiento o recomendaciones financieras, de inversión, de trading o de otro tipo proporcionadas o respaldadas por TradingView. Más información en Condiciones de uso.