The smoothing is the strategy
The stochastic oscillator reports where the close sits inside a recent high-to-low range, on a 0–100 scale, as two lines:
- %K — the raw position, then smoothed
- %D — a moving average of %K
A crossover strategy trades %K crossing %D. Which means the signal you are trading is produced almost entirely by the smoothing values, not by the lookback length — and that is the opposite of where most people spend their tuning effort.
Why the lookback is the least important of the three
| Parameter | What changing it does |
|---|---|
| %K length (lookback) | changes where the extremes are, not how often the lines cross |
| %K smoothing | changes the crossover count directly |
| %D smoothing | changes the crossover count directly |
Two lines that are both lightly smoothed cross constantly, because they are nearly the same series. As you increase either smoothing value the lines separate and cross less.
So if you widened the lookback from 14 to 21 and your results barely moved, that is expected — you adjusted the parameter that does not control your trade count. The diagnostic is simple: change each of the three by a meaningful amount in turn and note the trade count each time. The one that moves it is the one that matters, and on a stochastic crossover it will be a smoothing value.
The pinning problem
Like RSI, the stochastic is bounded, so in a strong trend it reaches an extreme and stays there. But the crossover version has a worse version of this problem: while both lines sit near 80, they continue to cross each other repeatedly on noise.
So a strong uptrend produces a stream of crossover signals, all inside the same trend, none of them marking a turn. A strategy that shorts each bearish cross is short a trending market repeatedly.
The fix is the same as for RSI — a trend gate, and then a check that it is doing something: the count test in the next section.
Building it
| Field | Value | Note |
|---|---|---|
| %K length | 14 | affects the extremes, not the cross frequency |
| %K smoothing | 3 | this is your trade-count dial |
| %D smoothing | 3 | so is this |
| Entry | %K crosses above %D below 20 | the level condition filters the trend crosses |
| Exit | %K crosses below %D, or an ATR stop |
Restricting the cross to below 20 (or above 80 for shorts) is what stops the strategy taking every mid-trend cross. It is a cheap and effective filter, and it is worth confirming it removes trades rather than assuming it.
What to verify in the export
The two smoothing values must appear as separate movable inputs. If the export declares three inputs but the emitted condition contains hard-coded numbers, the controls are inert and you will spend an afternoon tuning nothing — which is exactly the defect the input test catches: reading the Strategy Tester.
Does your second condition do anything?
"Add a confirmation" is the most common advice in strategy building and the least often checked. A second condition can do exactly one of three things, and which one is measurable in two runs of the Strategy Tester.
The test
- Build the strategy with both conditions. Note the trade count — call it B.
- Remove the second condition. Note the trade count — call it A.
- Compare.
| Result | What it means | What to do |
|---|---|---|
| B = A | the second condition never excluded a single trade | delete it — it is decoration |
| B is slightly below A | it filters a minority of trades | keep it if the remaining trades are better |
| B is far below A | the two conditions rarely agree | you have two strategies fighting, not a confluence |
| B = 0 | they never agree | one of them is probably mis-specified |
The first row is far more common than people expect, and it has a specific cause: two conditions derived from the same series are the same condition. A MACD line crossing its signal and a MACD histogram turning positive are one event counted twice. A Bollinger middle band and a moving average of the same period are the same series.
Why "far below A" is not a success
It feels like rigour — only the very best setups get through — and it is usually a sample-size problem. Cutting your trade count from 300 to 20 does not give you a more selective strategy; it gives you a strategy you can no longer evaluate, because twenty trades cannot distinguish an edge from luck.
The evidence list in what to hold before risking money puts the threshold at about a hundred trades. A filter that takes you below that has cost you the ability to test, which is a worse trade than whatever it improved.
Building the stochastic and moving-average version
The honest confluence here is oscillator plus trend, because the two genuinely can disagree — one measures position within a recent range, the other measures direction over a longer window:
| Field | Value | Role |
|---|---|---|
| %K length / smoothing | 14 / 3 | the timing signal |
| %D smoothing | 3 | |
| Entry trigger | %K crosses above %D below 20 | |
| Trend filter | price above a 50-period MA | the second condition |
| Exit | %K crosses below %D, or an ATR stop |
Now run the count test on the trend filter specifically. On a trending instrument it should remove a meaningful minority of trades — the ones that were counter-trend oscillator signals, which is exactly the pinning failure the stochastic suffers from on its own.
One more thing worth counting
Each condition you add is a parameter set you chose, and choosing among alternatives biases the winner. So record how many confluence combinations you tried before settling on this one — the reasoning is in testing variations honestly, and it applies to structural choices just as much as to threshold values.

