You need a vars (a pointer to an array of values), but Equity is a var (just one value).

So you need to feed the MaxVal function a vars of Equity, using series(), so that MaxVal can read an array of values.