You script just plots the prices from the history. It looks as if the strange values are somewhere in your t1 file.

You can get normal t1 files from the Zorro download page. Check them with your script, then compare them with your t1 file. Possibly some values or dates are wrong. If you can't find the reason, you can contact Support and send them your files.