//@version=4
study("Resistance Breakout", overlay=true)
// Define variables
resistance_30 = security(syminfo.tickerid, "D", highest(high, 30))
resistance_90 = security(syminfo.tickerid, "D", highest(high, 90))
resistance_180 = security(syminfo.tickerid, "D", highest(high, 180))
resistance_360 = security(syminfo.tickerid, "D", highest(high, 360))
// Plot resistance lines
plot(resistance_30, color=color.gray, linewidth=2)
plot(resistance_90, color=color.gray, linewidth=2)
plot(resistance_180, color=color.gray, linewidth=2)
plot(resistance_360, color=color.gray, linewidth=2)
// Buy signals
if (close > resistance_30)
plotshape(series=na, title="Buy", location=location.belowbar, color=color.green, transp=0, style=shape.triangleup)
if (close > resistance_90)
plotshape(series=na, title="Buy", location=location.belowbar, color=color.green, transp=0, style=shape.triangleup)
if (close > resistance_180)
plotshape(series=na, title="Buy", location=location.belowbar, color=color.green, transp=0, style=shape.triangleup)
if (close > resistance_360)
plotshape(series=na, title="Buy", location=location.belowbar, color=color.green, transp=0, style=shape.triangleup)
This pinescript v4 code defines the resistance levels based on the number of bars (30, 90, 180, 360) and plots them on the chart. It also plots a green triangle up whenever the price breaks out of these resistance levels, indicating a buy signal. You can customize the code further to suit your preferences.
//@version=4
study("Resistance Breakout", overlay=true)
// Define variables
resistance_30 = security(syminfo.tickerid, "D", highest(high, 30))
resistance_90 = security(syminfo.tickerid, "D", highest(high, 90))
resistance_180 = security(syminfo.tickerid, "D", highest(high, 180))
resistance_360 = security(syminfo.tickerid, "D", highest(high, 360))
// Plot resistance lines
plot(resistance_30, color=color.gray, linewidth=2)
plot(resistance_90, color=color.gray, linewidth=2)
plot(resistance_180, color=color.gray, linewidth=2)
plot(resistance_360, color=color.gray, linewidth=2)
// Buy signals
if (close > resistance_30)
plotshape(series=na, title="Buy", location=location.belowbar, color=color.green, transp=0, style=shape.triangleup)
if (close > resistance_90)
plotshape(series=na, title="Buy", location=location.belowbar, color=color.green, transp=0, style=shape.triangleup)
if (close > resistance_180)
plotshape(series=na, title="Buy", location=location.belowbar, color=color.green, transp=0, style=shape.triangleup)
if (close > resistance_360)
plotshape(series=na, title="Buy", location=location.belowbar, color=color.green, transp=0, style=shape.triangleup)