KijunSen
KijunSen in ProBuilder returns the Ichimoku base line, the midpoint of the highest high and lowest low over the last 26 bars. Syntax, formula, worked examples.
Syntax
KijunSen[9,26,52]Parameters
| Name | Type | Default | Description |
|---|---|---|---|
T | integer | 9 | Tenkan-sen period of the Ichimoku system. Required by the signature but does not change the value of this line. |
K | integer | 26 | Kijun period. The lookback window used for the highest high and lowest low in this calculation. |
S | integer | 52 | Senkou Span B period. Required by the signature but does not change the value of this line. |
Formula
KijunSen = (Highest[K](high) + Lowest[K](low)) / 2With the default settings this is (Highest[26](high) + Lowest[26](low)) / 2, the middle of the 26-bar price range.
How it works
On each bar, ProBuilder scans the last K bars, takes the single highest high and the single lowest low, and returns their average. The result is the midpoint of the recent trading range rather than an average of every bar, which gives the line its characteristic behavior: it moves only when price sets a new extreme inside the window, and stays perfectly flat otherwise. Flat stretches therefore mark consolidation, and the flat level itself often acts as a magnet for price.
All three Ichimoku periods appear in the brackets so that the five Ichimoku functions share one signature, but only the middle parameter affects Kijun-sen. TenkanSen uses the first parameter the same way over a shorter window, and SenkouSpanB uses the third.
The function reads the instrument's highs and lows directly. There is no (price) argument.
Examples
Example 1, Base line with standard settings (Indicator)
// Ichimoku base line with the standard 9, 26, 52 settings
myKijunSen = KijunSen[9,26,52]
RETURN myKijunSenComputes the 26-bar midpoint line and plots it on the price chart, where it steps and flattens as new extremes appear and expire.
Example 2, Kijun cross with Tenkan filter (ProOrder)
// Long when price reclaims the base line while the fast line is above it
kijun = KijunSen[9,26,52]
tenkan = TenkanSen[9,26,52]
IF NOT LongOnMarket AND close CROSSES OVER kijun AND tenkan > kijun THEN
BUY 1 CONTRACT AT MARKET
ELSIF LongOnMarket AND close CROSSES UNDER kijun THEN
SELL AT MARKET
ENDIFEnters when the close crosses above Kijun-sen with the faster Tenkan-sen already on the bullish side, and exits on the opposite cross.
Example 3, Rising base line scan (ProScreener)
// Instruments above a rising base line
kijun = KijunSen[9,26,52]
SCREENER[close > kijun AND kijun > kijun[10]](kijun AS "Kijun-sen")Returns instruments whose close sits above a Kijun-sen that is higher than it was 10 bars ago, a simple medium-term strength filter.
Interpretation
Price above Kijun-sen indicates a bullish medium-term bias, price below indicates a bearish one, and the cross of price through the line is one of the classic Ichimoku signals. The slope carries information too: a rising line confirms an uptrend, a flat line signals equilibrium, and extended flat sections frequently attract price back toward them.
The distance between price and Kijun-sen is a stretch measure. In Ichimoku practice, a market far above its base line is considered extended, with a pullback to the line treated as a normal retracement rather than a reversal.
Common errors and gotchas
- Three parameters, one of which matters. All three periods are required by the syntax, but only the middle value changes the output.
KijunSen[9,26,52]andKijunSen[7,26,44]return identical values. - Not a moving average. The line is a midpoint of extremes, so it steps and flattens instead of curving. Logic that assumes a new value every bar, such as slope calculations over one bar, will often see zero change.
- No price argument.
KijunSen[9,26,52](close)does not compile. The calculation always uses the instrument's highs and lows. - Displacement belongs to other lines. Kijun-sen is plotted on the current bar. Only the Senkou spans are projected forward in a full Ichimoku chart, so no offset should be applied when combining the lines manually.
Related instructions
TenkanSen, the faster Ichimoku conversion line, same construction overTbars.SenkouSpanA, leading span averaging Tenkan-sen and Kijun-sen.SenkouSpanB, leading span using theS-bar midpoint.Highest, highest value of a series over a window, one half of the formula.Lowest, lowest value of a series over a window, the other half.Average, conventional moving average for comparison.DonchianChannelCenter, the same midpoint idea packaged as a channel center.Supertrend, another trend-following support and resistance line.
