freqtrade
freqtrade copied to clipboard
Enable future positions to reverse their position
Summary
This PR enables switching from long to short positions.
The simplest example has "enter_short" and "exit_long" both set to 1 within a candle (while being in a long position) - which will close the long trade, and open a new short trade.
This will also work for all other exit reasons like (trailing) stoploss, roi, or custom-exits.
To prevent a subsequent (despite having a signal in the other direction) - best use the cooldown protection - which (with a setting of 1) can restore previous behavior.
Closes #9183
Quick changelog
- Enable long/short switch within one candle for backtesting
- Change auto-lock to be towards the trade-side only (allowing to enter a short trade after closing out a long trade and viceversa).
TODO:
- [ ] Update docs / enhance docs in this regards