// This Pine Script® code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © Piotr Kowalski "piecioshka"
// Docs (EN): https://github.com/piecioshka/tradingview-pine-scripts/blob/main/indicators/overlays/gmma/gmma.md
// Docs (PL): https://github.com/piecioshka/tradingview-pine-scripts/blob/main/indicators/overlays/gmma/gmma.pl.md
//@version=6
indicator('GMMA = Guppy Multiple Moving Average', overlay=true)
// GMMA (Guppy Multiple Moving Average) — Daryl Guppy.
// Two groups of exponential moving averages:
// - short-term (3, 5, 8, 10, 12, 15) — behavior of traders/speculators
// - long-term (30, 35, 40, 45, 50, 60) — behavior of investors
// Groups spreading apart = trend strength, converging = possible reversal.
shortColor = color.rgb(56, 104, 174) // blue — short-term group
longColor = color.rgb(215, 107, 52) // orange — long-term group
src = input.source(close, 'Source')
// --- Short-term group ---
s1 = ta.ema(src, 3)
s2 = ta.ema(src, 5)
s3 = ta.ema(src, 8)
s4 = ta.ema(src, 10)
s5 = ta.ema(src, 12)
s6 = ta.ema(src, 15)
plot(s1, 'EMA 3', color=shortColor)
plot(s2, 'EMA 5', color=shortColor)
plot(s3, 'EMA 8', color=shortColor)
plot(s4, 'EMA 10', color=shortColor)
plot(s5, 'EMA 12', color=shortColor)
plot(s6, 'EMA 15', color=shortColor)
// --- Long-term group ---
l1 = ta.ema(src, 30)
l2 = ta.ema(src, 35)
l3 = ta.ema(src, 40)
l4 = ta.ema(src, 45)
l5 = ta.ema(src, 50)
l6 = ta.ema(src, 60)
plot(l1, 'EMA 30', color=longColor)
plot(l2, 'EMA 35', color=longColor)
plot(l3, 'EMA 40', color=longColor)
plot(l4, 'EMA 45', color=longColor)
plot(l5, 'EMA 50', color=longColor)
plot(l6, 'EMA 60', color=longColor)