From 64b98989d2be20fe0fc85dc52929f63e6b4f9fce Mon Sep 17 00:00:00 2001 From: Matthias Date: Tue, 15 Feb 2022 19:25:32 +0100 Subject: [PATCH] Update open candle ROI condition --- freqtrade/optimize/backtesting.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/freqtrade/optimize/backtesting.py b/freqtrade/optimize/backtesting.py index 3126e1943..b423771ca 100644 --- a/freqtrade/optimize/backtesting.py +++ b/freqtrade/optimize/backtesting.py @@ -359,12 +359,15 @@ class Backtesting: if ( 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 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 # trigger if the entry was at Open or lower. # 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.") # Use the maximum between close_rate and low as we # cannot sell outside of a candle.