Smamaema
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © alintheter

//@version=4
study(title="Smaema", shorttitle="SMMAEma", overlay=true, resolution="")
len = input(200, minval=1, title="LengthSMA")
src = input(close, title="SourceSMA")
smma = 0.0
smma := na(smma[1]) ? sma(src, len) : (smma[1] * (len - 1) + src) / len

len2 = input(200, minval=1, title="LengthMA")
src2 = input(close, title="SourceMA")
offset = input(title="OffsetMA", type=input.integer, defval=0, minval=-500, maxval=500)
out = sma(src2, len2)

lema1 = input(200, minval=1, title="LEMA1")
lema2 = input(100, minval=1, title="LEMA2")
lema3 = input(50, minval=1, title="LEMA3")

plot(out, color=color.blue, title="MA", offset=offset)

plot(smma, color=color.red,title="SMA")
plot(ema(close, lema1), color=#FF7000, linewidth=1, title='200 Day EMA')
plot(ema(close, lema2), color=#0088FA, linewidth=1, title='100 Day EMA')
plot(ema(close, lema3), color=#FA00D0, linewidth=1, title='50 Day EMA')
