Swing pivots
The last confirmed swing highs and lows, known only once price has turned away from them.
Causal swing pivots (Phase 3 K1). A high (low) is confirmed when a later close is reversal below (above) it, reversal = max(swing_min_pct % × close, swing_k × ATR before the candle), frozen when each leg starts. Pivots alternate high/low and appear on the confirming candle, never before. bars_since_* count from the pivot's own candle.
Swing pivots is a structure detector: it marks price structure on the chart and counts against the plan's detector limit.
Settings
| Setting | Default | Range | What it does |
|---|---|---|---|
| atr_period | 14 | 1 to 500 | ATR length (Wilder) for every buffer. |
| swing_k | 2 | 0.1 to 20 | Swing reversal in ATRs: a pivot is confirmed when a close moves this far back. |
| swing_min_pct | 0.1 | 0 to 10 | Smallest swing reversal, % of the close. |
| pivots | 10 | 2 to 50 | Confirmed pivots kept for the chart. |
What it gives
| Output | What it is |
|---|---|
| Last swing high | Price of the last confirmed swing high. |
| Last swing low | Price of the last confirmed swing low. |
| Previous swing high | The swing high before the last one. |
| Previous swing low | The swing low before the last one. |
| Swing high confirmed | True on the candle a swing high is confirmed. |
| Swing low confirmed | True on the candle a swing low is confirmed. |
| Candles since the swing high | Candles since the last swing high's own candle. |
| Candles since the swing low | Candles since the last swing low's own candle. |
What it reads
It reads the whole candle (open, high, low, close and volume).
Warm-up
With its default settings, Swing pivots needs 341 closed candles before its first value. A backtest loads them before its start date, so the first trade can already use it.
Test it
Copy this sentence into the Algonney chat to backtest it:
Backtest a strategy on BTC that uses Swing pivots with its default settings