Tenkan Higher Time Frame by TheSocialCryptoClub
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © TheSocialCryptoClub

//@version=5
indicator("Tenkan Higher Time Frame", shorttitle="Tenkan HTF", overlay=true)

// input declarations
tenkan_len = input.int(9, title="Length")
tenkan_timeframe = input.timeframe("W", "Higher Timeframe")


donchian(len) => math.avg(ta.lowest(tenkan_len), ta.highest(tenkan_len))
tenkan = donchian(tenkan_len)
tenkan_high = request.security(syminfo.tickerid,tenkan_timeframe,donchian(tenkan_len))

tenkan_strenght = tenkan > tenkan[1] and high[tenkan_len] <= high[tenkan_len+1] ? color.lime : tenkan < tenkan[1] and low[tenkan_len] >= low[tenkan_len+1] ? color.red : color.blue 


plot(tenkan, color=tenkan_strenght, title="Tenkan Current Time Frame", linewidth=2)
plot(tenkan_high, color=color.aqua, title="Tenkan Higher Time Frame", linewidth=2)