Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // © Julien_Eche
- //@version=5
- indicator("Volume Profile Channel", shorttitle="VP Channel", overlay=true)
- // Variable declaration
- length = input(20, "Length of POC and High/Low Calculation")
- pocLineWidth = input.int(1, "POC Line Width", minval=1)
- showPOCLine = input(true, "Show POC Line")
- // Retrieve values of classic Volume Profile indicators
- areaHigh = request.security(syminfo.tickerid, "D", high[1])
- areaLow = request.security(syminfo.tickerid, "D", low[1])
- poc = request.security(syminfo.tickerid, "D", close[1])
- // Calculate the smoothed POC line and historical high/low with the specified length
- smoothedPOC = ta.sma(poc, length)
- rangeHigh = ta.highest(areaHigh, length)
- rangeLow = ta.lowest(areaLow, length)
- // Plot the volume channel lines
- plot(showPOCLine ? smoothedPOC : na, color=color.silver, linewidth=pocLineWidth, title="Smoothed POC", style=plot.style_linebr)
- p1 = plot(rangeHigh, color=color.teal, linewidth=1, title="Upper Channel")
- p2 = plot(rangeLow, color=color.red, linewidth=1, title="Lower Channel")
- p0 = plot(smoothedPOC, color=color.rgb(0, 0, 0, 100), linewidth=1, title="Lower Channel")
- // Fill the area between the upper and lower channel lines
- fill(p1, p0, color=color.new(color.teal, 90))
- fill(p2, p0, color=color.new(color.red, 90))
Advertisement
Add Comment
Please, Sign In to add comment