@sfkiwi Thanks for making the basis of this.
Though this thread is old, hopefully this will help anyone getting results they are not expecting.
But I think at the end of your code it looks like you have k and d calc backwards to have it match tradingview.
self.l.D = D = self.p.movav(stoch, period=self.p.period_dfast)
self.l.K = self.p.movav(D, period=self.p.period_kslow)
self.l.K = K = self.p.movav(stoch, period=self.p.period_kslow)
self.l.D = self.p.movav(K, period=self.p.period_dfast)