PROTECTED SOURCE SCRIPT
Cập nhật MACD 3TF Trend Alignment + Strong Candle

This indicator combines multi‑timeframe MACD/EMA trend alignment with a Marubozu and strong‑candle detector in a single overlay.
MACD 3TF trend logic
The script tracks MACD on a higher timeframe and an intermediate timeframe, and first checks whether their trends match (both bullish or both bearish) based on the MACD line vs signal line. It then calculates three EMAs (lengths 50, 20, 9) on both the intermediate and lower timeframes and compares their “direction” (price above = bullish, price below = bearish) with the intermediate‑timeframe MACD trend. Only when all enabled conditions pass—higher and intermediate MACD aligned, intermediate MACD aligned with intermediate EMA‑20 and EMA‑9, and lower‑timeframe EMA‑50/20/9 aligned with the intermediate MACD—does the background highlight green for bullish or red for bearish, visually marking strong multi‑timeframe trend agreement.
Configurable filters
Three checkboxes allow independent control of each MACD/EMA step: Step 1 (higher vs intermediate MACD alignment), Step 2b (intermediate MACD vs intermediate EMA‑20 and EMA‑9), and Step 2c (lower‑timeframe EMA‑50/20/9 vs intermediate MACD). When a checkbox is turned off, that step no longer filters the signal, so the highlight is based only on the remaining active conditions. This makes it easy to use the same script as a simple 2‑TF MACD tool or as a strict multi‑timeframe trend filter without editing code.
Marubozu and strong‑candle detection
The merged strong‑candle module analyzes each bar’s body size, total range, and body‑to‑range ratio relative to an average over a user‑defined period. It identifies bullish and bearish Marubozu candles when the real body occupies most of the candle’s range, and flags “strong” bullish/bearish candles whose bodies are significantly larger than the recent average but not pure Marubozu. These signals are plotted as small triangles and circles above or below price, and can be globally enabled or disabled with a dedicated checkbox.
Use cases
The indicator is designed to help quickly spot moments when higher‑timeframe and lower‑timeframe trends are in sync, while also highlighting powerful single‑bar patterns that occur inside that context. Traders can use the background color as a directional bias filter for entries and exits, while using the Marubozu/strong‑candle markers to refine timing or confirm impulse strength within the prevailing multi‑timeframe trend.
MACD 3TF trend logic
The script tracks MACD on a higher timeframe and an intermediate timeframe, and first checks whether their trends match (both bullish or both bearish) based on the MACD line vs signal line. It then calculates three EMAs (lengths 50, 20, 9) on both the intermediate and lower timeframes and compares their “direction” (price above = bullish, price below = bearish) with the intermediate‑timeframe MACD trend. Only when all enabled conditions pass—higher and intermediate MACD aligned, intermediate MACD aligned with intermediate EMA‑20 and EMA‑9, and lower‑timeframe EMA‑50/20/9 aligned with the intermediate MACD—does the background highlight green for bullish or red for bearish, visually marking strong multi‑timeframe trend agreement.
Configurable filters
Three checkboxes allow independent control of each MACD/EMA step: Step 1 (higher vs intermediate MACD alignment), Step 2b (intermediate MACD vs intermediate EMA‑20 and EMA‑9), and Step 2c (lower‑timeframe EMA‑50/20/9 vs intermediate MACD). When a checkbox is turned off, that step no longer filters the signal, so the highlight is based only on the remaining active conditions. This makes it easy to use the same script as a simple 2‑TF MACD tool or as a strict multi‑timeframe trend filter without editing code.
Marubozu and strong‑candle detection
The merged strong‑candle module analyzes each bar’s body size, total range, and body‑to‑range ratio relative to an average over a user‑defined period. It identifies bullish and bearish Marubozu candles when the real body occupies most of the candle’s range, and flags “strong” bullish/bearish candles whose bodies are significantly larger than the recent average but not pure Marubozu. These signals are plotted as small triangles and circles above or below price, and can be globally enabled or disabled with a dedicated checkbox.
Use cases
The indicator is designed to help quickly spot moments when higher‑timeframe and lower‑timeframe trends are in sync, while also highlighting powerful single‑bar patterns that occur inside that context. Traders can use the background color as a directional bias filter for entries and exits, while using the Marubozu/strong‑candle markers to refine timing or confirm impulse strength within the prevailing multi‑timeframe trend.
Phát hành các Ghi chú
Updated Code version from 5 to 6Mã được bảo vệ
Tập lệnh này được đăng dưới dạng mã nguồn đóng. Tuy nhiên, bạn có thể sử dụng tự do và không giới hạn – tìm hiểu thêm tại đây.
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ã được bảo vệ
Tập lệnh này được đăng dưới dạng mã nguồn đóng. Tuy nhiên, bạn có thể sử dụng tự do và không giới hạn – tìm hiểu thêm tại đây.
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.