This indicator counts how many bars in a row have closed higher than they opened (up streak) or lower than they opened (down streak). It resets to 1 every time the direction flips.
Logic
if close[t] > open[t] and close[t-1] > open[t-1]:
up_count[t] = up_count[t-1] + 1
elif close[t] > open[t]:
up_count[t] = 1
else:
up_count[t] = 0
(symmetric for down_count)Params
None.
Output
Two columns:
{name}_up_count- current up streak length{name}_down_count- current down streak length
Usage
- Exhaustion fade: a 5-bar up streak (
up_count >= 5) flags short-term overextension. - Trend continuation: many strategies require at least 3 consecutive bars in the trade direction as a confirmation.
Pitfalls
Streak length is a weak signal in isolation. Use it alongside other filters - a 5-bar streak in a tight range means very little.
