It means that the shift is negative. It must be >= 0, so remove that minus sign before dist.

Also, your code above will never trade because you compare with ==. Two vars are almost never exactly identical, so you must use >= or <= for comparing vars. Only ints can be compared with ==.