Need code for stochastic momentum indicator

Say I want stochastic momentum indicator to be trending down from oversold area …i want it to cut down to the 0 level . How do I code for the 0 level cut?

Any help will be appreciated