How to Set Stochastic Alerts: %K, %D and Thresholds
Configure Stochastic threshold and line-cross alerts, distinguish event frequency from intrabar changes, and check the oscillator settings.
Setup Steps
Identify %K and %D
Add the Stochastic oscillator, not Stochastic RSI. Record %K lookback, its smoothing and %D length. The usual 14/3/3 setting describes three separate parameters. The oscillator compares the close with a recent high-low range; %D smooths %K.
Set a threshold event
Open Create Alert and select the %K plot, then a crossing direction and level. A cross above 20 leaves a low zone; a cross below 80 leaves a high zone. Those events differ from simply being below 20 or above 80.
Compare the plots for a line crossover
Inspect whether the dialog offers %K and %D as the two plot operands. If so, use their directional crossing comparison. A missing dedicated preset does not by itself require custom code. A specific combined rule, such as a cross while both lines are below 20, must explicitly include that extra condition.
Save the alert context
Choose the frequency, expiry and notification method in your account. For a rule defined on completed candles, select Once Per Bar Close where available. Record the symbol, timeframe and inputs. Recreate the alert after changing the script or its inputs; the running alert retains its saved configuration.
Verify delivery on new market data
Treat chart inspection and delivery as separate checks. Bar Replay can help inspect historical plots, but server alerts continue using live data. Check a new event against the alert log, then check the chosen notification channel. This is a test procedure, not a claim that delivery or investment performance has been tested here.
Alert Conditions Reference
Conditions to define and verify for the selected indicator.
| Condition | Signal | Notes |
|---|---|---|
| %K crosses above 20 | Recovery from the chosen low zone | The broader price trend may remain down. |
| %K crosses below 80 | Exit from the chosen high zone | This does not prove a price reversal. |
| %K crosses above %D | The faster oscillator changes relative ordering | Can happen repeatedly in choppy conditions. |
| %K crosses below %D | Opposite oscillator ordering change | Add any zone restriction explicitly; it is not implicit in a crossover. |
Parameters to record and evaluate
Examples describe the configuration, not validated trading settings.
| Parameter | Starting value or requirement | Description |
|---|---|---|
| %K lookback | 14, starting convention | Sets the high-low window used by the oscillator. |
| %K smoothing | 3, starting convention | Smooths the raw range-position value; 1 disables this extra smoothing. |
| %D length | 3, starting convention | Sets the average of %K used as the signal line. |
| Reference levels | 20 / 80, examples | A strong trend can keep readings near an extreme; the levels are not reversal guarantees. |
FAQ
Alert Setup FAQ
Do all %K/%D alerts require Pine code?
Can Once Per Bar fire repeatedly within the same bar?
Can Stochastic remain overbought during a rally?
Do rolling highest/lowest calculations cause future leakage?
How should divergence be evaluated?
Official documentation
Need a custom alert rule?
Describe the condition in Pineify’s coding agent, then review the generated Pine Script and test its timing and delivery in TradingView.
Explore Pine Script coding