T/K CROSS
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © theforlornson

//@version=5
indicator("T/K CROSS", overlay=true)

// Getting inputs
TenkanSenPeriod = input.int(9, minval=1, title="TenkanSen Period")
KijunSenPeriod= input.int(26, minval=1, title="KijunSen Period")

// Ichimoku function
donchian(len) => math.avg(ta.lowest(len), ta.highest(len))

// Calculation
TenkanSen = donchian(TenkanSenPeriod)
KijunSen = donchian(KijunSenPeriod)

// plot
plot(TenkanSen, color=color.blue)
plot(KijunSen, color=color.red)

// crossovers
plotshape(ta.crossover(TenkanSen,KijunSen) ? 1 : na, style=shape.cross, color=color.aqua, location=location.belowbar, size=size.small)
plotshape(ta.crossunder(TenkanSen,KijunSen) ? 1 : na, style=shape.cross, color=color.orange, location=location.abovebar, size=size.small)
