OPEN-SOURCE SCRIPT

Ema with Squeeze Color

403
This indicator transforms a standard Exponential Moving Average (EMA) into a dynamic, multi-dimensional trend line. Instead of just showing average price, the line's color acts as a heat map for two critical market forces: Volatility Compression (the "Radar") and Normalized Momentum (the "Engine"). By combining these elements directly into the EMA structure, traders can visually identify whether the current trend is accelerating, chopping, or coiling up for a massive breakout, all without taking their eyes off the price action.

► Underlying Logic & Calculations
This script does not rely on standard overbought/oversold logic. The color engine is driven by three distinct mathematical layers:

The Baseline Structure: The foundation is a standard EMA (default 20-period), which tracks the immediate trend direction.

The "Engine" (Normalized Momentum): The script measures raw momentum (ta.mom) and normalizes it against a 20-period standard deviation (volatility). This outputs a 0 to 100% "Engine Power" score, representing how aggressive the current momentum is relative to recent market volatility.

The "Radar" (Pressure Squeeze Index): To detect consolidations and impending breakouts, the script calculates dynamic upper and lower recursive envelopes using a customizable convergence factor. It takes the logarithmic difference between these envelopes and calculates its linear correlation against the bar index to generate a 0 to 100 Pressure Squeeze Index (PSI).

► The Color Matrix & Priority System
The indicator assigns colors based on a strict priority system to filter out noise:

Priority 1 (The Radar Squeeze): If the Squeeze Index exceeds the high threshold (default 70%), the line turns Yellow. This overrides all momentum calculations, warning the trader that volatility is heavily compressed and a breakout is imminent.

Priority 2 & 3 (The Engine Power): If the market is not squeezing, the script checks the direction of the momentum (Bullish vs. Bearish) and assigns a color gradient based on the Engine score:

Strong Explosion (Neon Cyan / Laser Red): Normalized momentum is above 80%. Aggressive trend continuation.

Standard Trend (Green / Pink): Normalized momentum is above 40%. Healthy trend.

Weak / Chop (Lime / Orange to Teal / Light Orange): Normalized momentum is extremely low. The market is exhausted or drifting.

► How to Use It

The Squeeze Play: Look for the EMA to turn Yellow during periods of tight consolidation. Wait for the color to violently shift into a "Strong Explosion" color (Neon Cyan for longs, Laser Red for shorts) to trade the breakout.

Trend Management: Stay in winning trades while the line remains in the strong or medium trend colors. Consider taking profits or trailing stops tightly once the line fades into the "Weak" or "Chop" colors, indicating the momentum engine is running out of gas.

免责声明

这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。