// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © ozzy_livin //@version=4 study(title="Ichimoku Buy & Sell Signals", shorttitle="Ichimoku", overlay=true) // Periods conversionPeriods = input(20, minval=1, title="Conversion Line Length") basePeriods = input(60, minval=1, title="Base Line Length") laggingSpan2Periods = input(120, minval=1, title="Lagging Span 2 Length") displacement = input(30, minval=1, title="Displacement") donchian(len) => avg(lowest(len), highest(len)) // Build MA and Ichimoku conversionLine = donchian(conversionPeriods) baseLine = donchian(basePeriods) leadLine1 = avg(conversionLine, baseLine) leadLine2 = donchian(laggingSpan2Periods) // Plot MA plot(conversionLine, color=#00BCD4, transp=25, title="Tenkan") plot(baseLine, color=#F44336, transp=25, title="Kijun") // Plot Cloud p1 = plot(leadLine1, offset = displacement - 1, color=#4CAF50, transp=25, title="Lead 1") p2 = plot(leadLine2, offset = displacement - 1, color=#FF5252, transp=25, title="Lead 2") // Color Fill Cloud fill(p1, p2, color = leadLine1 > leadLine2 ? #4CAF50 : #FF5252, transp=75) // Plot CROSS at MA Cross Over plot(crossover(conversionLine, baseLine) ? conversionLine : na, style = plot.style_circles, color=#00FF00, transp=25, linewidth = 8, title="Cross Long") // Plot CROSS at MA Cross Under plot(crossover(baseLine, conversionLine) ? baseLine : na, style = plot.style_circles, color=#FF9800, transp=25, linewidth = 8, title="Cross Short")