how calculate the distance between the prise and the MA

how calculate the distance between the prise and the MA so I know the highest  distance so we can 
  1. distance = price[i] - MA[i]
  2. Remember the maximum.