SequentialPatternTracker
How long the current run of up or down bars is, and how often such runs have kept going.
It counts how many consecutive bar closes have moved in the same direction, and whether that run is up or down. Each time a run ends, it records whether the next bar kept the same direction, so it learns the odds of continuation for every run length. A flat bar resets the run and counts as a run that did not continue.
How to read it
- Run length and direction sit in panes below the price. Run length is 0 on a flat bar, then counts 1, 2, 3 while the direction repeats.
- Direction is +1 for an up run, -1 for a down run and 0 on a flat bar.
- The odds pane shows the chance the next bar keeps the current direction. Under 0.5 means runs of that length usually break.
- Blank odds mean that run length has fewer past cases than min_samples. On SPY one-minute bars at default settings, 90% of the readings with odds sat between 0.39 and 0.48.
What it outputs
- Run length
- Bars in the current run of same-direction closes, capped at max_streak and 0 on a flat bar. At defaults 95% of bars read 4 or less, and the cap of 10 was reached.
- Run direction
- +1 for an up run, -1 for a down run, 0 on a flat bar. Both signs are common on SPY one-minute bars at defaults.
- Odds the run continues
- Learned chance the next bar keeps the current direction, for this run length. Blank on flat bars and until that length has min_samples past cases.
Settings
- max_streak
- Caps the run length and the odds table: every run at or beyond this length shares one bucket. Raising it lets the run length climb higher and learns odds for long runs separately. Lowering it pools long runs, so their odds fill in faster.
- min_samples
- How many past cases a run length needs before its odds appear. Raising it blanks more of the odds line and keeps only well-sampled lengths. Lowering it shows odds for rarely seen lengths, which are noisy.
- decay
- Forgetting rate for the counts, applied only when above zero. Each bar inside a run shrinks all counts by this share, so recent runs weigh more. At 0 all history counts equally. Negative values change nothing. Large values keep counts small and blank the odds.
Pitfalls
- A flat bar counts as a run that did not continue, so flat bars push the odds down. The default reading below 0.5 may partly come from this rather than a real tendency to reverse.
- Odds start empty on the first bars of the loaded data and only fill in as runs accumulate. Early readings rest on few cases.
- Any run longer than max_streak shows as max_streak, so at the default cap of 10 the run length pane cannot tell a run of 10 from one of 40.