[Multi-layers][VDT]
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © FCCMTT92
//@version=5
//
indicator(title="[Multi-layers][VDT]", shorttitle="[Multi-layers][VDT]", overlay=true)
//
//******************************************************************************
// Ichimoku Cloud
//******************************************************************************
//
ichi_enable = input.bool(defval=true, title="Ichimoku Cloud Enable")
conversionPeriods = input.int(9, minval=1, title="Conversion Line Length")
basePeriods = input.int(26, minval=1, title="Base Line Length")
laggingSpan2Periods = input.int(52, minval=1, title="Leading Span B Length")
displacement = input.int(26, minval=1, title="Displacement")
donchian(len) => math.avg(ta.lowest(len), ta.highest(len))
conversionLine = donchian(conversionPeriods)
baseLine = donchian(basePeriods)
leadLine1 = math.avg(conversionLine, baseLine)
leadLine2 = donchian(laggingSpan2Periods)
plot(ichi_enable ? conversionLine : na, color=#2962FF, title="Conversion Line")
plot(ichi_enable ? baseLine: na, color=#B71C1C, title="Base Line")
plot(close, offset = -displacement + 1, color=#43A047, title="Lagging Span")
p1 = plot(ichi_enable ? leadLine1 : na, offset = displacement - 1, color=#00FF00,
	 title="Leading Span A")
p2 = plot(ichi_enable ? leadLine2 : na, offset = displacement - 1, color=#FF0000,
	 title="Leading Span B")
fill(p1, p2, color = leadLine1 > leadLine2 ? color.rgb(67, 160, 71, 90) : color.rgb(244, 67, 54, 90))
//
//******************************************************************************
// EMA
//******************************************************************************
//
//ema_enable = input.bool(defval=true, title="EMA Enable all")
enb1 = input.bool(defval=true, title="EMA1 Enable")
len1 = input.int(7, minval=1, title="Length_EMA1")
src1 = input(close, title="Source_EMA1")
out1 = ta.ema(src1, len1)
plot (enb1 ? out1 : na , title="EMA1", color=#FF8C00)
enb2 = input.bool(defval=true, title="EMA2 Enable")
len2 = input.int(60, minval=1, title="Length_EMA2")
src2 = input(close, title="Source_EMA2")
out2 = ta.ema(src1, len2)
plot (enb2 ? out2 : na, title="EMA2", color=#FF1493)
enb3 = input.bool(defval=true, title="EMA3 Enable")
len3 = input.int(200, minval=1, title="Length_EMA3")
src3 = input(close, title="Source_EMA3")
out3 = ta.ema(src3, len3)
plot (enb3 ? out3 : na, title="EMA3", color=#9400D3)
//
//******************************************************************************
// SMA
//******************************************************************************
//
enb4 = input.bool(defval=true, title="SMA1 Enable")
len4 = input.int(20, minval=1, title="Length_SMA1")
src4 = input(close, title="Source_SMA1")
out4 = ta.sma(src4, len4)
plot (enb4 ? out4 : na, title="SMA1", color=#DEB887)
enb5 = input.bool(defval=true, title="SMA2 Enable")
len5 = input.int(50, minval=1, title="Length_SMA2")
src5 = input(close, title="Source_SMA2")
out5 = ta.sma(src5, len5)
plot (enb5 ? out5 : na, title="SMA2", color=#FFB6C1)
enb6 = input.bool(defval=true, title="SMA3 Enable")
len6 = input.int(200, minval=1, title="Length_SMA3")
src6 = input(close, title="Source_EMA3")
out6 = ta.sma(src6, len6)
plot (enb6 ? out6 : na, title="SMA3", color=#DDA0DD)

//END
