Multi-Bar Formation Node

The Multi-Bar Formation node matches a run of two to five candles, each described by its color and how its high, low and body compare with the bar before. Its rules and presets, its two outputs, and what it can't express.

NodeBy AlgoLiftUpdated 6 min read
On this page 8How it worksWhat it can't sayExample: buy the break of an inside barSettingsOutputsUse something else whenWhen it doesn't behaveGoing further

Some patterns only exist between candles. An engulfing bar is a body that swallows the one before it. An inside bar tucks its whole range inside the previous one. Three soldiers march up in a row. The Multi-Bar Formation node describes a run of two to five bars, one set of rules per bar, and tells you when the candles that just closed fit.

Takes
Nothing. It reads its series' candles
Gives
True on the bar after a match, and how many bars since the last one
Reach for it
A setup is defined by how a few consecutive candles relate

How it works

The editor lays the pattern out as tabs, Bar 1 to Bar 5, oldest first. A pattern has at least two bars, and Add Bar takes it up to five. Each bar gets four rules:

RuleChoicesCompared with
DirectionAny, Bullish, BearishIts own open and close
High vs Prev BarAny, Higher High, Lower HighThe previous bar's high
Low vs Prev BarAny, Higher Low, Lower LowThe previous bar's low
Real Body (O/C)Any, Engulfs Prev Body, Inside Prev BodyThe previous bar's body

Bar 1 has nothing before it inside the pattern, so only its Direction counts, and the editor greys out the rest. From Bar 2 on, a Quick Setup row sets a bar to Inside, Outside, Bull Engulf or Bear Engulf in one click.

Every comparison is strict. Bullish means the close is above the open, a Higher High means strictly above the previous high, and Engulfs Prev Body needs this body's top above the previous body's top and its bottom below the previous bottom. Equal prices fail in both directions, so a candle that closes on its open is neither Bullish nor Bearish, and two matching highs are neither higher nor lower. Real Body rules ignore the wicks.

Each time a bar closes, the node checks the pattern against that many of the latest completed bars, the newest one playing the last bar of the pattern. When they fit, Formation Match is true for the whole of the next bar. The windows overlap: four rising bars match a three-bar Three White Soldiers twice, once when the third bar closes and again when the fourth does.

What it can't say

Those four rules are its whole vocabulary. There's no rule for a higher close, a bar's size, a gap or an equal high, and the pattern's bars are always consecutive. That's worth knowing when you load a preset, because the names promise a little more than the rules check:

PresetThe rules, oldest bar first
Bullish EngulfingBearish; then Bullish, Lower Low, Engulfs Prev Body
Bearish EngulfingBullish; then Bearish, Higher High, Engulfs Prev Body
Three White SoldiersBullish; then twice Bullish with a Higher High and Higher Low
Three Black CrowsBearish; then twice Bearish with a Lower High and Lower Low
Inside BarAny; then Lower High, Higher Low, Inside Prev Body
Outside Bar (Expansion)Any; then Higher High, Lower Low
Morning StarBearish; then Lower High and Lower Low; then Bullish, Higher High, Higher Low
Evening StarBullish; then Higher High and Higher Low; then Bearish, Lower High, Lower Low

So the soldiers climb by their highs and lows, not their closes. The Morning Star has no idea whether its middle candle is small. And both engulfing presets ask for more than an engulfing body: the bullish one also wants a lower low, the bearish one a higher high. A node fresh from the library starts as that Bullish Engulfing pair.

Example: buy the break of an inside bar

Say you trade NQ 5m and like inside bars: a quiet bar sitting inside the one before it, then a break of its high. You want in the moment price clears that high, with the stop under the inside bar.

Add a Multi-Bar Formation and load the Inside Bar preset. When an inside bar closes, Formation Match is true for the whole next bar, and during that bar the last completed candle is the inside bar itself. So the level to break is a one-bar Price History reading the high. Wire Current Price into a of a Crossover and the Price History into b, direction Above, on the Intrabar clock. AND the crossover with Formation Match through a Logic node into a long Entry.

For the stop, measure the Bracket Order's stop from the Signal bar, 1 point. On a long that's the low of the last completed bar at the fill: the inside bar.

This version only takes a break during the bar right after the inside bar. If price waits a bar longer, the formation has moved on, and so has the one-bar high.

Settings

Sequence Rules
Default Bullish Engulfing (2 bars)
Two to five bars, oldest first, each with a Direction, High vs Prev Bar, Low vs Prev Bar and Real Body (O/C) rule. Load Preset fills them from the library; Save As keeps your own.

Outputs

Formation Match
True or false
True for the whole bar after the last bar of a match closes. False everywhere else.
Bars Since
Number
How many bars have closed since the latest match: 0 during the first bar after it, then counting up. Unset before the first match.

Use something else when

The shape of one candle matters
A hammer or a doji is a statement about one bar's body and wicks. AND it with a formation when you need both.
You mean swing highs, not bar-to-bar highs
A Higher High here is higher than the bar before. A swing high is a turning point confirmed by bars on both sides, and that node tracks those.
Each close should beat the last
There's no close rule here. Compare a one-bar Price History of the close with one that skips a bar.

When it doesn't behave

The builder won't let me wire it into a Since, Capture or Crossover

The formation keeps a running count across the engine's monthly chunks of history, so a node that needs the whole history behind a value (a Crossover, Since, Capture or State Machine) can't read it correctly, and the builder refuses rather than guess. Its own Bars Since covers the usual need: "formed in the last three bars" is Bars Since at 2 or less, in a Comparison.

It fires on two bars in a row

Overlapping windows. Four rising bars contain two three-bar runs, and the node reports both. To catch only the start of a run, add a bar at the front of the pattern that breaks it: a Bearish Bar 1 before the three soldiers means a fourth rising bar can't match again.

It misses engulfing bars I can see on the chart

The engulfing presets add a range rule on top of the body: the Bullish Engulfing's second bar must also make a lower low. Set Low vs Prev Bar back to Any if the body is all you care about. And check for ties: a body that matches the previous body's edge exactly doesn't engulf it.

My Three White Soldiers include a bar that closed lower

The preset checks higher highs and higher lows, never the closes. A bar can make both and still close below the bar before it. If closes matter, compare one-bar Price History closes in pairs (skip 0 against skip 1, then skip 1 against skip 2) and AND both Comparisons in.

Going further

A formation can describe a slower timeframe than the one you trade. Point the node at a 1h series and use 5m logic for the entry, and the pattern describes the hourly candles while the timing comes from the fast ones.

Formations sweep through presets, the built-in eight and any you've saved. They're easy to multiply, too: two-bar patterns alone come in hundreds of combinations, and some will look brilliant on any history. Settle on the formation your idea needs before you run it, and count every variant you test.

Or ask the copilot