First of all, this strat behaves similarly in MT5 vs SQX backtest from 2003-2017 right up until 2018 begins at which point the performance drastically deviates. I have zoomed in on the first trade of 2018 and you can see MT5 takes a short trade while SQX takes a long trade. You can see in the equity chart I've highlighted where the deviation begins.
Second of all, the SQX strategy behaves very differently depending on the start date but I can see no reason for this in the pseudo code plus other non KAMA strats created from this template behave just fine so I assume it's a KAMA problem.
Most likely these two issues are related but who knows