OPEN-SOURCE SCRIPT

TenUp Bots S R - Fixed (ta.highest)

15
//version=5
indicator("TenUp Bots S R - Fixed (ta.highest)", overlay = true)

// Inputs
a = input.int(10, "Sensitivity (bars)", minval = 1, maxval = 9999)
d_pct = input.int(85, "Transparency (%)", minval = 0, maxval = 100)

// Convert 0-100% to 0-255 transparency (color.new uses 0..255)
transp = math.round(d_pct * 255 / 100)

// Colors with transparency applied
resColor = color.new(color.red, transp)
supColor = color.new(color.blue, transp)

// Helper (calculations only)
getRes(len) => ta.highest(high, len)
getSup(len) => ta.lowest(low, len)

// === PLOTS (all in global scope) ===
plot(getRes(a*1), title="Resistance 1", color=resColor, linewidth=2)
plot(getSup(a*1), title="Support 1", color=supColor, linewidth=2)

plot(getRes(a*2), title="Resistance 2", color=resColor, linewidth=2)
plot(getSup(a*2), title="Support 2", color=supColor, linewidth=2)

plot(getRes(a*3), title="Resistance 3", color=resColor, linewidth=2)
plot(getSup(a*3), title="Support 3", color=supColor, linewidth=2)

plot(getRes(a*4), title="Resistance 4", color=resColor, linewidth=2)
plot(getSup(a*4), title="Support 4", color=supColor, linewidth=2)

plot(getRes(a*5), title="Resistance 5", color=resColor, linewidth=2)
plot(getSup(a*5), title="Support 5", color=supColor, linewidth=2)

plot(getRes(a*6), title="Resistance 6", color=resColor, linewidth=2)
plot(getSup(a*6), title="Support 6", color=supColor, linewidth=2)

plot(getRes(a*7), title="Resistance 7", color=resColor, linewidth=2)
plot(getSup(a*7), title="Support 7", color=supColor, linewidth=2)

plot(getRes(a*8), title="Resistance 8", color=resColor, linewidth=2)
plot(getSup(a*8), title="Support 8", color=supColor, linewidth=2)

plot(getRes(a*9), title="Resistance 9", color=resColor, linewidth=2)
plot(getSup(a*9), title="Support 9", color=supColor, linewidth=2)

plot(getRes(a*10), title="Resistance 10", color=resColor, linewidth=2)
plot(getSup(a*10), title="Support 10", color=supColor, linewidth=2)

plot(getRes(a*15), title="Resistance 15", color=resColor, linewidth=2)
plot(getSup(a*15), title="Support 15", color=supColor, linewidth=2)

plot(getRes(a*20), title="Resistance 20", color=resColor, linewidth=2)
plot(getSup(a*20), title="Support 20", color=supColor, linewidth=2)

plot(getRes(a*25), title="Resistance 25", color=resColor, linewidth=2)
plot(getSup(a*25), title="Support 25", color=supColor, linewidth=2)

plot(getRes(a*30), title="Resistance 30", color=resColor, linewidth=2)
plot(getSup(a*30), title="Support 30", color=supColor, linewidth=2)

plot(getRes(a*35), title="Resistance 35", color=resColor, linewidth=2)
plot(getSup(a*35), title="Support 35", color=supColor, linewidth=2)

plot(getRes(a*40), title="Resistance 40", color=resColor, linewidth=2)
plot(getSup(a*40), title="Support 40", color=supColor, linewidth=2)

plot(getRes(a*45), title="Resistance 45", color=resColor, linewidth=2)
plot(getSup(a*45), title="Support 45", color=supColor, linewidth=2)

plot(getRes(a*50), title="Resistance 50", color=resColor, linewidth=2)
plot(getSup(a*50), title="Support 50", color=supColor, linewidth=2)

plot(getRes(a*75), title="Resistance 75", color=resColor, linewidth=2)
plot(getSup(a*75), title="Support 75", color=supColor, linewidth=2)

plot(getRes(a*100), title="Resistance 100", color=resColor, linewidth=2)
plot(getSup(a*100), title="Support 100", color=supColor, linewidth=2)

plot(getRes(a*150), title="Resistance 150", color=resColor, linewidth=2)
plot(getSup(a*150), title="Support 150", color=supColor, linewidth=2)

plot(getRes(a*200), title="Resistance 200", color=resColor, linewidth=2)
plot(getSup(a*200), title="Support 200", color=supColor, linewidth=2)

plot(getRes(a*250), title="Resistance 250", color=resColor, linewidth=2)
plot(getSup(a*250), title="Support 250", color=supColor, linewidth=2)

plot(getRes(a*300), title="Resistance 300", color=resColor, linewidth=2)
plot(getSup(a*300), title="Support 300", color=supColor, linewidth=2)

plot(getRes(a*350), title="Resistance 350", color=resColor, linewidth=2)
plot(getSup(a*350), title="Support 350", color=supColor, linewidth=2)

plot(getRes(a*400), title="Resistance 400", color=resColor, linewidth=2)
plot(getSup(a*400), title="Support 400", color=supColor, linewidth=2)

plot(getRes(a*450), title="Resistance 450", color=resColor, linewidth=2)
plot(getSup(a*450), title="Support 450", color=supColor, linewidth=2)

plot(getRes(a*500), title="Resistance 500", color=resColor, linewidth=2)
plot(getSup(a*500), title="Support 500", color=supColor, linewidth=2)

plot(getRes(a*750), title="Resistance 750", color=resColor, linewidth=2)
plot(getSup(a*750), title="Support 750", color=supColor, linewidth=2)

plot(getRes(a*1000), title="Resistance 1000", color=resColor, linewidth=2)
plot(getSup(a*1000), title="Support 1000", color=supColor, linewidth=2)

plot(getRes(a*1250), title="Resistance 1250", color=resColor, linewidth=2)
plot(getSup(a*1250), title="Support 1250", color=supColor, linewidth=2)

plot(getRes(a*1500), title="Resistance 1500", color=resColor, linewidth=2)
plot(getSup(a*1500), title="Support 1500", color=supColor, linewidth=2)

免责声明

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.