Premium/discount
Whether price sits in the upper (premium) or lower (discount) half of the last swing.
From the last confirmed swing leg (the last pivot high H and pivot low L; swing params as swing): equilibrium = (H + L) ÷ 2; in_premium while equilibrium < close ≤ H, in_discount while L ≤ close < equilibrium; outside the leg both are 0.
Premium/discount 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. |
What it gives
| Output | What it is |
|---|---|
| Equilibrium | Middle of the last swing leg: (swing high + swing low) ÷ 2. |
| In premium | True while the close is in the upper half of the last swing leg. |
| In discount | True while the close is in the lower half of the last swing leg. |
What it reads
It reads the whole candle (open, high, low, close and volume).
Warm-up
With its default settings, Premium/discount needs 241 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 Premium/discount with its default settings