// -----------------------------------------------
// PRC_Support and Resistance Power Channel [ChartPrime]
//version = 0
//07.10.2025
//Iván González @ www.prorealcode.com
//Sharing ProRealTime knowledge
// -----------------------------------------------
// INPUTS
// -----------------------------------------------
DEFPARAM DRAWONLASTBARONLY = true
length = 130
extend = 30
// COLOURS
tcolR = 255
tcolG = 0
tcolB = 255
bcolR = 0
bcolG = 255
bcolB = 0
alpha = 60
// -----------------------------------------------
// CALCULATION SUPPORT AND RESISTANCE AREA
// -----------------------------------------------
// ATR
atr = AverageTrueRange[200] * 0.5
// HIGHEST AND LOWEST PRICE
maxVal = HIGHEST[length](high)
minVal = LOWEST[length](low)
midVal = (maxVal + minVal) / 2
// -----------------------------------------------
// DRAW SUPPORT AND RESISTANCE AREA
// -----------------------------------------------
if islastbarupdate then
maxOffset = barssince(high=maxVal)
minOffset = barssince(low=minVal)
// RESISTANCE AREA
DRAWRECTANGLE(barindex - length, maxVal + atr, barindex + extend, maxVal - atr) fillcolor(tcolR, tcolG, tcolB, alpha)COLOURED(tcolR, tcolG, tcolB,0)
DRAWSEGMENT(barindex - length, maxVal + atr, barindex + extend + 30, maxVal + atr) COLOURED(tcolR, tcolG, tcolB)
DRAWTEXT("▲ #maxVal#", barindex + extend + 10, maxVal)
// SUPPORT AREA
DRAWRECTANGLE(barindex - length, minVal + atr, barindex + extend, minVal - atr) fillcolor(bcolR, bcolG, bcolB, alpha)COLOURED(bcolR, bcolG, bcolB, 0)
DRAWSEGMENT(barindex - length, minVal - atr, barindex + extend + 30, minVal - atr) COLOURED(bcolR, bcolG, bcolB)
DRAWTEXT("▼ #minVal#", barindex + extend + 10, minVal)
// MIDDLE LINE
DRAWSEGMENT(barindex - length, midVal, barindex + extend, midVal) COLOURED(128, 128, 128) STYLE(DOTTEDLINE, 1)
DRAWTEXT("▶ #midVal#", barindex + extend + 10, midVal) COLOURED(128, 128, 128)
// BUY AND SELL POWER
buyPower = 0
sellPower = 0
FOR i = 0 TO length - 1 DO
IF close[i] > open[i] THEN
buyPower = buyPower + 1
ELSIF close[i] < open[i] THEN
sellPower = sellPower + 1
ENDIF
NEXT
textPosX = barindex - length - extend
DRAWTEXT("Sell Power: #sellpower#", textPosX, maxVal)
DRAWTEXT("Buy Power: #buypower#", textPosX, minVal)
// DRAW SUPPORT AND RESISTANCE TESTS
topOfSupport = minVal + atr
bottomOfResistance = maxVal - atr
FOR i = 0 TO length - 1 DO
IF low[i+1] <= topOfSupport AND low[i] > topOfSupport THEN
DRAWARROWUP(barindex - i, minval - atr*1.5) COLOURED(bcolR, bcolG, bcolB)
ENDIF
IF high[i+1] >= bottomOfResistance AND high[i] < bottomOfResistance THEN
DRAWARROWDOWN(barindex - i, maxval + 1.5*atr) COLOURED(tcolR, tcolG, tcolB)
ENDIF
if high[i]=maxval then
drawpoint(barindex[i],maxval,3)coloured(tcolR, tcolG, tcolB)
endif
if low[i]=minval then
drawpoint(barindex[i],minval,3)coloured(bcolR, bcolG, bcolB)
endif
NEXT
endif
return