OPEN-SOURCE SCRIPT

ATR-Normalized MACD w/ Visual Background

107
ChatGPT said:

Absolutely! Let’s break down the YON MACD indicator in detail so you understand what it does, how it works, and how to use it.

1. Purpose

The YON MACD is a volatility-adjusted version of the classic MACD. Instead of just using EMA differences, it normalizes the MACD by the Average True Range (ATR), which means:

High-volatility markets → the MACD signal is scaled down.

Low-volatility markets → the MACD signal is scaled up.

This gives a more consistent momentum signal across different market conditions, avoiding false spikes during high volatility.

2. Components
a. Fast and Slow EMAs

fastEMA → Typically 12-period EMA of price.

slowEMA → Typically 26-period EMA of price.

The difference between them measures short-term momentum.

b. ATR Normalization

atr → Average True Range over a specified period (default 26).

Formula:

YON MACD=fastEMA - slowEMAATR×100
YON MACD=
ATR
fastEMA - slowEMA


×100

This adjusts the MACD for market volatility.

c. Signal Line

EMA of the YON MACD (default 9 periods).

Acts like a trigger line for crossovers.

d. Histogram

hist = YON MACD - Signal Line

Visualizes divergence: how far the MACD is from the signal line.

Positive histogram → bullish momentum, negative → bearish momentum.

3. Visual Features

Plot Lines

YON MACD → colored green (rising), red (falling), gray (unchanged).

Signal line → always blue.

Histogram → columns: green (positive), red (negative).

Background Coloring

Green → MACD rising + histogram positive (bullish momentum).

Red → MACD falling + histogram negative (bearish momentum).

Yellow/Orange → histogram flips (early momentum change).

This makes trend and momentum immediately visible without having to study the panel in detail.

4. Alerts

MACD Cross Alerts

YON MACD crosses above the signal → potential buy.

YON MACD crosses below the signal → potential sell.

Histogram Flip Alerts

Histogram flips from negative → positive → early bullish signal.

Histogram flips from positive → negative → early bearish signal.

This allows automation or notifications for momentum changes.

5. How to Use

Trend Confirmation

Green background + MACD above signal → trend is bullish.

Red background + MACD below signal → trend is bearish.

Entry/Exit Signals

Buy: MACD crosses above signal or histogram flips positive.

Sell: MACD crosses below signal or histogram flips negative.

Volatility Adjustment

Since the MACD is ATR-normalized, it avoids overreacting in volatile conditions and highlights true momentum shifts.

Summary

The YON MACD is a trend-following and momentum indicator with:

Volatility normalization (ATR)

MACD cross signals

Histogram divergence visualization

Background colors for instant momentum reading

Alerts for crossovers and early momentum flips

It’s a powerful all-in-one momentum tool that can work for day trading, swing trading, or even longer-term analysis.

Aviso legal

As informações e publicações não devem ser e não constituem conselhos ou recomendações financeiras, de investimento, de negociação ou de qualquer outro tipo, fornecidas ou endossadas pela TradingView. Leia mais em Termos de uso.