# Grokking Stochastic Oscillator for Stocks

In software, I'm trying to implement the Stochastic Oscillator (see here), and I'd like to figure out a few things.

Let's say I use standard inputs 14, 3 and 3. If my 14 is for intraday ticks, what is the period (%D Exponential Moving Average) that 3 represents? It doesn't seem to make sense, that the period should be days, if my 14 represents intraday ticks.

1. Does it instead mean 3 periods of 14 (3 * 14), in this case?

## 1 Answer

The period is the time between two ticks.

It means you have to work with the last 3 periods, each periods have a lenght of 1/14 of a day. So you are working with a time windows of 3/14 of a day.

• But let's say each tick happens every 2 seconds. If the %D period is the time between two ticks, then the 3 would represent all ticks that occurred within the last 6 (3 * 2 seconds) seconds. That i) obviously isn't enough time for smoothing, and ii) doesn't correspond to your 3/14 of a day. May 14, 2013 at 15:12
• Well I suposed that your ticks are well distributed over the day. If it's not the case you will have a problem with the moving average. Please add some details, at least on how you choose your ticks. it is unclear what 14 represents. May 14, 2013 at 15:25
• I dont think it matters, whether or not, ticks are evenly distributed over time. %K is the last tick's percentage move within the high / low range (over, say, 14 ticks - see here). %D is the 3-period exponential moving average of %K. I want to know what that period means. Is it the last 14 ticks, 3 times? Is it only the last 3 periods within the last 3 ticks (say, 6 secs)? Remember, %D is a smoothing factor, so I don't see that time period being long enough. And I dont think it matters how those ticks are distributed over time. May 14, 2013 at 15:39
• H and L are usually calculated over 14 periods, then K% is smoothed over 3 periods. Periods is the time between two ticks but it suppose some sort of periodicity. Another common use is to work with daily prices. The generalization over periods is hazardous as you will have more or less dayly price min/max than closing prices, you are loosing data synchronyzation. The generalization over intra day tickers is more hazardous as you have intraday effects. What will you use for closing price ? And yes, in general, the choice of thick is important to weight your moving average... May 14, 2013 at 16:18
• I'm using second and sub-second ticks. Ie, over the last 14 ticks, I would take the High and Low, and the last tick's closing trade. So what you're saying is that my 14 ticks, would have an exponential smoothing over the first 3 of those ticks. Seems like a short time for smoothing. But I can try it out. May 14, 2013 at 16:26