Hi Sebastian,
By the first look at the code, it seems correct. the starting point you talks about is way below 1 seems possible because of the filter window you are using, the rectangular filter window is not so perfect at the edges thus the behaviour you obtained. Try looking at other filter like hamming or binomial. I will suggest you to check out this link.
Although there are other functions you can use to smooth your signal like smooth function. these are not FIR filters but usually do a good job.
I hope I gave you enough information for you to get a good headstart.
cheers