Update open candle ROI condition
This commit is contained in:
parent
30f6dbfc40
commit
64b98989d2
@ -359,12 +359,15 @@ class Backtesting:
|
|||||||
|
|
||||||
if (
|
if (
|
||||||
trade_dur == 0
|
trade_dur == 0
|
||||||
and trade.open_rate < sell_row[OPEN_IDX] # trade-open > open_rate
|
# Red candle (for longs), TODO: green candle (for shorts)
|
||||||
and sell_row[OPEN_IDX] > sell_row[CLOSE_IDX] # Red candle
|
and sell_row[OPEN_IDX] > sell_row[CLOSE_IDX] # Red candle
|
||||||
|
and trade.open_rate < sell_row[OPEN_IDX] # trade-open below open_rate
|
||||||
|
and close_rate > sell_row[CLOSE_IDX]
|
||||||
):
|
):
|
||||||
# ROI on opening candles with custom pricing can only
|
# ROI on opening candles with custom pricing can only
|
||||||
# trigger if the entry was at Open or lower.
|
# trigger if the entry was at Open or lower.
|
||||||
# details: https: // github.com/freqtrade/freqtrade/issues/6261
|
# details: https: // github.com/freqtrade/freqtrade/issues/6261
|
||||||
|
# If open_rate is < open, only allow sells below the close on red candles.
|
||||||
raise ValueError("Opening candle ROI on red candles.")
|
raise ValueError("Opening candle ROI on red candles.")
|
||||||
# Use the maximum between close_rate and low as we
|
# Use the maximum between close_rate and low as we
|
||||||
# cannot sell outside of a candle.
|
# cannot sell outside of a candle.
|
||||||
|
Loading…
Reference in New Issue
Block a user