Request to review the below model
enter image description here
the averages were assigned in as A1, A2, A3 already
I wish to find the closest value to 0 among the array of average values and return as A1, because -4 is the closest value in my model
I tried math.min (math.abs(a1-0), math.abs(a2-0), math.abs(a3-0)….
And it is returning as 4. I wish to have -4 and related assigned value as A1
Request to give a pine script code for the same.