FractalDetector
Marks confirmed swing highs and lows, a few candles after each peak or trough forms.
A swing high is a candle whose high is strictly above the highs of the lookback candles on each side of it; a swing low is the mirror test on lows. At the default lookback of 2 that is a five-candle window. The test needs the candles after the peak, so the indicator fires on the candle that completes the pattern, lookback candles late, and its marks never move once drawn.
How to read it
- Each marker sits on the candle that confirms the swing: two candles after the peak or trough at default settings, not on the peak itself.
- The swing high and swing low price outputs hold the peak or trough price, so use the level they name and the marker for timing.
- At default settings about one candle in nine is a swing high and one in nine a swing low, so markers come often.
What it outputs
- Swing bar, high flag
- Fires on every swing bar, high or low. Reads 1 when the bar is a swing high (also on bars that are both) and 0 when it is only a swing low.
- Swing bar, low flag
- Fires on the same bars as the high flag, so the two overlap. Reads -1 when the bar is a swing low (also on bars that are both) and 0 when it is only a swing high.
- Swing high price
- Fires only on swing-high bars and holds that bar's high, the peak, which sits lookback candles before the marker.
- Swing low price
- Fires only on swing-low bars and holds that bar's low, the trough, which sits lookback candles before the marker.
When it fires
Fires on the candle that completes a swing, lookback candles after the peak or trough. A swing high needs its high above every high on both sides within the window; a swing low, the mirror test on lows. Flags 1 and 2 fire together on the same candles.
Settings
- lookback
- How many candles on each side a swing must beat. Raising it keeps only larger swings and delays each marker by that many candles; lowering it to 1 marks every small three-candle turn and reacts fastest, with more noise.
Pitfalls
- Equal highs or lows never count: the swing must beat every other bar in its window strictly, and prices tie often on a one-cent grid, so flat stretches show fewer markers.
- A swing is a structural point, not a call. It marks a turn that has already printed, and in a strong trend new swing highs keep forming on the way up.
- The marker is late by lookback candles, so any decision made on it reacts that much after the actual peak or trough.