AdaptiveZigZagWithPatternPrediction
- Indicators
- Version: 1.0
- Activations: 5
This indicator is a comprehensive analytical tool for technical analysis that combines three classical approaches into a unified system:
- Adaptive ATR-ZigZag — a modified classical ZigZag where the reversal threshold dynamically adjusts to current market volatility through ATR (Average True Range). This allows filtering market noise and highlighting only significant reversals.
- Bollinger Bands based on ZigZag — a volatility channel built not from a moving average, but from the last confirmed ZigZag extremes. This provides more accurate boundaries for expected price movement.
- PatternPredict Predictor — a module for forecasting future reversal points by matching the current price structure with a library of historical patterns. The forecast is presented as uniform price targets (Uniform Step Mode) without using Fibonacci coefficients.
What the Indicator is Used For
- Trend identification — ZigZag direction and its extremes show the current market direction.
- Reversal point detection — BUY/SELL signals are generated when new extremes form.
- Volatility assessment — Bollinger Band width and ATR value show current market activity.
- Target forecasting — the PatternPredict module shows where price may stop or reverse in the future.
- Visual control — information panel, signal color indication, pip labels, and forecast arrows provide a complete market picture in one place.
Applicability to Markets and Instruments
Forex
- Major pairs: EURUSD, GBPUSD, USDJPY, USDCHF — high liquidity, clear trends, the indicator works most stably.
- Cross pairs: EURGBP, EURJPY, GBPJPY — well suited for medium-term timeframes (H1–H4).
- Exotic pairs: not recommended due to low liquidity and sharp gaps that distort ATR.
Cryptocurrencies
- BTCUSD, ETHUSD — high volatility, the indicator adapts through ATR, but requires increasing the ATR period.
- Altcoins — work on higher timeframes (H4, D1), too much noise on lower timeframes.
Commodities
- Gold (XAUUSD), Silver (XAGUSD) — work well, trends are clearly expressed.
- Oil (USOIL, BRENT) — effective on H1–D1.
Indices
- S&P500, NASDAQ, DAX — the indicator works well on daily and 4-hour charts.
Recommended Timeframes
- M15–H1 — for intraday trading.
- H4–D1 — for swing trading and medium-term positions.
- W1–MN1 — for determining the global trend.
Positive Aspects
- Adaptability to volatility — unlike classical ZigZag with a fixed threshold, this indicator automatically adjusts to the current market through ATR and adaptive multiplier.
- Error protection — the code implements thorough data validation: MathIsValidNumber , array bounds checking, division-by-zero protection, price and time validation.
- Optimized chart operation — graphical objects are updated rather than recreated, eliminating flickering and spontaneous chart scale changes when parameters are modified.
- Correct weekend handling — using iTime() instead of TimeCurrent() for object anchoring to bars eliminates issues with weekend gaps.
- Universality — the indicator works equally well on instruments with different numbers of decimal places (forex, cryptocurrencies, indices).
- Clarity — information panel, color signal indication, pip labels, and forecast arrows give traders a complete picture without the need for additional calculations.
- Uniform step mode — rejection of Fibonacci coefficients in favor of uniform steps makes forecasts more predictable and easier to interpret.
- Real-time operation — the current extreme updates as new bars form, allowing you to see the current market state.
Negative Aspects and Limitations
- Repainting of the last extreme — like any ZigZag, the last (current) extreme can move until it's confirmed. This is a fundamental property of the indicator, not an error.
- Signal lag — reversal is confirmed only after passing the ATR threshold, so the entry point will always be later than the actual extreme. This is the price for noise filtering.
- PatternPredict forecast is probabilistic — the forecasting module is based on matching with historical patterns, which doesn't guarantee execution. Forecast confidence rarely exceeds 70–80%.
- Not a trading system — the indicator provides analytical information but doesn't contain risk management rules, position sizing, stop-losses, or take-profits. Requires integration into your own trading strategy.
- Parameter dependency — results strongly depend on selected values of AtrPeriod , MinPeriod , MaxPeriod . Suboptimal parameters can generate too many false signals or, conversely, miss real reversals.
- Computational load — the PatternPredict module with a library of 50 patterns and matching requires CPU resources. On weak computers or with many open charts, terminal slowdown is possible.
- Poor performance in ranging markets — in sideways markets without a clear trend, ZigZag generates many false reversals, and forecasts lose meaning.
- Doesn't account for fundamental factors — the indicator works only with price, ignoring news, economic events, and market sentiment that can cause sharp movements contrary to technical forecasts.
Usage Recommendations
- Combine with other indicators — oscillators (RSI, MACD, Stochastic) for signal confirmation.
- Use on higher timeframes — H1 and above give the most reliable signals.
- Don't trade solely on indicator signals — always use stop-losses and risk management.
- Avoid trading during major news events — fundamental events can ignore the technical picture.
- Test on a demo account — before using on a real account, be sure to test the indicator in conditions close to real ones.
The indicator is a powerful analytical tool for traders who understand technical analysis principles and use it as part of a comprehensive trading system, not as the sole source of signals.
