OPEN-SOURCE SCRIPT
Choppy Lights by Stay Toxic

MACD Angle Fluidity Index (MACD-AFI)
This proprietary indicator measures the stability and fluidity of momentum by analyzing the acceleration (or rate of change) of the MACD's Diff Line (Histogram). It is a non-lagging confirmation tool designed to help traders quickly identify market conditions suitable for directional trades (Green) versus those that are chaotic or trendless (Red). The score is normalized from 0 (Most Stable Angle) to 100 (Most Abrupt Angle Change).
How It Works
The indicator uses a robust background coloring system based on the calculated momentum angle change:
Angle Change Score (0-100): A custom formula calculates the difference between the current angle (slope) of the MACD Diff line and its previous angle. This "Angle Change" is then scaled from 0 to 100 based on the highest recent volatility observed, giving you a consistent fluidity reading.
Constancy Filter: A user-defined Constancy Period prevents flickering. The background color will only change if the calculated condition has been sustained for the specified number of bars.
Visual Alerts: The colors reflect your trading risk tolerance:
🟢 GREEN (Trade): Low Score (0 to Max Green). HIGH FLUIDITY. Angle is very stable. Momentum is smooth and predictable. Ideal conditions for trading.
🟡 YELLOW (Beware): Mid Score. MODERATE RISK. Angle is changing slightly. Momentum is slowing or uncertain. Exercise caution.
🔴 RED (Stay Out): High Score (Above Max Yellow). LOW FLUIDITY. Angle is abrupt (high volatility). Suggests chaotic action, whipsaws, or potential reversals. Avoid entering trades.
Customizable Inputs
The indicator provides complete control for calibration:
MACD & Angle Sensitivity: Adjust the standard MACD lengths, plus the Pente Period (for angle calculation smoothing) and Normalization Period (for setting the 0-100 scale).
Thresholds: Precise control over Max Green and Max Yellow values to define your trading zones.
Time Filter: The Constancy Period ensures changes are confirmed over a defined number of bars.
Visuals: Separate controls for color and global opacity.
This proprietary indicator measures the stability and fluidity of momentum by analyzing the acceleration (or rate of change) of the MACD's Diff Line (Histogram). It is a non-lagging confirmation tool designed to help traders quickly identify market conditions suitable for directional trades (Green) versus those that are chaotic or trendless (Red). The score is normalized from 0 (Most Stable Angle) to 100 (Most Abrupt Angle Change).
How It Works
The indicator uses a robust background coloring system based on the calculated momentum angle change:
Angle Change Score (0-100): A custom formula calculates the difference between the current angle (slope) of the MACD Diff line and its previous angle. This "Angle Change" is then scaled from 0 to 100 based on the highest recent volatility observed, giving you a consistent fluidity reading.
Constancy Filter: A user-defined Constancy Period prevents flickering. The background color will only change if the calculated condition has been sustained for the specified number of bars.
Visual Alerts: The colors reflect your trading risk tolerance:
🟢 GREEN (Trade): Low Score (0 to Max Green). HIGH FLUIDITY. Angle is very stable. Momentum is smooth and predictable. Ideal conditions for trading.
🟡 YELLOW (Beware): Mid Score. MODERATE RISK. Angle is changing slightly. Momentum is slowing or uncertain. Exercise caution.
🔴 RED (Stay Out): High Score (Above Max Yellow). LOW FLUIDITY. Angle is abrupt (high volatility). Suggests chaotic action, whipsaws, or potential reversals. Avoid entering trades.
Customizable Inputs
The indicator provides complete control for calibration:
MACD & Angle Sensitivity: Adjust the standard MACD lengths, plus the Pente Period (for angle calculation smoothing) and Normalization Period (for setting the 0-100 scale).
Thresholds: Precise control over Max Green and Max Yellow values to define your trading zones.
Time Filter: The Constancy Period ensures changes are confirmed over a defined number of bars.
Visuals: Separate controls for color and global opacity.
Script de código aberto
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Aviso legal
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.
Script de código aberto
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Aviso legal
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.