]> Piment Noir Git Repositories - freqai-strategies.git/commitdiff
fix(qav3): define trade max duration as # of candles
authorJérôme Benoit <jerome.benoit@piment-noir.org>
Wed, 5 Mar 2025 18:04:57 +0000 (19:04 +0100)
committerJérôme Benoit <jerome.benoit@piment-noir.org>
Wed, 5 Mar 2025 18:04:57 +0000 (19:04 +0100)
Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
quickadapter/user_data/strategies/QuickAdapterV3.py

index fcde1d018bfd0f5937838d76bb950299f8832a78..f7a172afb151ed4d9b907d879a87d940974c84ed 100644 (file)
@@ -5,6 +5,7 @@ import talib.abstract as ta
 from pandas import DataFrame, Series
 from technical import qtpylib
 from typing import Optional
+from freqtrade.exchange import timeframe_to_minutes
 from freqtrade.strategy.interface import IStrategy
 from technical.pivots_points import pivots_points
 from freqtrade.persistence import Trade
@@ -59,7 +60,10 @@ class QuickAdapterV3(IStrategy):
     max_entry_position_adjustment = 1
     max_dca_multiplier = 2
 
-    minimal_roi = {"0": 0.03, "1000": -1}
+    @property
+    def minimal_roi(self):
+        timeframe_minutes = timeframe_to_minutes(self.timeframe)
+        return {"0": 0.03, str(timeframe_minutes * 864): -1}
 
     process_only_new_candles = True
 
@@ -112,7 +116,10 @@ class QuickAdapterV3(IStrategy):
         ]
 
     use_exit_signal = True
-    startup_candle_count: int = 80
+
+    @property
+    def startup_candle_count(self):
+        return int(self.freqai_info.get("fit_live_predictions_candles", 100) / 2)
 
     def feature_engineering_expand_all(self, dataframe, period, **kwargs):
         dataframe["%-rsi-period"] = ta.RSI(dataframe, timeperiod=period)