The stochastic oscillator was developed in the late 1950s by George Lane. As designed by Lane, the stochastic oscillator presents the location of the closing price of a stock in relation to the high and low range of the price of a stock over a period of time, typically a 14-day period. Lane, over the course of numerous interviews, has said that the stochastic oscillator does not follow price or volume or anything similar. He indicates that the oscillator follows the speed or momentum of Price.
A stochastic oscillator is a momentum indicator comparing a particular closing price of a security to a range of its prices over a certain period of time. The sensitivity of the oscillator to market movements is reducible by adjusting that time period or by taking a moving average of the result. It is used to generate overbought and oversold trading signals, utilizing a 0–100 bounded range of values .
Stochastics have a different approach than RSI  and other indicators to calculate price swings. This indicator reports how far the current price is from the low of the last X periods. The line created in the stochastic representation (% K), is then used to create a moving average (% D), which is located on the same chart as the first line. The stochastic is charted like all oscillators, just below the price chart  (See Figure 1).
The Formula for the Stochastic Oscillator is:
Notably, %K is referred to sometimes as the fast stochastic indicator. The "slow" stochastic indicator is taken as %D = 3-period moving average of %K. The general theory serving as the foundation for this indicator is that in a market trending upward, prices will close near the high, and in a market trending downward, prices close near the low. Transaction signals are created when the %K crosses through a three-period moving average, which is called the %D .
The difference between the slow and fast Stochastic Oscillator is the Slow %K incorporates a %K slowing period of 3 that controls the internal smoothing of %K. Setting the smoothing period to 1 is equivalent to plotting the Fast Stochastic Oscillator.1 The use of slow stochastic has the advantage that it smoothes it out and that is, as the formula is constructed, the stochastic can offer a quite serrated appearance with somewhat unexpected sudden movements if something is smoothed with a small moving average .
Figure 2: Stochastic Oscillator Slow and Fast
Like all normalized oscillators, the stochastic is also interpreted taking into account its overbought and oversold levels in this case it is generally considered as overbought if the stochastic is above the 80 level and it is considered oversold if it is below the 20 level, it is important to consider these levels as approximate not as absolute if you remember the video of the oscillators that all suffer a displacement effect therefore the upward trends perhaps the level 80 as overbought is too low and it is convenient that it is higher perhaps the level 85 or even higher, the same happens with downtrends, the 20th may be too high a level so you should investigate and test different levels and not interpret them in isolation but in conjunction with the Price .
Like many oscillators and indicators, the generic parameter stochastic is 14 periods, as a general rule, it will be valid for any time period, but if the type of analysis performed on the charts requires analysis in several time periods, it is from the highest to the lowest, you may be interested in playing. Remember there is no better parameter than another, only one more adapted to your style of trading and how to interpret what is happening, test different parameters and if you have doubts, just stick with 14 .
The Stochastic measures the closing level of the last period compared to a previous period, generally the 14 periods 100% is the maximum of the previous period and 0% the minimum reminds that this oscillator is used looking for divergences, displacements, crossing of the line mean, etc .
It is important to indicate that the primary limitation of the stochastic oscillator is that it has been known to produce false signals. This is when a trading signal is generated by the indicator, yet the price does not actually follow through, which can end up as a losing trade. During volatile market conditions, this can happen quite regularly. One way to help with this is to take the price trend as a filter, where signals are only taken if they are in the same direction as the trend .