%K = 100[(C - L10) / ( H10 - L10)] where C = last close, H10 is the highest high in 10 bars and L10 is the lowest low. %D is normally a three-period smoothed average of %K.
%D = 100 x (H3/L3) where H3 is the three-period sum of (C- L10) and L3 is the three-period sum of ( H10-L10)
Google for "Stochastic indicator" and you would have e.g. found:
%D = 3-period moving average of %K