Indicators/probuilder · probacktest · proorder · proscreener

SenkouSpanB

SenkouSpanB in ProBuilder returns the Ichimoku Senkou Span B line, the average of the 52-period highest high and lowest low forming the cloud's slower edge.

Syntax

probuilder
SenkouSpanB[9,26,52]

Parameters

NameTypeDefaultDescription
first periodinteger9Tenkan-sen period of the Ichimoku configuration. Included for consistency with the full indicator settings.
second periodinteger26Kijun-sen period, also the forward displacement used when the cloud is drawn on Ichimoku charts.
third periodinteger52The lookback actually used by Senkou Span B, the window for the highest high and lowest low.

Formula

code
SenkouSpanB = (Highest[52](high) + Lowest[52](low)) / 2

The midpoint of the price range over the last 52 periods. In the full Ichimoku Kinko Hyo display this value is plotted 26 periods ahead of the current bar, forming the far edge of the cloud, or Kumo.

How it works

Ichimoku Kinko Hyo consists of five lines, and Senkou Span B is the slowest of them. Because it averages the extreme high and low of a long 52-period window, the line moves only when price sets new extremes, so it often runs flat for extended stretches. Those flat sections are read as strong support or resistance shelves, levels the market repeatedly respected over the past 52 bars.

Together with SenkouSpanA, the faster span built from the Tenkan-sen and Kijun-sen midpoints, Senkou Span B bounds the cloud. Span A above Span B paints a bullish cloud, Span A below Span B a bearish one, and the vertical distance between them gauges how thick the support or resistance zone is.

In ProBuilder code, SenkouSpanB[9,26,52] returns the computed midpoint value for the bar being evaluated. The 26-period forward displacement is a charting convention of the Ichimoku display. Code that wants to compare the current close against the cloud as drawn on the chart must apply the displacement itself, typically by referencing the value from 26 bars ago with [26] indexing, since the cloud above today's candle was projected from data 26 bars back.

Examples

Example 1, Plotting the raw line (Indicator)

probuilder
// Standard Ichimoku settings 9, 26, 52
mySenkouSpanB = SenkouSpanB[9,26,52]
RETURN mySenkouSpanB as "Senkou Span B"

Computes Senkou Span B with the default configuration and plots it under its conventional label. Combined with SenkouSpanA this reproduces the two cloud boundaries.

Example 2, Trading above the displaced cloud edge (ProOrder)

probuilder
DEFPARAM CumulateOrders = false

spanB = SenkouSpanB[9,26,52]
// The cloud over the current candle was projected 26 bars ago
cloudEdge = spanB[26]

// Long only while price holds above the slower cloud boundary
IF NOT LongOnMarket AND close CROSSES OVER cloudEdge THEN
  BUY 1 CONTRACT AT MARKET
ENDIF

IF LongOnMarket AND close CROSSES UNDER cloudEdge THEN
  SELL AT MARKET
ENDIF

The [26] offset aligns the code with the chart, comparing the close against the cloud edge actually drawn above or below the current candle rather than against today's undisplaced value.

Example 3, Screening for closes above Senkou Span B (ProScreener)

probuilder
spanB = SenkouSpanB[9,26,52]
aboveCloudEdge = close > spanB[26]
SCREENER[aboveCloudEdge](close AS "Last price")

Returns instruments trading above the displaced Senkou Span B level, one half of the standard price-above-cloud bullish condition.

Interpretation

ConfigurationReading
Price above the cloud edgeBullish context, Senkou Span B acts as deep support.
Price below the cloud edgeBearish context, the line acts as overhead resistance.
Span A above Span BBullish cloud, the trend structure favours longs.
Span A below Span BBearish cloud.
Long flat sectionsStrong horizontal support or resistance shelf formed by past extremes.

Because Senkou Span B derives from a 52-period range midpoint, it represents the longer-term equilibrium in the Ichimoku framework. Breaks through a flat Span B are considered more significant than crosses of the faster lines, and cloud thickness, the gap to SenkouSpanA, measures how much structure a breakout must clear.

Common errors and gotchas

  • Displacement is not automatic in code. The chart plots the cloud 26 bars forward, but the instruction returns the undisplaced value for the evaluated bar. Comparing close > SenkouSpanB[9,26,52] tests against a future-positioned line, not the cloud over the current candle. Use the [26] back-reference for chart-consistent logic.
  • All three parameters are required. The call takes the full Ichimoku setting triplet even though only the third number drives this line. SenkouSpanB[52] raises a syntax error.
  • Flat line is a feature. Extended horizontal stretches are normal, the 52-period extremes simply have not changed. Logic that waits for the line to slope will stay idle for long periods.
  • Needs 52 bars of history plus displacement. On short data windows or high timeframes with limited bars loaded, early values are unreliable. Ensure enough preloaded history before the first trading decision.
  • SenkouSpanA, the faster cloud boundary, midpoint of Tenkan-sen and Kijun-sen.
  • KijunSen, 26-period Ichimoku base line.
  • TenkanSen, 9-period Ichimoku conversion line.
  • Highest, highest value over N bars, one half of the Span B midpoint.
  • Lowest, lowest value over N bars, the other half.
  • Average, simple moving average for non-Ichimoku baselines.
  • Supertrend, alternative trend-context indicator.
  • ExponentialAverage, general smoothing alternative to range midpoints.