Assuming MA is a series, you can't use MA[1] within a function that takes a series as an imput. By using MA[1] you're sending a float to it.
The correct syntax is if(MA[0]>MaxVal(MA,9)). This way, you compare float (MA[0]) with another float resulting from evaluation of MaxVal(MA,9).