Market Structure Node

The Market Structure node reads the trend off the swings and calls every break of the last swing high or low, telling a break of structure (with the trend) from a change of character (against it). Its rules, its lag, and how to trade a break.

NodeBy AlgoLiftUpdated 6 min read
On this page 7How it worksExample: buy the continuationSettingsOutputsUse something else whenWhen it doesn't behaveGoing further

Price-action traders describe a trend in swings: higher highs and higher lows on the way up, lower lows and lower highs on the way down. A trend carries on when price takes out the last swing in its own direction, and it's in trouble when price takes out the one behind it. The Market Structure node keeps that whole ledger in one place: the trend, the two levels that matter, and every break, labelled as a continuation or a reversal.

Takes
Nothing. It reads its series' candles
Gives
The trend, the structure high and low, and a flag on every break
Reach for it
Trading breaks of structure, or keeping entries on the trend's side

How it works

The node works in three layers, in this order, every time a bar closes.

The swings. It finds its own swing highs and lows with the same rule as Swing Points (Left Strength, Right Strength, Allow Equal Bars), so the two nodes always agree about what a swing is. It also inherits the lag: a swing is known only once its Right Strength bars have closed, so the structure levels update that many bars after the turn.

The trend. The trend is +1 once the last swing high is above the one before it and the last swing low is above the one before it. It takes both. A higher high on its own doesn't turn anything up. -1 is the mirror. When the two disagree, the trend keeps whatever it was, and before any pair has agreed it's 0.

The break. A bar that closes beyond the Structure High (the last confirmed swing high) breaks it, and the same goes for the Structure Low on the way down. Set A Break Is to the wick option and the bar's high or low reaching past the level is enough. What the break is called depends on the trend it happened in:

Price takes outWhile the trend isIt firesMeaning
The structure highUpBreak of Structure (Bull)The uptrend carried on
The structure highDownChange of Character (Bull)The first sign the downtrend is over. The trend turns up at this bar
The structure lowDownBreak of Structure (Bear)The downtrend carried on
The structure lowUpChange of Character (Bear)The first sign the uptrend is over. The trend turns down at this bar

Every level breaks once. After it's taken out, it can't fire again until a new swing confirms and replaces it. A break while the trend is still 0 fires nothing at all, though it still uses the level up.

Example: buy the continuation

You trade NQ 15m and want to buy when an uptrend takes out its last swing high, with the stop under the swing low the trend has to hold.

Add Market Structure with Left and Right Strength 5, and A Break Is set to a close beyond the level, so a wick poking through doesn't count. Wire Break of Structure (Bull) into a long Entry. The flag is true for the bar after the breaking bar closes, so the trade goes in on that bar.

For the stop, measure the Bracket Order's stop from a level: wire Structure Low into the stop's level input and set the distance to 4 points. When the break fires, Structure Low is the last confirmed swing low under it, which is exactly the level whose loss would turn the trend. The level is read once, when the trade fills, so later swings don't drag the stop around.

Settings

Left Strength
Default 5
Bars before a pivot that must stay under it (for a high) or over it (for a low).
Right Strength
Default 5
Bars after a pivot that must confirm it. The levels update this many bars late.
A Break Is
Default A close beyond the level
A close beyond the level, or a wick through it. Wicks call more breaks, and call some of them sooner.
Allow Equal Bars
Default Off
On, a shelf of equal highs or lows counts as a swing, and so as a structure level.

Outputs

Trend
Number
+1 up, -1 down, 0 before the first agreeing pair. Trend Greater Than 0 makes a clean uptrend filter.
Break of Structure (Bull / Bear)
True or false
True for one bar after a break in the trend's own direction.
Change of Character (Bull / Bear)
True or false
True for one bar after a break against the trend, which flips it.
Structure High / Low
Number
The last confirmed swing high and low: the levels a break has to take out. Empty before the first swing.
Last Break Level
Number
The level the most recent break took out, on either side. The line a retest comes back to.
Bars Since Break
Number
0 on the bar of the break, then counting up. Empty before the first break.

Use something else when

The swing levels themselves
The last and previous swings and the higher-high and lower-low flags, for when you need a level and don't care about breaks.
The candle a strong move left behind
An order block is a zone to come back to, not a level to break.
A plain N-bar breakout
A close above the highest high of the last 20 completed bars is a different rule, with no swing to wait for.

When it doesn't behave

The trend sits at 0 and nothing fires

The trend needs a higher high and a higher low (or the mirror) before it's anything but 0, and while it's 0, breaks fire nothing. At the start of the data, or in a choppy stretch where highs and lows disagree, that can take a while. Smaller strengths find swings sooner.

“Price above the Structure High” stays true long after the break

The level doesn't move when it's broken; it waits for the next swing high. Use the Break of Structure flag for the moment, or Bars Since Break to say how fresh the break must be.

My Swing Points version of a break disagrees with this node

A break built by hand from Swing Points, a Bars Ago and a few Comparisons is four nodes that can't agree which swing is current, and none of them knows whether the break went with the trend or against it, which is the whole difference between a continuation and a reversal. Use this node for breaks.

The builder won't let me wire Structure High into a Crossover

Market Structure keeps its own memory across the engine's monthly chunks of history, so a Crossover (or Since, Capture, a State Machine) can't read its history correctly, and the builder refuses rather than guess. Compare the level with a Comparison, which is exact on every bar, or trade the break flags.

Going further

Two of these nodes can disagree on purpose. Set one to break on a wick and the other on a close: when the wick version fires Break of Structure (Bull) and the close version doesn't, a wick took the level and the close couldn't hold it, which is what traders call a liquidity sweep. AND the first with a NOT of the second. The Patterns section of the node panel has it ready as Liquidity sweep, next to Break of structure and Change of character.

For a retest, Last Break Level is the line and Bars Since Break is the clock. Compare the last completed bar's low (a one-bar Price History) with Last Break Level, and AND in Bars Since Break under 10 so only fresh breaks count.

And be honest about the wick setting. Close and wick produce different sets of breaks, and so different strategies. Pick the one that matches your idea before you see results; trying both is an optimization like any other.

Or ask the copilot