Stochastic Oscillator: Formula, Settings & Trading Strategy

Stochastic indicator

The Stochastic Oscillator, or the KDJ indicator, is a momentum indicator widely used in technical analysis. Similar to the RSI, it evaluates overbought/oversold conditions and, like the MACD, identifies entry signals through crossovers and divergences. This versatility makes it a popular tool among traders.

Stochastic Oscillator Explanation

The Stochastic Oscillator is also known as the KDJ indicator due to its three lines: the K line, D line, and J line. However, some charting software programs omit the J line, displaying only the K and D lines, as seen in the chart example below.

Stochastic Chart

It assesses market direction and strength by comparing the current price with its range over a specific past period. The stochastic oscillator is widely used in financial trading, including stocks, futures, and forex, to determine if the market is overbought or oversold.

Furthermore, it identifies trading opportunities through strategies such as crossovers and divergences, which we will explore in more detail later in this article.

Stochastic Oscillator Formula

The stochastic indicator formula is somewhat complex and involves calculating four values: the RSV, fast stochastic, slow stochastic, and J line. We will explain each of these formulas.

1). RSV Calculation

The RSV (Random Stochastic Value) is the base component of the KDJ indicator. It is calculated as follows:

RSV = [(Close – x Low) ÷ (x High – x Low)] × 100

“x” represents the calculation period, “Close” is the most recent closing price, and “x Low” and “x High” are the lowest and highest prices over the last “x” period. For example, with a 5-day period on a daily chart, RSV = [(day close – 5 days lowest) ÷ (5 days Highest – 5 days Lowest)] × 100.

The RSV measures the current closing price’s position within the price range over a period, serving as the foundation for calculating the fast stochastic, which helps assess momentum and potential trading signals.

2). Fast Stochastic (K Line)

The value of the fast stochastic line (K line) is a weighted average of RSV values: the current candlestick’s RSV has a weight of 1/3, and the previous RSV, which includes past values, has a weight of 2/3. 

Fast Stochastic Formula = (2/3 x Previous RSV) + (1/3 x Current RSV)

The value of the fast stochastic ranges from 0 to 100, with its reading representing the market trend as follows:

  • A higher fast stochastic value indicates a stronger market trend;
  • A lower fast stochastic value means a weaker market trend.
Essentially, the fast stochastic is a smoothed version of the RSV. This means it responds more slowly to the latest market changes but better reflects the long-term trend. However, in some charting tools like TradingView, the default fast stochastic is set to the RSV value itself, without any weighted averaging.

3). Slow Stochastic (D Line)

The slow stochastic (D Line) is calculated as a weighted average of the fast stochastic. The closer the fast stochastic value is to the current candlestick, the higher its weight in the slow stochastic calculation.

Slow Stochastic Formula = (2/3 × Previous K Values) + (1/3 × Curent K Value)

The slow stochastic functions as the signal line for the fast stochastic. Their relationship can be understood similarly to that between fast and slow moving averages. When the slow stochastic moves below the fast stochastic, it indicates that the market is currently rising.

4). J Line Value

The calculation for the J Line, J = 3K – 2D, measures the difference between the fast and slow stochastics. To provide a clearer understanding, we can rewrite the formula as K + 2(K – D). Here’s an explanation of each side of the formula:

2(K – D)

Since the D value is a weighted average of the K value, their difference is usually insignificant. The formula multiplies this difference by 2 to make the change more noticeable.

K

Even with twice the difference between the K and D lines, the readings are still insignificant. Therefore, a K value is added to ensure it is noticeable on the Stochastic indicator window.

Many charting software’s stochastic indicators exclude the J line because the difference between the K and D lines is easily observed directly on the KDJ indicator chart through their relative positions.

Stochastic Indicator Settings

From the Stochastic indicator formula, we can know that the settings of the KDJ indicator involve three parameters, as shown below:

  • RSV setting: the period used in RSI calculation.
  • Fast stochastic setting: The denominator used in fast stochastic calculation.
  • Slow stochastic setting: The denominator used in slow stochastic calculation.
The name of the stochastic parameters and their default settings may vary depending on the charting software. We’ll use two of the most popular charting software platforms in online trading, TradingView & MT5, to explain these stochastic parameters in detail.

1). TradingView Stochastic Settings

TradingView Stochastic Setting

In TradingView’s stochastic indicator setting window, the parameters represent the following meanings:

  • %K Length: RSV calculation period
  • %K Smoothing: Fast stochastic period
  • %D Smoothing: Slow stochastic period

The default setting for the fast stochastic in TradingView is 1, meaning that the fast stochastic is calculated without averaging the RSV values; instead, it uses the RSV value directly.

2). MT5 Stochastic Settings

 MT5 Stochastic Setting

The parameters in MT5’s stochastic setting window represent the following meanings:

  • %K Period: RSV calculation period
  • Slowing: Fast stochastic period
  • %D Period: Slow stochastic period

3. Best Stochastic Settings

As the default setting in many charting platforms including MT4 and MT5, the stochastic setting (14,3,3) is generally considered the best for swing trading. For day trading, some traders prefer using (5,3,3).

Stochastic 14 3 3

The (14,3,3) setting is optimal for swing trading, particularly on daily and 4-hour charts. Its longer calculation period reduces false signals, making it ideal for swing traders.

Stochastic 5 3 3

(5,3,3) is typically used by day traders, especially on the 5-minute or 15-minute chart. The shorter 5-period calculation may generate more signals, beneficial for day trading,.

The RSV parameter determines the period of the stochastic indicator’s calculation, while the fast and slow stochastic settings affect its responsiveness to price fluctuations. Lower values in fast and slow stochastics prioritize recent prices, making the indicator more sensitive to market changes.

Choosing lower parameters can result in more frequent and earlier trading signals. However, this increased responsiveness also raises the risk of false signals. Therefore, traders should select settings based on their individual needs and trading strategies.

Stochastic Oscillator Strategy

There are many stochastic oscillator strategies. We’ll explore two simple ones using overbought and oversold signals. First, let’s understand interpreting these readings from the stochastic indicator:

Stochastic Value > 80

This suggests the market is overbought, indicating a potential price pullback. A Stochastic value returning below 80 from this area signals a sell opportunity.

Stochastic Value < 20

This indiates the market is oversold, suggesting a potential rebound. A buying signal is sent when the stoch value returning above 20 from oversold.

1). Stochastic Strategy - Swing Trading

In the daily chart of the S&P 500 Index below, the red vertical line marks a trading signal based on Stochastic overbought/oversold conditions. When Stochastic enters and subsequently retreats from overbought or oversold levels, price movements often accompany a rebound or pullback, providing entry signals.

Stochastic Strategy - Swing Trading Example

2). Stochastic Strategy - Day Trading

In the USDJPY 15-minute chart below, the overbought/oversold strategy using Stochastic settings (5,3,3) generated multiple intraday trading entries marked by the verticle lines. The blue line represents the 50-MA, acting as a support line in this uptrend. The Stochastic oversold confirmed buying signals at the MA line.

Stochastic Strategy - Day Trading Example

Stochastic Crossover Strategy

Traders can identify potential buy and sell signals based on the crossover of the fast and slow stochastics. This strategy functions similarly to the MA crossover strategy.

Stochastic Bullish Crossover

It happens when the fast line crosses above the slow line from below, signaling a buying opportunity. This indicates the current price is above the past average price, suggesting bullish market momentum.

Stochastic Bearish Crossover

It occurs when the fast line crosses below the D line from above, signaling a sell. This positioning indicates that the current price is below the past average price, suggesting bearish momentum in the market.

While the theory behind is straightforward, relying solely on this strategy for trading can often lead to frequent stop-losses. Because the KDJ is a momentum indicator, it’s crucial to complement crossover strategies with the prevailing trend direction. Here are summarized tips for effectively using Stochastic crossovers:

  • In an uptrend, seek buying opportunities during pullbacks with bullish crossovers at low stochastic levels.
  • In a downtrend, consider selling during rebounds with bearish crossover happens at high stochastic levels.

Below is an example of this stochastic trading strategy in an uptrend on a USDJPY daily chart, where all three bullish crossovers at low stochastic levels proved to be effective signals.