Skip to content

Commit

Permalink
upd
Browse files Browse the repository at this point in the history
  • Loading branch information
m5l14i11 committed Sep 14, 2024
1 parent ad30391 commit 6e7c713
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions core/models/position_risk.py
Original file line number Diff line number Diff line change
Expand Up @@ -415,15 +415,15 @@ 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])
)

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])
)
Expand Down

0 comments on commit 6e7c713

Please sign in to comment.