OPEN-SOURCE SCRIPT
Updated

EMA Crosses with Independent Fading Background

201
1. Overall Purpose

The script is an EMA crossover indicator with the following features:

Calculates four EMA pairs: 5/13, 21/50, 20/200, 50/200.

Plots optional EMA lines.

Shows fading background highlights for bullish/bearish crosses.

Places labels at the points of crossover.

Provides a price source input, so EMAs can be based on close, hl2, ohlc4, etc.

2. Strengths

Flexible inputs: Users can change EMA lengths, choose a price source, enable/disable plots, adjust background highlight duration and fade.

Independent fading: Each EMA pair has its own counter for background highlights, preventing overlaps from canceling each other.

Clear labeling: Crosses are labeled distinctly with different colors.

Overlay: Works directly on the chart with overlay=true.
Release Notes
Update 2.0

* 50/200 EMA fix Correct slow EMA length ✅
* Custom EMA colors Choose each EMA’s color independently 8 color inputs
* Background fade Independent, customizable fade per crossover 4 fade styles
* Label toggle Option to disable crossover labels ✅
* Clean structure Fully modular, readable, future-proof ✅
* Added Alert grouping mode so you can choose between:
“One alert per pair” (current behavior), or
“Single combined alert” (fires on any crossover)?
Release Notes
Update 3.0

* Added optional VWAP with selectable anchor period (Session, Daily, Weekly, Monthly)
* VWAP color changes dynamically: green if price ≥ VWAP, red if price < VWAP.
* VWAP line style options (Solid / Dashed / Dotted).

Disclaimer

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.