OPEN-SOURCE SCRIPT
MACD Scaled Overlay

█ OVERVIEW
The "MACD Scaled Overlay" indicator is an advanced version of the classic MACD (Moving Average Convergence Divergence) oscillator that displays signals directly on the price chart. Instead of a traditional separate panel, the MACD line, signal line, and histogram are scaled and overlaid on the price chart, making it easier to identify key price levels and potential reversal points. The indicator also supports the detection of divergences (regular and hidden) and offers extensive customization options, such as adjusting colors, line thickness, and enabling/disabling visual elements.
█ CONCEPTS
The "MACD Scaled Overlay" indicator is designed to simplify trend and reversal analysis by integrating MACD signals with the price chart. The MACD Scaled Overlay is scaled relative to the average candle range, allowing the lines and histogram to dynamically adjust to market volatility. Additionally, the indicator enables the detection of divergences (bullish and bearish, both regular and hidden) based on the traditional MACD histogram (before scaling), ensuring consistency with classic divergence analysis. The indicator is most effective when combined with other technical analysis tools, such as Fibonacci levels, pivot points, or trend lines.
█ MACD Calculations and Scaling
The indicator is based on the classic MACD formula, which includes:
-MACD Line: The difference between the fast EMA (default: 12) and the slow EMA (default: 26).
-Signal Line: The EMA of the MACD line (default: 9).
-Histogram: The difference between the MACD line and the signal line.
Scaling is achieved by normalizing the MACD values relative to the standard deviation and the average candle range. This makes the lines and histogram dynamically adjust to market volatility, improving their readability and utility on the price chart. The scaling formulas are:
-MACD Scaled: macdNorm * avgRangeLines * scaleFactor
-Signal Scaled: signalNorm * avgRangeLines * scaleFactor
-Histogram Scaled: histNorm * avgRangeHist * scaleFactor
Where:
-macdNorm and signalNorm are the normalized MACD and signal line values.
-avgRangeLines and avgRangeHist are the average candle ranges.
-scaleFactor is the scaling multiplier (default: 2).
The positioning of the lines and histogram is relative to the candle midpoint (candleMid = (high + low) / 2), ensuring proper display on the price chart. Divergences are calculated based on the traditional MACD histogram (before scaling), maintaining consistency with standard divergence detection methodology.
█INDICATOR FEATURES
-Dynamic MACD and Signal Lines: Scaled and overlaid on the price chart, facilitating the identification of reversal points.
-Histogram: Displays the difference between the MACD and signal lines, dynamically adjusted to market volatility.
-Divergence Detection: Ability to detect regular and hidden divergences (bullish and bearish) based on the traditional MACD histogram, with options to enable/disable their display.
-Visual Customization: Options to adjust colors, line thickness, transparency, and enable/disable elements such as the zero line, MACD line, signal line, or histogram.
-Smoothing: Smoothing length for lines (default: 1) and histogram (default: 3). Smoothing may delay crossover signals, which should be considered during analysis.
-Alerts: Alert conditions for MACD and signal line crossovers, enabling notifications for potential buy/sell signals.
█ HOW TO SET UP THE INDICATOR
-Add the "MACD Scaled Overlay" indicator to your TradingView chart.
-Configure parameters in the settings, such as EMA lengths, scaling multiplier, or smoothing periods, to match your trading style.
-Enable or disable the display of the zero line, MACD line, signal line, or histogram based on your needs.
-Adjust colors and line thickness in the "Style" section and transparency settings in the input section to optimize visualization.
█ HOW TO USE
Add the indicator to your chart, configure the parameters, and observe the interactions of the price with the MACD line, signal line, and histogram to identify potential entry and exit points. Key signals include:
-MACD and Signal Line Crossovers: A crossover of the MACD line above the signal line may indicate a buy signal (bullish cross), while a crossover below the signal line may indicate a sell signal (bearish cross).
-Crossings Through the Price Line (Zero): The MACD line or histogram crossing the price line (candle midpoint) may indicate a change in momentum. For example, the histogram moving from negative to positive values near the price line may signal increasing bullish trend strength.
-Divergences: Detection of regular and hidden divergences (bullish and bearish) based on the traditional MACD histogram can help predict trend reversals. Divergences are not standalone signals, as they are delayed by the specified pivot length (default: 3). However, they help strengthen the significance of other signals, such as crossovers or support/resistance levels.
The indicator is most effective when combined with other tools, such as Fibonacci levels, pivot points, or support/resistance lines, to confirm signals.
The "MACD Scaled Overlay" indicator is an advanced version of the classic MACD (Moving Average Convergence Divergence) oscillator that displays signals directly on the price chart. Instead of a traditional separate panel, the MACD line, signal line, and histogram are scaled and overlaid on the price chart, making it easier to identify key price levels and potential reversal points. The indicator also supports the detection of divergences (regular and hidden) and offers extensive customization options, such as adjusting colors, line thickness, and enabling/disabling visual elements.
█ CONCEPTS
The "MACD Scaled Overlay" indicator is designed to simplify trend and reversal analysis by integrating MACD signals with the price chart. The MACD Scaled Overlay is scaled relative to the average candle range, allowing the lines and histogram to dynamically adjust to market volatility. Additionally, the indicator enables the detection of divergences (bullish and bearish, both regular and hidden) based on the traditional MACD histogram (before scaling), ensuring consistency with classic divergence analysis. The indicator is most effective when combined with other technical analysis tools, such as Fibonacci levels, pivot points, or trend lines.
█ MACD Calculations and Scaling
The indicator is based on the classic MACD formula, which includes:
-MACD Line: The difference between the fast EMA (default: 12) and the slow EMA (default: 26).
-Signal Line: The EMA of the MACD line (default: 9).
-Histogram: The difference between the MACD line and the signal line.
Scaling is achieved by normalizing the MACD values relative to the standard deviation and the average candle range. This makes the lines and histogram dynamically adjust to market volatility, improving their readability and utility on the price chart. The scaling formulas are:
-MACD Scaled: macdNorm * avgRangeLines * scaleFactor
-Signal Scaled: signalNorm * avgRangeLines * scaleFactor
-Histogram Scaled: histNorm * avgRangeHist * scaleFactor
Where:
-macdNorm and signalNorm are the normalized MACD and signal line values.
-avgRangeLines and avgRangeHist are the average candle ranges.
-scaleFactor is the scaling multiplier (default: 2).
The positioning of the lines and histogram is relative to the candle midpoint (candleMid = (high + low) / 2), ensuring proper display on the price chart. Divergences are calculated based on the traditional MACD histogram (before scaling), maintaining consistency with standard divergence detection methodology.
█INDICATOR FEATURES
-Dynamic MACD and Signal Lines: Scaled and overlaid on the price chart, facilitating the identification of reversal points.
-Histogram: Displays the difference between the MACD and signal lines, dynamically adjusted to market volatility.
-Divergence Detection: Ability to detect regular and hidden divergences (bullish and bearish) based on the traditional MACD histogram, with options to enable/disable their display.
-Visual Customization: Options to adjust colors, line thickness, transparency, and enable/disable elements such as the zero line, MACD line, signal line, or histogram.
-Smoothing: Smoothing length for lines (default: 1) and histogram (default: 3). Smoothing may delay crossover signals, which should be considered during analysis.
-Alerts: Alert conditions for MACD and signal line crossovers, enabling notifications for potential buy/sell signals.
█ HOW TO SET UP THE INDICATOR
-Add the "MACD Scaled Overlay" indicator to your TradingView chart.
-Configure parameters in the settings, such as EMA lengths, scaling multiplier, or smoothing periods, to match your trading style.
-Enable or disable the display of the zero line, MACD line, signal line, or histogram based on your needs.
-Adjust colors and line thickness in the "Style" section and transparency settings in the input section to optimize visualization.
█ HOW TO USE
Add the indicator to your chart, configure the parameters, and observe the interactions of the price with the MACD line, signal line, and histogram to identify potential entry and exit points. Key signals include:
-MACD and Signal Line Crossovers: A crossover of the MACD line above the signal line may indicate a buy signal (bullish cross), while a crossover below the signal line may indicate a sell signal (bearish cross).
-Crossings Through the Price Line (Zero): The MACD line or histogram crossing the price line (candle midpoint) may indicate a change in momentum. For example, the histogram moving from negative to positive values near the price line may signal increasing bullish trend strength.
-Divergences: Detection of regular and hidden divergences (bullish and bearish) based on the traditional MACD histogram can help predict trend reversals. Divergences are not standalone signals, as they are delayed by the specified pivot length (default: 3). However, they help strengthen the significance of other signals, such as crossovers or support/resistance levels.
The indicator is most effective when combined with other tools, such as Fibonacci levels, pivot points, or support/resistance lines, to confirm signals.
开源脚本
本着TradingView的真正精神,此脚本的创建者将其开源,以便交易者可以查看和验证其功能。向作者致敬!虽然您可以免费使用它,但请记住,重新发布代码必须遵守我们的网站规则。
免责声明
这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。
开源脚本
本着TradingView的真正精神,此脚本的创建者将其开源,以便交易者可以查看和验证其功能。向作者致敬!虽然您可以免费使用它,但请记住,重新发布代码必须遵守我们的网站规则。
免责声明
这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。