S&R Power Channel: Rolling Extremes, ATR Buffer and Candle Counts
The copied example plots the highest high of 130 bars plus half of ATR(200), and the lowest low minus the same buffer. It also calculates bullish and bearish candle counts, but does not display those counts. The distinction between current rolling bands and previously fixed levels is essential before writing any breakout rule.
Inspect the Pine ScriptIdentify the implementation before interpreting the picture
ChartPrime published an indicator with this name on May 20, 2025. Its public description includes zones, counts, projections and delayed markers. This page documents Pineify’s specific calculation and the shorter copied example below; it does not establish that every feature or historical signal matches the published script.
The copied helper scans indices 0 through length − 1, so the current bar participates. With H as the window’s highest high, L as its lowest low and A as ATR(200), upper = H + A/2 and lower = L − A/2. Width is H − L + A. The derived midpoint is (H + L)/2 because the symmetric buffers cancel; it is price-derived, although it is not a separately established support level.
The example uses fixed arguments 130 and 30. The second argument, extend, is unused inside the calculation and the two plot calls. Changing it does not project these plotted lines. The example contains no input declarations, boxes, labels, midpoint plot, alert conditions or orders.
Why a breakout through the current outer band cannot occur
For ordinary valid OHLC data and a nonnegative available ATR, current close ≤ current high ≤ H ≤ upper. Similarly, current close ≥ current low ≥ L ≥ lower. Therefore close above the current upper band or below the current lower band is impossible. With strictly positive ATR, even the current high and low cannot touch the corresponding outer bands. Setting a smaller positive buffer does not remove this constraint.
For a hypothetical initialized window with H = 110, L = 90 and ATR = 4, the bands are 112 and 88; width is 24 and midpoint is 100. Suppose a new bar has high 114, low 108 and close 113, with previous close 109. Its true range is 6, so Wilder ATR(200) updates from 4 to 4.01. If the old low 90 remains in the window, the new upper is 116.005 and lower is 87.995. Close 113 exceeds the old upper 112, but remains below its own bar’s upper 116.005.
A test against the previous bar’s completed band is a different rule and can trigger. A zone frozen at an earlier observation is another distinct rule. Specify exactly which level was known before entry, whether the event uses close or intrabar high/low, and when the order can execute. The supplied code implements neither alternative. Do not use an impossible current-band condition and report it as a tested strategy.
Candle counts do not measure net buying or net price change
Buy Power counts close greater than open; Sell Power counts close less than open. A doji contributes to neither. With a complete N-bar window, B + S ≤ N, with equality only when every bar is non-doji. These are unweighted classifications: a tiny green candle and a large green candle each add one, regardless of volume.
Consider two hypothetical bars with open/close 100/101 and 90/91. Both are green, so B = 2 and S = 0, while the price falls from the first open 100 to the final close 91. A gap can dominate the within-bar gains. Counts cannot identify institutional participation, aggressive order flow or a probability of future gains.
Once a fixed window is full, B changes by the incoming bullish indicator minus the outgoing one; its per-bar change is at most one in either direction. The same holds for S. A claim that a fixed window’s bullish count falls by 15 in five bars is inconsistent with this calculation. Intrabar close can change a candle’s classification before it finishes.
A share B/N includes dojis in the denominator. B/(B+S) excludes them and needs a zero-denominator policy. Label the chosen denominator explicitly rather than treating these percentages as interchangeable confidence scores.
Separate the Visual Editor drawing from this two-line example
Pineify’s separate Visual Editor drawing method does use length and extend. On the last chart bar it recreates horizontal bands, boxes, a midpoint and count labels from the current calculation. The upper zone spans H − A/2 to H + A/2; the lower zone spans L − A/2 to L + A/2. Price can enter the inner part of such a zone without touching its outer boundary.
In that drawing implementation the boxes and midpoint end at current bar index + extend, while outer horizontal lines end at current bar index + extend + 30. With extend = 30 those endpoints are 30 and 60 bars ahead respectively. Those projections repeat a current level; they are not future price forecasts.
The horizontal objects also extend backward from the latest observation. Their current levels must not be read as levels that were known on every earlier bar they cover. The copied example instead plots a historical series of recalculated bounds and omits these drawing objects. Neither version’s displayed count establishes profitable entries.
Window length, warm-up and live updates
A new high immediately enters a rolling maximum even with a long window. A longer length retains an old extreme for longer; it does not impose a fixed two- or five-bar delay on new extremes. Width can contract when an old extreme expires, when ATR declines, or both. This differs from a standard-deviation squeeze and does not supply a directional prediction.
ATR uses 200 bars regardless of the extrema lookback. Reducing length to 30 does not reduce ATR initialization to 30 bars. Check that ATR and the complete intended price window are available before interpreting the output; the helper contains no explicit all-history readiness gate.
130 five-minute bars represent 650 minutes of bar intervals, with calendar coverage affected by sessions and gaps. On a continuous 24-hour market, 130 four-hour bars represent about 21.67 days; 130 daily bars represent 130 days. These counts are not universal calendar durations for exchange-traded sessions.
The indicator executes on live updates without a bar-close gate. Current highs, lows, close, counts and ATR may change before the bar closes. ATR is measured in the chart’s price units and depends on its timeframe and feed; it is not timeframe-independent.
A Donchian-style calculation uses rolling extremes without this added buffer. An EMA-centered ATR channel uses a different center and can allow price outside its current bands. Comparing them requires matching data and timing, not assigning unsupported win rates or preferred markets.
Pine Script v6: implementation and limits
This complete example retains the fixed 130-bar window, 200-bar ATR and unused extend argument. It calculates counts but plots only the outer bounds. The existing image is a visual reference, not proof that the copied source draws all pictured objects.
//@version=6
indicator(title="Support and Resistance Power Channel", overlay=true, max_labels_count=500)
// Core function: channel from highest high/lowest low + ATR buffer
p_ta_sr_power_channel(simple int length, simple int extend) =>
atr = ta.atr(200) * 0.5
max_arr = array.new_float(length, na)
min_arr = array.new_float(length, na)
for i = 0 to length - 1
array.set(max_arr, i, high[i])
array.set(min_arr, i, low[i])
max_ = array.max(max_arr)
min_ = array.min(min_arr)
upper = max_ + atr
lower = min_ - atr
buyPower = math.sum(close > open ? 1.0 : 0.0, length)
sellPower = math.sum(close < open ? 1.0 : 0.0, length)
[upper, lower, buyPower, sellPower, atr]
// 130-bar lookback, 30-bar projection
[p_ind_1_upper, p_ind_1_lower, p_ind_1_buyPower, p_ind_1_sellPower, p_ind_1_atrHalf] = p_ta_sr_power_channel(130, 30)
// Visual plots on the price chart
plot(p_ind_1_upper, "Resistance", color=color.new(#E040FB, 0), linewidth=2)
plot(p_ind_1_lower, "Support", color=color.new(#00E676, 0), linewidth=2)Specify a checkable adaptation in Pineify
Ask the Pine Script AI Coding Agent to expose the required inputs and display counts with an explicit denominator. For breakout research, specify a previous completed or frozen level and its exact execution timing. Review generated source, compare chart values and test costs and a separate sample; do not assume the current-band inequality can trigger.
Open Pine Script AI Coding AgentEducational indicator analysis. No measured trading performance is established here. Syntax validation does not prove formula equivalence, execution assumptions or profitability.