Persistence¶
Flow · State
True at bar i only if the input signal has been true for ALL of the last N bars. Filters out flickering signals — 'RSI > 70 for 3 consecutive bars' instead of any single bar's spike.
Persistence filters out flickering signals by demanding a condition hold for several bars in a row before it counts. Instead of "RSI is above 70 this bar" — which a single spike satisfies — it asks "RSI has been above 70 for the last 3 bars." That simple requirement strips out a huge amount of noise, turning twitchy, one-bar conditions into confirmed, sustained states worth acting on.
How it works¶
The block outputs true at a bar only if the input signal was true for all of the last Bars bars (default 3). A single false bar anywhere in the window resets the count — the streak has to be unbroken. So with Bars = 3, the output first turns true on the third consecutive true bar and stays true while the run continues. It's a confirmation filter: it trades immediacy for reliability.
When to use it¶
Use Persistence to confirm a condition is real, not a blip. It's ideal on noisy oscillator thresholds ("RSI > 70 for 3 bars" instead of a momentary poke), on regime flags you don't want flickering on and off, and anywhere a one-bar spike would otherwise trigger a trade you'd regret. The cost is lag — requiring N confirmations means you act N bars later — so size the window to balance noise reduction against responsiveness. It pairs naturally with an Edge Trigger downstream if you then want just the first confirmed bar.
Example¶
Confirmed overbought: feed an RSI > 70 condition (built with Greater Than) into Persistence with 3 bars, so the result is true only after RSI holds above 70 for three straight bars — filtering out single-bar spikes. Use it as a sustained-momentum condition and backtest in the Tester.
Tips & gotchas¶
- Demands an unbroken streak — one false bar resets the count.
- Trades immediacy for reliability — you confirm later but with fewer false signals.
- Tune the window — longer is cleaner but laggier; 2–3 bars often removes most of the flicker.
- Different from Hold — Persistence requires N consecutive trues to output true; Hold keeps a signal true for N bars after one fire.
Related blocks¶
Inputs¶
| Socket | Type | What to wire in |
|---|---|---|
| In | signal |
Signal to require sustained truth on. |
Outputs¶
| Output | Type | Plots as | Description |
|---|---|---|---|
| Sustained | signal |
Signal arrows | True iff input was true for the last N bars. |
Parameters¶
| Parameter | Type | Default | What it does |
|---|---|---|---|
| Bars | number · 1–500 | 3 |
How many consecutive trues are required. |
Reference auto-generated from the block catalog · category Flow.