Thanks for replying.
By making max lowercase it does indeed solve my problem. What I do not understand is that I was copying code from indicators.c and in the function called Moment it has the line below.
Period = Max(2,Period);
I actually copied that line over. So why is it upper case in indicators.c? Is this something to do with an include statement that is importing other functions?