From 5ccd80eda6155d1a9a2b55772718a7dbc0ee8e83 Mon Sep 17 00:00:00 2001 From: richardjozsa Date: Sat, 27 Aug 2022 00:49:48 +0200 Subject: [PATCH] Conception problem with the unrealized profit I think here is a conception problem with the total profit, if we *= it with the last PnL it means we assume that the last profit effects on this one. In real life it depends on the user eg stake amount can be unlimited. However the agent will learn better and more if we just add it with +=. --- freqtrade/freqai/RL/Base4ActionRLEnv.py | 3 ++- freqtrade/freqai/RL/Base5ActionRLEnv.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/freqtrade/freqai/RL/Base4ActionRLEnv.py b/freqtrade/freqai/RL/Base4ActionRLEnv.py index 478507639..ce94ff542 100644 --- a/freqtrade/freqai/RL/Base4ActionRLEnv.py +++ b/freqtrade/freqai/RL/Base4ActionRLEnv.py @@ -292,7 +292,8 @@ class Base4ActionRLEnv(gym.Env): pnl = self.get_unrealized_profit() if self._position in (Positions.Long, Positions.Short): - self._total_profit *= (1 + pnl) + #self._total_profit *= (1 + pnl) + self._total_profit += pnl self._profits.append((self._current_tick, self._total_profit)) self.close_trade_profit.append(pnl) diff --git a/freqtrade/freqai/RL/Base5ActionRLEnv.py b/freqtrade/freqai/RL/Base5ActionRLEnv.py index b93d6e6ff..0441a10b9 100644 --- a/freqtrade/freqai/RL/Base5ActionRLEnv.py +++ b/freqtrade/freqai/RL/Base5ActionRLEnv.py @@ -295,7 +295,8 @@ class Base5ActionRLEnv(gym.Env): pnl = self.get_unrealized_profit() if self._position in (Positions.Long, Positions.Short): - self._total_profit *= (1 + pnl) + #self._total_profit *= (1 + pnl) + self._total_profit += pnl self._profits.append((self._current_tick, self._total_profit)) self.close_trade_profit.append(pnl)