order_blocks

forge.tafunctionSince Forge API 1
Signaturepython
forge.ta.order_blocks(open_: ArrayLike,high: ArrayLike,low: ArrayLike,close: ArrayLike,swing_len: int = 5,internal_len: int = 2,internal: bool = True,swing: bool = True,show_last: int = 5,mitigation: str = 'wick',break_on: str = 'close') -> dict[str, np.ndarray | Zone]

The last opposite candle before each break of structure, kept until price goes through it.

Parameters

NameTypeDefault
open_ArrayLike
highArrayLike
lowArrayLike
closeArrayLike
swing_lenint5
internal_lenint2
internalboolTrue
swingboolTrue
show_lastint5
mitigationstr'wick'
break_onstr'close'

Indicator: Order blocks

Breaks are found as in market structure, for the swing and the internal level. For an upward break the block is the last down candle at or before the lowest low between the broken swing and the break bar; its box spans that candle's high and low. A downward break mirrors it. mitigation says whether a wick or only a close through the far edge removes a block, and bull_mitigated and bear_mitigated mark the bar. Each level keeps its five newest live blocks per side as slots, newest first, and show_last of them are shown.