reverseLong(1) was the same as MaxLong = 1; enterlong();.

It just limits the number of open trades and updates currently open trades.