Hello.
How your encoder gets power supply, from X173:26,27 or from external power supply.
Often laying the bonding cable (min 10 mm2 copper) in parallel with the encoder cable may help to avoid potential differences and thus enhance the pulse signals.