Stochastic Oscillator
The Stochastic oscillator is a technical indicator that ranges from 0 to 100 and measures momentum and mean-revision. The indicator is built from two lines:

  • %K line - The stock's position compared to the lowest and highest value over the lookback period.
  • D line - A moving average of the %K line.
The indicator measures momentum, and when the indicator is above 80, it is considered overbought, and when it is below 20, it is considered oversold. Because momentum can persist, we have built breadth and cross events to help you better time your trades.

Why use it?

Stochastic is a popular indicator that is easy to use. When the indicator is in the oversold or overbought territory, it is usually extreme and can help time a trade. This will help increase the edge of the trade and increase profits/probability of profit.

How to use the Stochastic Oscillator in SamurAI

The Stochastic oscillator is a momentum indicator. When the indicator is in the extreme, it usually signals a mean revision trade. However, to benefit the most out of the indicator, we should use the cross filter and the breadth filter.
  1. Cross - We can use the cross filter to find trades that go into an extreme zone (thus continuing the trend short term) or crossing out of the extreme zone (thus signaling mean revision).
  2. Breadth - Stocks don't stay in extreme zones long; we can use the breadth filter to find stocks that are about to reverse (for example, in oversold territory for two weeks).


  1. Fast/Slow Stochastic: This is a calculation setting. Slow stochastic adds another average to smooth the indicator volatility.
  2. Length: in days. During the market hours, we will simulate the last price as the closing price for that day to show how the Stochastic changes during market hours. The most common settings are %K = 14, and %D = 3.
  3. From: and To: These are the filters to initiate the zone you want the indicator to be. The most common zones are: Overbought (From: 80) and Oversold (To: 20).
  4. Min Periods inside/outside range: How long the indicator was in or outside the zone before today.
    1. You can replace the 'inside' and 'outside' the range filters by clicking on the word.
    2. The number is in days - how many days you want the stock to be above or below.
      This is useful for:
      1. Cross: Set it as min periods outside to 1.
      2. Breadth: Set it as min period inside/outside for 5, for example (About one week).
      3. See more common use cases below.

Common use cases

  1. Stock is in overbought - (1) Length: 14,3(default) (2) From:80 (3) To: Empty (4) Mid Periods outside range: 0 (default)
  2. Stock is in oversold- (1) Length: 14,3(default) (2) From:Empty(3) To: 20 (4) Mid Periods outside range: 0 (default)
  3. Stock exited overbought - (1) Length: 14,3(default) (2) From:0 (3) To: 80 (4) Mid Periods outside range: 1
  4. Stock exited oversold- (1) Length: 14,3(default) (2) From:20 (3) To: 100 (4) Mid Periods outside range: 1
  5. Stock is overbought for a week - (1) Length: 14,3(default) (2) From:80(3) To: 100 (4) Mid Periods inside range: 5
  6. Stock is oversold for a month - 1) Length: 14,3(default) (2) From:0(3) To: 20 (4) Mid Periods inside range: 21


(coming soon)

Read more

About Technical analysis Engine - KB
About Bollinger Bands - KB
About RSI - KB
About MA indicator - KB
About MA Crossover indicator - KB
About MA Rank (unique) indicator - KB
About MACD indicator - KB
About Stochastic Oscillator - KB
Was this article helpful?