market_structure
forge.tafunctionSince Forge API 1
Signaturepython
forge.ta.market_structure(open_: ArrayLike,high: ArrayLike,low: ArrayLike,close: ArrayLike,swing_len: int = 5,internal_len: int = 2,internal: bool = True,swing: bool = True,confluence_filter: bool = False,break_on: str = 'close') -> dict[str, np.ndarray]Swings labelled HH, HL, LH and LL, with breaks of structure and changes of character.
Parameters
| Name | Type | Default |
|---|---|---|
| open_ | ArrayLike | |
| high | ArrayLike | |
| low | ArrayLike | |
| close | ArrayLike | |
| swing_len | int | 5 |
| internal_len | int | 2 |
| internal | bool | True |
| swing | bool | True |
| confluence_filter | bool | False |
| break_on | str | 'close' |
A swing high is a bar whose high is above the high of every bar within swing_len bars on
each side; a swing low mirrors it. It is known swing_len bars later, and every value is
written on that later bar. A break is the first bar that closes (break_on close) or
trades (wick) beyond the latest swing level; it is a change of character when the trend
was the other way and a break of structure otherwise. Internal structure uses internal_len.
With confluence_filter an internal break is marked only when its bar closes in the break's
direction and the level it breaks is not the swing level. The parameter is spelled open_
because open is a Python builtin.