Purpose of the Stochastic Oscillator
The Stochastic Oscillator measures the momentum of price, showing the position of the closing price relative to the high-low range over a set period. It helps identify overbought/oversold conditions and potential trend reversals.
How It Works
When you select Stochastic Oscillator in the Trade Rule block, you can configure it as follows:
%K Line Period
The number of candles used to calculate the raw stochastic value.
Shorter periods = more sensitive to price changes.
%D Line Period
The moving average of the %K line, smoothing the signal.
Often used to identify crossovers for trading signals.
Slowing Value
Additional smoothing applied to the %K line before comparing to %D.
Helps reduce false signals in volatile markets.
Advanced Options
MA Method
Method used for smoothing (Simple, Exponential, Smoothed, Weighted).
Simple: Equal weight to all values.
Exponential: More weight on recent data.
Smoothed: Longer-term smoothing with reduced noise.
Weighted: Highest weight on the most recent data, decreasing linearly.
Price Field (Basis for the calculation)
Common options include Low/High, Close/Close, etc.
Determines which prices form the high-low range for %K calculation.
Mode
Main Line: The %K line value.
Signal Line: The %D line value (smoothed %K).
Time Frame
Choose the chart time frame for calculation.
Can be replaced with a variable or input for flexible testing.
Candle ID
0 β Current forming candle.
1 β Most recently closed candle.
Higher IDs = older candles.
Adjust
Apply modifications to the final value: add, subtract, multiply, or divide by a chosen number.
Example
If you set:
%K Period: 5
%D Period: 3
Slowing: 3
Mode: Main Line
Price Field: Low/High
Candle ID: 1
You get the stochastic %K value of the last closed candle, smoothed and calculated from the highest high and lowest low over the past 5 candles.
Use Cases
Identify overbought/oversold zones (commonly above 80 or below 20).
Trade crossovers between %K and %D lines.
Combine with trend filters to avoid false signals.
β Tip: Works best in ranging markets; combine with trend indicators to avoid whipsaws in strong trends.
