Here is a version of a MTF Stochastic script I wrote a while ago. The code is based on a formula written by Peter_O and the built in Tradingview Stochastic indicator. See this link to the original script of Peter_O. I use this formula a lot if I want to build in a Stochastic trend filter in my strategies. In this version I added options to plot different signals and trends.