Правильный путь - долгий путь, как в последней части вашего кода. Вы можете сделать это несколько проще, используя что-то вроде этого:
//@version=4
study("", "", true)
noOfPlots = input(12, minval = 0, maxval = 20)
a=10
d=0
plotNo = 0
plotNo := plotNo + 1, plot(plotNo <= noOfPlots ? highest(a* plotNo) : na, title="Resistance", color=color.green, linewidth=2, style=plot.style_line, transp=d, offset=-9999, trackprice=true)
plotNo := plotNo + 1, plot(plotNo <= noOfPlots ? highest(a* plotNo) : na, title="Resistance", color=color.green, linewidth=2, style=plot.style_line, transp=d, offset=-9999, trackprice=true)
plotNo := plotNo + 1, plot(plotNo <= noOfPlots ? highest(a* plotNo) : na, title="Resistance", color=color.green, linewidth=2, style=plot.style_line, transp=d, offset=-9999, trackprice=true)
plotNo := plotNo + 1, plot(plotNo <= noOfPlots ? highest(a* plotNo) : na, title="Resistance", color=color.green, linewidth=2, style=plot.style_line, transp=d, offset=-9999, trackprice=true)
plotNo := plotNo + 1, plot(plotNo <= noOfPlots ? highest(a* plotNo) : na, title="Resistance", color=color.green, linewidth=2, style=plot.style_line, transp=d, offset=-9999, trackprice=true)
plotNo := plotNo + 1, plot(plotNo <= noOfPlots ? highest(a* plotNo) : na, title="Resistance", color=color.green, linewidth=2, style=plot.style_line, transp=d, offset=-9999, trackprice=true)
plotNo := plotNo + 1, plot(plotNo <= noOfPlots ? highest(a* plotNo) : na, title="Resistance", color=color.green, linewidth=2, style=plot.style_line, transp=d, offset=-9999, trackprice=true)
plotNo := plotNo + 1, plot(plotNo <= noOfPlots ? highest(a* plotNo) : na, title="Resistance", color=color.green, linewidth=2, style=plot.style_line, transp=d, offset=-9999, trackprice=true)
plotNo := plotNo + 1, plot(plotNo <= noOfPlots ? highest(a* plotNo) : na, title="Resistance", color=color.green, linewidth=2, style=plot.style_line, transp=d, offset=-9999, trackprice=true)
plotNo := plotNo + 1, plot(plotNo <= noOfPlots ? highest(a* plotNo) : na, title="Resistance", color=color.green, linewidth=2, style=plot.style_line, transp=d, offset=-9999, trackprice=true)
plotNo := plotNo + 1, plot(plotNo <= noOfPlots ? highest(a* plotNo) : na, title="Resistance", color=color.green, linewidth=2, style=plot.style_line, transp=d, offset=-9999, trackprice=true)
plotNo := plotNo + 1, plot(plotNo <= noOfPlots ? highest(a* plotNo) : na, title="Resistance", color=color.green, linewidth=2, style=plot.style_line, transp=d, offset=-9999, trackprice=true)
plotNo := plotNo + 1, plot(plotNo <= noOfPlots ? highest(a* plotNo) : na, title="Resistance", color=color.green, linewidth=2, style=plot.style_line, transp=d, offset=-9999, trackprice=true)
plotNo := plotNo + 1, plot(plotNo <= noOfPlots ? highest(a* plotNo) : na, title="Resistance", color=color.green, linewidth=2, style=plot.style_line, transp=d, offset=-9999, trackprice=true)
plotNo := plotNo + 1, plot(plotNo <= noOfPlots ? highest(a* plotNo) : na, title="Resistance", color=color.green, linewidth=2, style=plot.style_line, transp=d, offset=-9999, trackprice=true)
plotNo := plotNo + 1, plot(plotNo <= noOfPlots ? highest(a* plotNo) : na, title="Resistance", color=color.green, linewidth=2, style=plot.style_line, transp=d, offset=-9999, trackprice=true)
plotNo := plotNo + 1, plot(plotNo <= noOfPlots ? highest(a* plotNo) : na, title="Resistance", color=color.green, linewidth=2, style=plot.style_line, transp=d, offset=-9999, trackprice=true)
plotNo := plotNo + 1, plot(plotNo <= noOfPlots ? highest(a* plotNo) : na, title="Resistance", color=color.green, linewidth=2, style=plot.style_line, transp=d, offset=-9999, trackprice=true)
plotNo := plotNo + 1, plot(plotNo <= noOfPlots ? highest(a* plotNo) : na, title="Resistance", color=color.green, linewidth=2, style=plot.style_line, transp=d, offset=-9999, trackprice=true)
plotNo := plotNo + 1, plot(plotNo <= noOfPlots ? highest(a* plotNo) : na, title="Resistance", color=color.green, linewidth=2, style=plot.style_line, transp=d, offset=-9999, trackprice=true)