Skip to content

Instantly share code, notes, and snippets.

@heathdrobertson
Last active October 26, 2023 04:14
Show Gist options
  • Save heathdrobertson/4960d17fe9fb256f63d531c2597afd5a to your computer and use it in GitHub Desktop.
Save heathdrobertson/4960d17fe9fb256f63d531c2597afd5a to your computer and use it in GitHub Desktop.
Tradingview - Pine Script - Exponential Moving Average Ribbon

Pine Script (Tradingview)

EMA Ribbon

//@version=3
study(title="Exponential Moving Average Ribbon", shorttitle="EMA", overlay=true)

src = input(title="Source", type=source, defval=close)
// srcno = input(close, title="Source None", scale=scale.none)
// https://www.tradingcode.net/tradingview/indicator-settings/scale-indicator/

i20 = input(20, minval=1)
i25 = input(25, minval=1)
i30 = input(30, minval=1)
i35 = input(35, minval=1)
i40 = input(40, minval=1)
i45 = input(45, minval=1)
i50 = input(50, minval=1)
i100 = input(100, minval=1)
i150 = input(150, minval=1)
i200 = input(200, minval=1)
i250 = input(250, minval=1)
i300 = input(300, minval=1)
    
e20 = ema(src, i20)
e25 = ema(src, i25)
e30 = ema(src, i30)
e35 = ema(src, i35)
e40 = ema(src, i40)
e45 = ema(src, i45)
e50 = ema(src, i50)
e100 = ema(src, i100)
e150 = ema(src, i150)
e200 = ema(src, i200)
e250 = ema(src, i250)
e300 = ema(src, i300)

plot(e20, title="20", linewidth=2, color=#ff0000)
plot(e25, title="", color=#e6001a)
plot(e30, title="", color=#cc0033)
plot(e35, title="", color=#b2004c)
plot(e40, title="", color=#990066)
plot(e45, title="", color=#4000bf)
plot(e50, title="50", linewidth=2, color=#0000ff)
plot(e100, title="100", linewidth=2, color=#0000cc)
plot(e150, title="150", linewidth=2, color=#000099)
plot(e200, title="200", linewidth=2, color=#000066)
plot(e250, title="250", linewidth=2, color=#00004d)
plot(e300, title="300", linewidth=2, color=#000034)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment