I had the knock sensor code on my 92 yota and tried using an older pigtail and sensor (two) which did not work. I ordered a new pig tail and ran a new wire which also I'd not work. I ultimately ordered a new sensor and it was fixed.
For reference my new wire is not shielded and I also moved the sensor to the engine hook. Works mint. Just in case you decide I run a new wire.