Trend consistency
Steadiness of recent direction, 0 (flips every bar) to 1 (never flips); on this chart it reads 1 because its input is price.
TrendConsistency takes a signed slope series and labels each bar up (above +0.0001), down (below -0.0001) or flat. Over the last window bars it counts how often that label changes, and the score is 1 minus changes divided by window minus 1. It is 1 when the direction never changes and 0 when it changes on every bar, and it ignores how large the slope is. The explainer chart feeds it the close price instead of a slope, so every bar reads up and the score stays at 1.
How to read it
- The line sits in its own pane below the price, between 0 and 1.
- On this chart it reads 1 on every bar after the blank start, because every close counts as up.
- Changing window does not move the line here, since no bar changes direction. Only the length of the blank start changes.
What it outputs
- Consistency
- Share of the window where the input kept its direction, from 0 (changed on every bar) to 1 (never changed). Blank for the first window minus 1 bars.
Settings
- window
- Number of recent bars compared. Each direction change lowers the score by 1/(window-1), so short windows jump in big steps and window 2 gives only 0 or 1. Raising it lengthens the blank start. On this chart the line stays at 1 at any setting.
Pitfalls
- The chart feeds it the close price, which always reads as up, so SPY one-minute bars give 1 on every bar (min, median and max all 1.0). The line carries no information here.
- The flat band of ±0.0001 is hard-coded, not a parameter. A slope on a much smaller or larger scale can make nearly every bar flat, or nearly every bar up or down, and the score then means little.
- The score ignores size: a tiny drift and a sharp rally both count as one up bar. It measures how often the direction flips, not how strong the trend is.