From 0aa71620553a8e72162939a2ccd7dc8eefe11fec Mon Sep 17 00:00:00 2001 From: robcaulk Date: Sun, 29 May 2022 16:36:46 +0200 Subject: [PATCH] ensure the prediction is reset in the pair_dict after any trade exit, not just custom_exit --- freqtrade/templates/FreqaiExampleStrategy.py | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/freqtrade/templates/FreqaiExampleStrategy.py b/freqtrade/templates/FreqaiExampleStrategy.py index 13df1f846..ecda10919 100644 --- a/freqtrade/templates/FreqaiExampleStrategy.py +++ b/freqtrade/templates/FreqaiExampleStrategy.py @@ -269,8 +269,17 @@ class FreqaiExampleStrategy(IStrategy): else: roi_decay += self.linear_roi_offset.value - if current_profit > roi_price: # roi_decay: - with self.model.bridge.lock: - self.model.bridge.data_drawer.pair_dict[pair]['prediction' + entry_tag] = 0 - self.model.bridge.data_drawer.save_drawer_to_disk() + if current_profit > roi_price: return 'roi_custom_win' + + def confirm_trade_exit(self, pair: str, trade: Trade, order_type: str, amount: float, + rate: float, time_in_force: str, exit_reason: str, + current_time, **kwargs) -> bool: + + entry_tag = trade.enter_tag + + with self.model.bridge.lock: + self.model.bridge.data_drawer.pair_dict[pair]['prediction' + entry_tag] = 0 + self.model.bridge.data_drawer.save_drawer_to_disk() + + return True