-2

//@version=5 indicator("Support Resistance Channels") study("Support Resistance Channels", "sr_channels", overlay = true, max_bars_back = 501)

// Input parameters prd = input(defval = 10, title="Pivot Period", minval = 4, maxval = 30, group = "Settings ", tooltip="Used while calculating Pivot Points, checks left&right bars") ppsrc = input(defval = 'High/Low', title="Source", options = ['High/Low', 'Close/Open'], group = "Settings ", tooltip="Source for Pivot Points") ChannelW = input(defval = 5, title = "Maximum Channel Width %", minval = 1, maxval = 8, group = "Settings ", tooltip="Calculated using Highest/Lowest levels in 300 bars") minstrength = input(defval = 1, title = "Minimum Strength", minval = 1, group = "Settings ", tooltip = "Channel must contain at least 2 Pivot Points") maxnumsr = input(defval = 6, title = "Maximum Number of S/R", minval = 1, maxval = 10, group = "Settings ", tooltip = "Maximum number of Support/Resistance Channels to Show") - 1 loopback = input(defval = 290, title = "Loopback Period", minval = 100, maxval = 400, group = "Settings ", tooltip="While calculating S/R levels it checks Pivots in Loopback Period") res_col = input(defval = color.new(color.red, 75), title = "Resistance Color", group = "Colors ") sup_col = input(defval = color.new(color.lime, 75), title = "Support Color", group = "Colors ") inch_col = input(defval = color.new(color.gray, 75), title = "Color When Price in Channel", group = "Colors ") showpp = input(defval = false, title = "Show Pivot Points", group = "Extras ⏶⏷") showsrbroken = input(defval = false, title = "Show Broken Support/Resistance", group = "Extras ⏶⏷") showthema1en = input(defval = false, title = "MA 1", inline = "ma1") showthema1len = input(defval = 50, title = "", inline = "ma1") showthema1type = input(defval = "SMA", title = "", options = ["SMA", "EMA"], inline = "ma1") showthema2en = input(defval = false, title = "MA 2", inline = "ma2") showthema2len = input(defval = 200, title = "", inline = "ma2") showthema2type = input(defval = "SMA", title = "", options = ["SMA", "EMA"], inline = "ma2")

// Calculate moving

idk what to do trying fixing the code thought it was a spacing issue or copying but i am not sure

1 Answers1

0

This works:

I've changed input()'s to suit v5 (input.int for example), and added a plot() for reference.


//@version=5
indicator("Support Resistance Channels", "sr_channels", overlay = true, max_bars_back = 501)

//Input parameters
prd = input.int(defval = 10, title="Pivot Period", minval = 4, maxval = 30, group = "Settings ", tooltip="Used while calculating Pivot Points, checks left&right bars")
ppsrc = input.string(defval = 'High/Low', title="Source", options = ['High/Low', 'Close/Open'], group = "Settings ", tooltip="Source for Pivot Points")
ChannelW = input.int(defval = 5, title = "Maximum Channel Width %", minval = 1, maxval = 8, group = "Settings ", tooltip="Calculated using Highest/Lowest levels in 300 bars")
minstrength = input.int(defval = 1, title = "Minimum Strength", minval = 1, group = "Settings ", tooltip = "Channel must contain at least 2 Pivot Points")
maxnumsr = input.int(defval = 6, title = "Maximum Number of S/R", minval = 1, maxval = 10, group = "Settings ", tooltip = "Maximum number of Support/Resistance Channels to Show") - 1
loopback = input.int(defval = 290, title = "Loopback Period", minval = 100, maxval = 400, group = "Settings ", tooltip="While calculating S/R levels it checks Pivots in Loopback Period")
res_col = input.color(defval = color.new(color.red, 75), title = "Resistance Color", group = "Colors ")
sup_col = input.color(defval = color.new(color.lime, 75), title = "Support Color", group = "Colors ")
inch_col = input.color(defval = color.new(color.gray, 75), title = "Color When Price in Channel", group = "Colors ")
showpp = input.bool(defval = false, title = "Show Pivot Points", group = "Extras ⏶⏷")
showsrbroken = input.bool(defval = false, title = "Show Broken Support/Resistance", group = "Extras ⏶⏷")
showthema1en = input.bool(defval = false, title = "MA 1", inline = "ma1")
showthema1len = input.int(defval = 50, title = "", inline = "ma1")
showthema1type = input.string(defval = "SMA", title = "", options = ["SMA", "EMA"], inline = "ma1")
showthema2en = input.bool(defval = false, title = "MA 2", inline = "ma2")
showthema2len = input.int(defval = 200, title = "", inline = "ma2")
showthema2type = input.string(defval = "SMA", title = "", options = ["SMA", "EMA"], inline = "ma2")

//I'VE INCLUDED A PLOT JUST FOR CLARITY AND REFERENCE - AMEND TO SUIT YOUR PREFERENCE
maPlot = ta.sma(close, showthema1len)
plot(maPlot)