structure tracks alternating swing highs and lows across both internal and external scales, marks causal Break of Structure (BOS) and Change of Character (CHoCH) events, and plots the active dealing range equilibrium (EQ).
Parameters
| Parameter | Default | Range | Type | Timeframe overrides |
|---|---|---|---|---|
window |
500 |
60..2000 |
integer | — |
pivotSpan |
3 |
2..10 |
integer | 4 on <= 5m, 2 on >= 1d |
maxLabels |
8 |
0..30 |
integer | — |
maxEvents |
3 |
0..10 |
integer | — |
Algorithm & Nuances
- Dual-scale swings:
- Internal structure:
fractalPivotsatpivotSpan. - External structure:
fractalPivotsatmajorSpan = min(10, max(pivotSpan * 2, 5)). - Both pass through
alternate(), keeping the more extreme pivot on consecutive same-side swings (earlier on tie) and tagging each pointH,L,HH,LH,EH,HL,LL, orEL.
- Internal structure:
- Causal
BOS/CHoCH(breakScan):- A fractal swing at index
idxbecomes active only oncek >= idx + span(after right-side confirmation bars close), preventing lookahead breaks. - A candle closing above the active unbroken swing high triggers an upward break (
dir = +1); a close below the active unbroken swing low triggers a downward break (dir = -1). - Breaks opposing the prevailing direction label
CHoCH(Change of Character); breaks continuing the direction labelBOS(Break of Structure). Each event recordsdisplacementAtrand break candlebodyRatio.
- A fractal swing at index
- Trend & dealing range:
facts.trendreflects external direction (falling back to internal if external is'none');facts.internalTrendexposes internal direction separately.- Dealing range: Derived from the latest confirmed external swing high and swing low (falling back to internal if fewer than
2external swings exist).equilibrium = (high + low) / 2;zoneis'premium'(pct > 0.55),'discount'(pct < 0.45), or'equilibrium'.
Drawings & Facts
- Drawings:
- Up to
maxLabelsmarklabels on recent internal swings (HH/HL'up',LH/LL'down',H/L/EH/EL'neutral'). - Up to
maxEventshorizontaltrendlinesegments fromswingTimetobreakTime(solid forBOS, dashed forCHoCH). 1neutrallevelline at dealing-rangeEQ(EQ (premium|discount|equilibrium)).
- Up to
- Facts (
StructureFacts):trend,internalTrend,swings[],events[], anddealingRange.
Activation
- Studies menu:
Market structure: swings, BOS, CHoCH(Structure) - Slash command:
/structure - Chat phrases:
structure,ms,bos,choch,swings,hh,hl,lh,ll