fix: Update entry_price access to method call in stop loss logic

This commit is contained in:
Bobby (aider) 2025-02-13 23:37:40 -08:00
parent 51be586696
commit 3249acd33c

View File

@ -98,7 +98,7 @@ class DynamicStrategy(Strategy):
# Check stop loss for existing position # Check stop loss for existing position
if self.position: if self.position:
# Calculate the percentage loss from entry # Calculate the percentage loss from entry
entry_price = self.position.entry_price entry_price = self.position.entry_price() # Changed from entry_price to entry_price()
current_loss = ((price - entry_price) / entry_price) * 100 current_loss = ((price - entry_price) / entry_price) * 100
# If loss exceeds 7%, close the position # If loss exceeds 7%, close the position