Is there anyway of getting the same result without using MaxVal?

The reason I ask is I noticed that I need to make the period a huge value to store the maximum equity otherwise it can decrease in value.