Nothing in the function appears to modify
unrealizedPnL
. So to start the loop it must already be < -100 and will remain so. The loop cannot exit since the value it is checking is static.