Avoiding Momentum Crashes: Dynamic Momentum and Contrarian Trading