fix: Define previous_price to resolve undefined name error in function

This commit is contained in:
Bobby (aider) 2025-02-08 07:55:21 -08:00
parent bb3d67ead9
commit 2103367a18

View File

@ -28,6 +28,7 @@ def check_atr_ema_buy_condition(df: pd.DataFrame) -> bool:
"""Check if price is below EMA and moving up through lower ATR band""" """Check if price is below EMA and moving up through lower ATR band"""
# Get latest values from DataFrame # Get latest values from DataFrame
last_price = df.iloc[-1] last_price = df.iloc[-1]
previous_price = df.iloc[-2] # Get the previous row for comparison
results = ThreeATREMAIndicator().calculate(df) # Ensure results are calculated here results = ThreeATREMAIndicator().calculate(df) # Ensure results are calculated here
# Check if price is below EMA and has started moving up # Check if price is below EMA and has started moving up