Market structure
All indicators

LibraryMarket structure

Indicator

Market structure

The swing highs and lows, the trend they form and the bars where price breaks them: a break of structure (BoS) with the trend, a change of character (CHoCH) against it.

Market structureOn the price2 inputsBoS/CHoCH

How it is calculated

A swing high has a high above the length bars before it and not below the length bars after it; it is confirmed once those bars have closed. Lows mirror this. A close (or, with Break on wick, a high) above the last swing high breaks it, once. A break with the trend, or the first one, is a BoS (+1 up, -1 down); one against the trend is a CHoCH and turns the trend. One break per bar, the break up first.

Reference: ICT market structure, from public descriptions (#546)

How to read it

A swing shows length bars after its extreme, on the bar that confirms it, and never moves. trend is +1 after a break up, -1 after a break down and 0 before the first. bos and choch are +1 or -1 on the bar of the break and 0 otherwise; the level lines hold the price the last BoS and CHoCH broke.

In a strategy

Trade with the structure: buy when ctx.ind("structure", length=3, break_on="close").choch is 1, the trend has just turned up, with the stop below .swing_low, and add on each later .bos of 1.

Inputs

InputTypeDefaultRange or choices
Swing bars each sidelengthWhole number3min 1, max 50
Break onbreak_onChoice"close"Close, Wick

What it draws

LineDrawn as
Swing highSteps
Swing lowSteps
BoS levelSteps
CHoCH levelSteps

Used in

No strategy template reads it yet.

OrionQuant