Stochastic oscillator formula
The formula for the stochastic oscillator is pretty simple:
%K = (Price at Current Close - Lowest Low Price in Period) / (Highest High Price in Period - Lowest Low Price in Period) * 100
%D = 3-day simple moving average of %K
The period of %K can literally be any time frame, but many investors use 14 days as a standard look-back period. As stated above, you can adjust the sensitivity of this indicator by changing this period, but it will also affect its sensitivity .
%K is the actual stochastic oscillator, %D is a signal or trigger line to help better visualize the changes as they're happening. They should be plotted together for best results, along with other indicators to help minimize false signals.