OPEN-SOURCE SCRIPT
Ema with Squeeze Color

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.
► 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.
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
*PM me after for access.*
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
*PM me after for access.*
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.