Stoch kd cross up event
Marks each bar where the fast stochastic line (%K) crosses up through its smoothed line (%D).
%K is where the close sits inside the high-low range of the last k_window bars, on a 0 to 1 scale. %D is the average of the last d_window %K values. The signal is True only on the bar where %K moves from at or below %D to above it. Unlike the classic 20/80 stochastic, it has no overbought or oversold filter, so every crossover counts wherever the lines sit.
How to read it
- Markers sit on the candles where the cross happens, one candle per cross. The %K and %D lines themselves are not drawn.
- The signal does not check where the lines are. Crosses near 0, the bottom of the range, are the ones traders usually read as bullish, so check the level yourself.
- On the September 2026 SPY sample it fired about 188 times a day, roughly every five minutes. Read single markers against the trend, not alone.
What it outputs
- K crosses above D
- True on the one bar where %K rises above %D, after being at or below it on the bar before. Drawn as a marker on that candle.
When it fires
Fires on the bar where %K moves from at or below %D to above it. It means the fast line has just overtaken its smoothed line, a short-term shift in momentum within the recent range. On the September 2026 SPY sample it was True on about one bar in five (3,957 of 20,160 bars).
Settings
- k_window
- Bars in the high-low range that %K is measured against. Shorter makes %K swing between the range ends faster, which usually means more crosses. Longer makes %K slower and steadier, so crosses are fewer and later. At 1, the range is the current bar alone.
- d_window
- Bars averaged to form %D, the smoothed line. Longer makes %D slower, so crosses come less often and trail the turns. At 1, %D equals %K, so a cross can never fire and the chart stays empty.
Pitfalls
- No overbought or oversold filter: a cross at 0.9 counts the same as one at 0.1, so many crosses happen in sideways chop.
- With defaults it fires about every five minutes on SPY one-minute bars, so most markers are noise. Pair it with a trend filter before acting on one.
- d_window 1 is in the allowed range but disables the signal entirely, since %D then equals %K and a strict cross cannot happen.