OPEN-SOURCE SCRIPT

CMF (with colors)

Notice: This script is for educational purposes only and does not constitute financial or investment advice; trade at your own risk.

Chaikin Money Flow with Conditional Highlights
Name:
Chaikin Money Flow (CMF) - Dynamic Color Highlights

Overview:
This indicator is an enhanced version of the Chaikin Money Flow (CMF), used to analyze the flow of money into or out of an asset based on price movement and volume. It visually highlights CMF values and candlestick trends, making it easier to spot overbought, neutral, or weak conditions in the market.

Key Features:
Dynamic CMF Line Coloring:

The CMF line changes color based on its value, providing a visual signal for different market conditions:
Above 0.40 → Red: Strong overbought conditions.
0.30 - 0.40 → Orange: Warning zone.
0.28 - 0.30 → Yellow: Neutral area.
0.24 - 0.28 → Green: Caution (weak flow).
Below 0.24 → Blue: Weak flow, likely bearish.
Candlestick Color Alerts:

Candles are colored dynamically based on CMF values:
Red: Strong overbought (CMF ≥ 0.40).
Orange: Warning (CMF ≥ 0.30).
Yellow: Neutral (CMF ≥ 0.28).
Green: Caution (CMF ≥ 0.24).
Gray: Default condition (CMF below 0.24).
Reference Lines:

Horizontal lines are added for key CMF thresholds:
0.40: Overbought (solid red line).
0.33: Warning (dotted orange line).
0.30: Neutral zone (dotted yellow line).
0.28: Caution (dotted green line).
0.24: Weak flow area (dotted green line).
0.00: Zero line for baseline reference.
How It Works:
Money Flow Multiplier:

The script calculates how close the closing price is to the high or low price of the candle. If the price is near the high, money is considered flowing in; if near the low, money is flowing out.
Money Flow Volume:

The multiplier is adjusted using the trading volume. This ensures that high-volume days have a stronger influence on the CMF.
Sum Over Period:

The CMF is calculated as the ratio of the Money Flow Volume to the total volume over a specified period (default is 20 candles).
Dynamic Alerts:

Based on the CMF value, both the candlestick colors and CMF line change to alert traders to market conditions visually.
Settings:
Length: Default period for CMF calculation is 20 candles (user-adjustable).
Colors: Predefined colors for CMF line and candles to highlight market behavior.
Usage:
Above 0: Positive money flow → Buyers are stronger.
Below 0: Negative money flow → Sellers are stronger.
Use the color changes to spot market trends:
Red → Potential overbought (trend exhaustion).
Green/Blue → Weak money flow (caution for reversals).
Candlestick analysisChart patternsCycles

Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in publication is governed by House rules. You can favorite it to use it on a chart.

Want to use this script on a chart?


Y.W.E

Disclaimer