PanBandsRegime for Market Regime Switching
- Indicatori
- Heping Pan
- Versione: 1.0
- Attivazioni: 5
Author: Heping Pan
Swingtum Prediction Pty Ltd, Australia
panhepingism@gmail.com02/01/2026
Description
Move beyond conventional indicators. PanBandsRegime.ex4 is a new innovative indicator for market regime switching. It is designed based the theory and design of Pan Bands of Asymmetric Volatility. The primary indicator for Pan Bands is provided separately as PanBands.ex4. Each of the two indicators PanBands.ex4 and PanBandsRegime.ex4 is self-contained, standalone. Together, they form the suite of Pan Bands indicators. For more details of PanBands.ex4, please visit https://www.mql5.com/en/market/product/160068
The Pan Bands of Asymmetric Volatility suite is not merely another technical tool—it is a trading application built upon a peer-reviewed, academically published financial research model [Heping Pan, (2012), "Yin-yang volatility in scale space of price-time: a core structure of financial market risk", China Finance Review International, Vol. 2 Iss: 4 pp. 377 – 405]. This foundation sets it apart, translating rigorous quantitative finance theory into practical market utility.
Traditional volatility measures, like Bollinger Bands®, are limited by their reliance on symmetric standard deviation. They fail to capture the fundamental asymmetry between upward and downward price movements, generate false signals at reversals, and exhibit inherent lag.
Our published research directly addresses these flaws by introducing a formalized Asymmetric Volatility (Yin-Yang Volatility) model. This indicator suite is the practical implementation of that model, offering traders a significant edge through a more accurate, responsive, and nuanced view of market dynamics.
Leveraging the Pan Bands output, the PanBandsRegime.ex4 indicator applies a logical layer to generate essential market regime switching signals. It algorithmically identifies:
- The initiation and maturation of trending regimes.
- Early-stage deterioration and potential reversal points.
This provides a systematic, research-validated framework for contextualizing price action—a critical component for robust manual trading or automated strategy development.
Key Advantages of PanBandsRegime Indicator:
- Academically Validated: Based on a formal, peer-reviewed volatility model, not just heuristic modification.
- Asymmetry-Aware: Explicitly models the distinct nature of upward (Yang) and downward (Yin) volatility.
- Reduced Noise & Lag: Minimizes false expansions and improves responsiveness at critical market turns.
- Structured Toolkit: Progresses from core analysis to precise trade management and regime classification.
For the sophisticated trader seeking tools with substantive intellectual underpinnings, PanBandsRegime represents a unique convergence of academic finance and practical trading technology. Implement a published research model directly on your charts.
Techincal Details:
Indicator PanBandsRegime determines the current market regime on the given time frame such as H1. Four types of market regime are distinguished: Up trend starts and keeps strong; Up trend is weakening and about to end; Down trend starts and keeps strong; Down trend is weakening and about to end. PanSwingtumRegime calculate sophisticated crossings of two PanBands with two different periods - a slow versus a fast one. The input parameters are
// Slow Pan Bands of YinYang Volatility
- extern int BandsPeriod1=96;
- extern int BandsShift1=0;
- extern double BandsDeviations1=2.0;
- extern int MAMethod1=MODE_LWMA;
- extern int PriceComp1=PRICE_CLOSE;
- extern double SLRatio = 0.25; // StopLoss levels are not used here
// Fast Pan Bands of YinYang Volatility
- extern int BandsPeriod2=48;
- extern int BandsShift2=0;
- extern double BandsDeviations2=2.0;
- extern int MAMethod2=MODE_LWMA;
- extern int PriceComp2=PRICE_CLOSE;
- extern double SLRatio = 025; // StopLoss levels are not used here
BandsPeriod1 and BandsPeriod2 are two key parameters that you may like to change value, while other parameters can be left untouched.
The output are two tradable signals:
- double goLong[]; // 100 means up trend is strong, 25 means trend is weakening
- double goShort[]; // -100 means down trend is strong, -25 means trend is weakening
In the Screenshot,switch of market regime is shown with red and green vertical lines (only for illustration purpose, not the output of the indicator). The first red vertical line (the left) signals the market regime switches from up trend to down trend. The second red vertical line signals the weakening of down trend. Vice versa are the green vertical lines for signaling the new up trend.
How to use PanBandsRegime as a regime switching indicator in real trading:
Let Regime be the value of PanBandsRegime indicator:
If Regime == +100 (display in Green and full vertical), then the up trend has started and is still strong, one may initiate one or more long trades;
If Regime == +25 (display in Green but with short vertical), then the up trend starts weakening and may be approach to end, one may still enter long trades, one should use tight takeprofit and stoploss; or one could simply not enter more long trades, but focuses on exiting the existing long trades.
If Regime == -100 (display in Red and full vertical), then the down trend has started and is still strong, one may initiate one or more short trades;
If Regime == -25 (display in Red and short vertical), then the down trend starts weakening and may be approach to end, one may still enter short trades, but one should use tight takeprofit and stoploss; or one could simply not enter more short trades, but focuses on exiting the existing short trades.
Of course, how to use this indicator in real trading is subject to the actual trading strategies and experience of the human trader or the automated EA.
---------------------------------------------------------------------------------------------------------------------------------------
Disclaimer for All the Trading Software of Swingtum Prediction Pty Ltd Australia
IMPORTANT NOTICE – PLEASE READ CAREFULLY
BY PURCHASING, DOWNLOADING, INSTALLING, OR USING THIS SOFTWARE (THE "SOFTWARE"), YOU (THE "USER") EXPLICITLY ACKNOWLEDGE, UNDERSTAND, AND UNCONDITIONALLY AGREE TO THE FOLLOWING TERMS. IF YOU DO NOT AGREE, YOU MUST IMMEDIATELY CEASE ALL USE OF THE SOFTWARE. NOTE THAT ALL SALEES ARE FINAL, NO REFUNDS WILL BE PROVIDED.
1. No Financial Advice & High Risk Warning
The Software is a technical tool for analysis and/or automated trading on the MetaTrader 4 (MT4) platform. It is provided for informational and educational purposes only. The Software and any accompanying materials DO NOT constitute financial advice, investment advice, trading advice, or any other type of advice. All trading decisions you make are your own sole responsibility. Trading foreign exchange (Forex), contracts for difference (CFDs), and other leveraged products carries a very high level of risk and may not be suitable for all investors. You can sustain losses that exceed your initial deposit. You should be aware of all risks associated with trading and seek independent advice from a qualified financial advisor if necessary.
2. No Guarantee of Performance or Profit
The developer, vendor, and all associated parties ("We," "Us," "Our") make no representations, warranties, or guarantees of any kind, express or implied, regarding the Software's performance, future profitability, or reliability. Past performance, whether simulated or real, is not indicative of future results. The User acknowledges that trading can result in the complete loss of their invested capital. We do not guarantee that the use of the Software will result in profits or will not result in losses.
3. User Assumes All Risk and Responsibility
The User accepts full, complete, and sole responsibility for any and all trades placed using the Software, including all losses, damages, and costs incurred. The User is solely responsible for understanding the functionality of the Software, configuring its settings (including stops, limits, lot sizes, and risk parameters), and monitoring its operation. The User agrees that they use the Software at their own risk.
4. Software "As Is"
The Software is provided on an "AS IS" and "AS AVAILABLE" basis without any warranty of any kind. We disclaim all warranties, including but not limited to, implied warranties of merchantability, fitness for a particular purpose, and non-infringement. We do not warrant that the Software will be error-free, uninterrupted, or compatible with all market conditions, brokers, or User hardware/software configurations.
5. Limitation of Liability
To the maximum extent permitted by applicable law, in no event shall We be liable for any direct, indirect, incidental, special, consequential, or punitive damages, or any loss of profits, revenue, data, or use, incurred by the User or any third party, arising from or related to the use or inability to use the Software, even if we have been advised of the possibility of such damages. Our total cumulative liability shall in no event exceed the purchase price paid by the User for the Software.
6. User's Representations
The User represents and warrants that they:
l Are of legal age in their jurisdiction to enter into this agreement.
l Have sufficient trading knowledge and experience to understand the risks involved.
l Have tested the Software on a demo account and understand its operation before any live use.
l Will use the Software in compliance with all applicable laws and regulations in their jurisdiction.
l Are solely responsible for ensuring their use of the Software complies with their broker's terms of service.
7. Third-Party Platforms & Market Risks
The Software operates on the MT4 platform and interacts with brokers' servers. We are not responsible for connectivity issues, execution delays, platform errors, broker insolvency, or any other issues originating from third-party platforms, brokers, or internet services. The User acknowledges the inherent risks of electronic trading, including slippage, requotes, and market gaps.
ACKNOWLEDGEMENT
BY USING THE SOFTWARE, YOU CONFIRM THAT YOU HAVE READ, UNDERSTOOD, AND IRREVOCABLY AGREE TO THIS DISCLAIMER. YOU ACKNOWLEDGE THAT YOU ARE THE SOLELY RESPONSIBLE PARTY FOR THE OUTCOMES OF YOUR TRADING ACTIVITIES.
Mr Heping Pan, the Author
Swingtum Prediction Pty Ltd, Australia
panhepingism@gmail.com
28 December 2025
