Trouble with custom indicator Stochastic Momentum Index I need a FIX

 

I have been testing the Stochastic Momentim Index indicator dor some days and I have a problem. The indicator starts shifting to the left, not presenting the new values generating a black box on that side of the screen

How do I solve this?

Thanks in advance and best regards

STIG