Rolling Count True¶
Flow · Counter
How many of the last N bars the input was true. Pair with a threshold for 'N-of-M' confluence ('≥3 of the last 5 bars confirmed'). NaN during the first N-1 warmup bars.
Rolling Count True counts how many of the last N bars a signal was true. It turns an on/off condition into a running tally of recent occurrences — the raw material for "how often has this fired lately" logic and windowed confluence.
How it works¶
Each bar it looks back over the trailing window and counts the bars where the input signal was true, outputting that count (0 up to window). As the window slides, old bars drop out of the tally. The first window − 1 bars are NaN while the window fills. Lookahead-free.
When to use it¶
Use it for windowed confirmation and frequency filters: "at least 3 of the last 5 bars confirmed" (threshold the count with GreaterEqual), "this condition has fired too often — stand down," or measuring how persistent a state has been. It's the counting counterpart to N-of-M, but across time on one signal rather than across several signals on one bar.
Example¶
Persistence gate: wire a "close above VWAP" signal into Rolling Count True (window = 5), require the count ≥ 4 with GreaterEqual, and And that with your entry — so you only act when price has held above VWAP for most of the recent window.
Tips & gotchas¶
- Outputs a count (series), not a signal — threshold it to get a boolean.
- Counts across time on one signal — for a vote across many signals on one bar, use N-of-M.
- First
window − 1bars are NaN.
Related blocks¶
Inputs¶
| Socket | Type | What to wire in |
|---|---|---|
| In | signal |
Boolean condition to count. |
Outputs¶
| Output | Type | Plots as | Description |
|---|---|---|---|
| count | series |
Line · sub-pane | Count of true bars in the trailing window. |
Parameters¶
| Parameter | Type | Default | What it does |
|---|---|---|---|
| Window (bars) | number · 2–500 | 14 |
Bars in the rolling window. |
Reference auto-generated from the block catalog · category Flow.