OPEN-SOURCE SCRIPT

TMA Dual Bands

75
TMA Dual Bands - Adaptive Channel Indicator with Crossover Signals

TMA Dual Bands represents my interpretation of the classic Triangular Moving Average methodology, specifically designed to identify high-probability trading setups through the interaction of two adaptive channel systems. Unlike traditional channel indicators that rely on static calculations, this tool dynamically adjusts to market volatility while maintaining the smooth, reliable characteristics that make TMA-based systems so effective.

The indicator combines a MAIN channel (slow-moving, representing the broader trend) with a FAST channel (responsive, capturing momentum shifts). When these two systems interact in specific ways, they generate clear trading signals that can be used across multiple timeframes and market conditions.

The Mathematics Behind the Indicator

At its core, this indicator uses a sophisticated approach to calculating Triangular Moving Averages. Rather than using the traditional double Simple Moving Average method, I've implemented a double Weighted Moving Average calculation. This means the TMA is computed by taking a WMA of another WMA, which provides better responsiveness to recent price action while maintaining the smooth, triangular weighting distribution that gives this indicator its name.

The weighted approach significantly reduces lag compared to double-smoothed simple moving averages, allowing the indicator to catch trend changes earlier without sacrificing reliability. This is particularly important for the FAST channel, where responsiveness is crucial for signal generation.

Adaptive Volatility Bands

What makes this indicator truly unique is its adaptive band calculation system. Instead of using a single standard deviation like traditional Bollinger Bands, the indicator maintains separate variance calculations for upward and downward price movements. When price rises above the TMA centerline, the upper band variance increases while the lower band variance decreases proportionally. The opposite occurs when price falls below the centerline.

This asymmetric approach allows the bands to better reflect actual market conditions. During uptrends, the upper band expands to accommodate bullish volatility while the lower band contracts, creating a channel that naturally "leans" in the direction of the trend. The same principle applies in reverse during downtrends.

The full calculation uses a smoothed variance over approximately four times the base period, ensuring that band adjustments are gradual rather than erratic. The multiplier parameter allows you to adjust the sensitivity of the bands to volatility, with higher values creating wider channels that generate fewer but higher-quality signals.

Understanding the Signals

The signal generation mechanism is elegantly simple yet remarkably effective. A bullish signal occurs when the lower FAST band crosses above the lower MAIN band. This crossover indicates that short-term momentum has shifted decisively upward, strong enough to break through the slower-moving baseline channel. These signals typically appear after consolidation periods or healthy pullbacks in uptrends, making them excellent continuation entry points.

Conversely, bearish signals trigger when the upper FAST band crosses below the upper MAIN band. This pattern suggests that upward momentum has exhausted itself and that sellers are beginning to dominate. These signals often appear near resistance levels or at the culmination of extended rallies, providing excellent risk-reward opportunities for counter-trend or trend-reversal trades.

The visual representation enhances signal clarity. The MAIN TMA centerline changes color dynamically based on its slope, displaying green during upward movement and red during downward movement. This gives you instant visual confirmation of the prevailing trend direction. The signal markers themselves appear as diamond shapes positioned just outside the MAIN channel bands, with cyan diamonds indicating buy opportunities below the lower band and blue diamonds marking sell opportunities above the upper band. You could consider taking bull signals only on long trend, and vice versa for the sell signals.

Practical Application

The indicator works across multiple trading approaches and timeframes. For trend-following strategies, the most reliable signals occur when they align with the MAIN TMA color. Taking only green-colored uptrend signals and red-colored downtrend signals significantly improves win rates by ensuring you're always trading with the dominant momentum.

For breakout traders, the most powerful setups occur after periods of compression when the FAST bands squeeze inside the MAIN bands. This compression indicates low volatility and tight consolidation. When a signal finally triggers after such compression, it often leads to explosive moves as the market breaks out of its range.

Mean reversion traders can also benefit from this indicator by taking counter-trend signals when price reaches extreme band levels. However, this approach requires careful risk management and works best in clearly ranging market conditions.

Configuration and Customization

The default parameters have been carefully selected through extensive testing, with the MAIN period set to 133 bars and the FAST period at 19 bars. These values create an effective balance between trend identification and momentum responsiveness. However, the indicator is fully customizable to suit different trading styles and market conditions.

Traders focusing on longer-term positions might increase both periods proportionally, while scalpers and day traders might reduce them. The price type parameter allows you to choose how price is calculated for the TMA, with the weighted option providing the most responsive results. The band multiplier controls how wide the channels expand, with values between 2.5 and 4.0 being most common depending on your preferred signal frequency.

Technical Integrity

A critical feature of this indicator is its complete absence of repainting. All signals are generated and confirmed on closed bars, meaning that once a signal appears in historical data, it will remain exactly where it appeared regardless of subsequent price action. This makes the indicator equally reliable for backtesting historical data and trading live markets, a characteristic that many "magic indicator" systems cannot claim.

The calculation methodology ensures that what you see on your chart is exactly what you would have seen in real-time when that bar closed. There are no retrospective adjustments, no future-peeking calculations, and no algorithmic tricks that make historical performance look better than actual trading results would have been.

Conclusion

TMA Dual Bands offers a sophisticated yet user-friendly approach to technical analysis, combining time-tested TMA methodology with modern adaptive volatility concepts. The dual-channel system provides clear visual representation of market structure while the crossover signals offer objective entry points that remove much of the guesswork from trading decisions.

Whether you're a discretionary trader looking for high-probability setups or a systematic trader seeking reliable signals for automated strategies, this indicator provides the clarity and consistency needed for confident decision-making in dynamic market conditions.

---

**Developed by AlgoAlex81**

*Disclaimer: This indicator is provided for educational and informational purposes only. Past performance does not guarantee future results. Always practice proper risk management and never risk more than you can afford to lose.*

Thông báo miễn trừ trách nhiệm

Thông tin và ấn phẩm không có nghĩa là và không cấu thành, tài chính, đầu tư, kinh doanh, hoặc các loại lời khuyên hoặc khuyến nghị khác được cung cấp hoặc xác nhận bởi TradingView. Đọc thêm trong Điều khoản sử dụng.