๐ŸงฎCode: AB EMA Ribbon


A custom exponential moving average (EMA) indicator plots seven EMAs of different periods on the chart, creating a ribbon-like effect. The periods of the EMAs are user-defined and range from 3 to 200. The default values are 3, 9, 17, 33, 42, 69, and 200. The source of the price data is also user-defined, and the default value is the closing price. The indicator also allows the user to drop the number of candles from the chart's beginning. The indicator overlays the chart, providing visual cues for trend direction, support, and resistance levels. The different colours of the EMAs in the ribbon can be customized by changing the hexadecimal colour codes in the script.



// ยฉ AlphaBlock Network
//@version=5

indicator(title='AlphaBlock EMA Ribbon', shorttitle='ABEMA Ribbon', overlay=true)

dropn(src, n) =>
    na(src[n]) ? na : src

length1 = input.int(3, title='MA-1 period', minval=1)
length2 = input.int(9, title='MA-2 period', minval=1)
length3 = input.int(17, title='MA-3 period', minval=1)
length4 = input.int(33, title='MA-4 period', minval=1)
length5 = input.int(42, title='MA-5 period', minval=1)
length6 = input.int(69, title='MA-6 period', minval=1)
length7 = input.int(200, title='MA-7 period', minval=1)
src = input(close, title='Source')
dropCandles = input.int(1, minval=0, title='Drop first N candles')

price = dropn(src, dropCandles)

plot(ta.ema(price, length1), title='MA-1', color=color.new(#7adde9, 0), linewidth=1)
plot(ta.ema(price, length2), title='MA-2', color=color.new(#57d3e3, 0), linewidth=1)
plot(ta.ema(price, length3), title='MA-3', color=color.new(#3cccde, 0), linewidth=1)
plot(ta.ema(price, length4), title='MA-4', color=color.new(#f5a3be, 0), linewidth=1)
plot(ta.ema(price, length5), title='MA-5', color=color.new(#f382a8, 0), linewidth=1)
plot(ta.ema(price, length6), title='MA-6', color=color.new(#f06392, 0), linewidth=1)
plot(ta.ema(price, length7), title='MA-7', color=color.new(#fdfdfd, 0), linewidth=1)

Last updated