EMA Ribbon
Three exponential moving averages on the price pane with a shaded band between the fastest and the slowest.
- Ribbon
- Updates every tick
- ema
- moving average
- ribbon
- trend
- crossover
MIT-0: free to use, change and share, no attribution needed. What you build from it is yours.

Overview
Three EMAs of different lengths; the shaded ribbon spans the fast and slow averages.
How to read it
A fast average above mid above slow with a widening ribbon shows a trending market; a compressed ribbon shows consolidation.
Settings and limitations
Keep Fast < Mid < Slow. Shorter lengths react sooner but flip more often. EMAs start at the first bar, so the earliest values are less reliable.
Settings
Each setting appears in the indicator's settings panel in Spectral, next to a color setting for every output.
| Setting | Type | Default | Range or options | What it does |
|---|---|---|---|---|
| Fast length | Whole number | 8 | 1 – 500 | Number of bars in the fast EMA. |
| Mid length | Whole number | 21 | 1 – 500 | Number of bars in the middle EMA. |
| Slow length | Whole number | 55 | 1 – 500 | Number of bars in the slow EMA. |
| Source | Price source | close | open, high, low, close, hlc3 | Price the three averages are calculated from. |
What it draws
Lines
- Fast EMAsolid · 1.5 px · primary
#58A6FF - Mid EMAsolid · 1 px
#C4A46A - Slow EMAsolid · 1 px
#F0883E
Zones
- Ribbonfilled at 8% opacity
#58A6FF
Source
Save it as ema-ribbon.js and add it with Indicators → Custom indicators → Add file…. The format is explained in the custom indicators guide.
// Copyright (c) 2026 Spectral
// SPDX-License-Identifier: MIT-0
// Free to use, copy, modify and share: https://spectral.trade/docs/custom-indicators/LICENSE.txt
/** @type {import('./spectral-indicator').IndicatorV1} */
export default {
schemaVersion: 1,
id: 'ema-ribbon',
name: 'EMA Ribbon',
shortName: 'Ribbon',
version: '1.0.0',
author: 'Spectral examples',
description: 'Three exponential moving averages on the price pane with a shaded band between the fastest and the slowest.',
pane: 'price',
live: { lookback: 0 },
inputs: {
fast: { type: 'integer', label: 'Fast length', default: 8, min: 1, max: 500, description: 'Number of bars in the fast EMA.' },
mid: { type: 'integer', label: 'Mid length', default: 21, min: 1, max: 500, description: 'Number of bars in the middle EMA.' },
slow: { type: 'integer', label: 'Slow length', default: 55, min: 1, max: 500, description: 'Number of bars in the slow EMA.' },
source: { type: 'source', label: 'Source', default: 'close', description: 'Price the three averages are calculated from.' },
},
plots: {
fast: { label: 'Fast EMA', color: '#58A6FF', lineWidth: 1.5, primary: true },
mid: { label: 'Mid EMA', color: '#C4A46A' },
slow: { label: 'Slow EMA', color: '#F0883E' },
},
zones: { ribbon: { label: 'Ribbon', color: '#58A6FF', opacity: 0.08 } },
docs: {
overview: 'Three EMAs of different lengths; the shaded ribbon spans the fast and slow averages.',
howToRead: 'A fast average above mid above slow with a widening ribbon shows a trending market; a compressed ribbon shows consolidation.',
settings: 'Keep Fast < Mid < Slow. Shorter lengths react sooner but flip more often. EMAs start at the first bar, so the earliest values are less reliable.',
},
calculate(ctx) {
const { ta, inputs, bars } = ctx;
const source = ta.source(bars, inputs.source);
const fast = ta.ema(source, inputs.fast);
const mid = ta.ema(source, inputs.mid);
const slow = ta.ema(source, inputs.slow);
const upper = fast.map((value, index) => (value === null || slow[index] === null ? null : Math.max(value, slow[index])));
const lower = fast.map((value, index) => (value === null || slow[index] === null ? null : Math.min(value, slow[index])));
return { plots: { fast, mid, slow }, zones: { ribbon: { upper, lower } } };
},
};Adapt it with an LLM
Paste this into your assistant and replace the second-to-last line with the change you want.
Start from this Spectral custom indicator: https://spectral.trade/indicators/ema-ribbon.js Format reference: https://spectral.trade/docs/custom-indicators.llm.md Keep the file format and every rule of the reference; give the result a new id, name, shortName and version, and update docs and input descriptions to match. Keep its live updates exact and fast (section "Fast live updates" of the reference): carry values from bar to bar only through ctx.ta, and raise live.lookback if the change reads further back; Spectral rejects a file whose live updates differ from a full recalculation or are too slow. Change I want: <describe the change> Answer with the complete file in one code block, ready to save as <id>.js.


