Indicator results different from EA than on chart

 
Hello

I am trying to understand why/how an indicator (DT-ZigZag-Lauer) returns different results from an EA than when it is attached to a chart. I have checked and re-checked the code (see attachment).

If anyone can help, of has an explanation, I would be very grateful!
Files:
Reason: