From 6e7c713d18d1936cddc4c4524669b5db77280ccc Mon Sep 17 00:00:00 2001 From: m5l14i11 Date: Sun, 15 Sep 2024 00:42:09 +0300 Subject: [PATCH] upd --- core/models/position_risk.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/models/position_risk.py b/core/models/position_risk.py index f14d520b..9d846e4a 100644 --- a/core/models/position_risk.py +++ b/core/models/position_risk.py @@ -415,7 +415,7 @@ def sl_ats(self, side: PositionSide, ta: TechAnalysis, sl: float) -> "float": ) if side == PositionSide.LONG: - l_constr = low_smooth[-1] + l_constr = min(low_smooth[-1], low_smooth[-2]) adjusted_sl = ( min(l_constr, np.max(ats)) if bullish else min(l_constr, ats[-1]) ) @@ -423,7 +423,7 @@ def sl_ats(self, side: PositionSide, ta: TechAnalysis, sl: float) -> "float": return max(sl, adjusted_sl) if side == PositionSide.SHORT: - h_constr = high_smooth[-1] + h_constr = max(high_smooth[-1], high_smooth[-2]) adjusted_sl = ( max(h_constr, np.min(ats)) if bearish else max(h_constr, ats[-1]) )