From 2103367a1837298d3d4791c27408554d642ff2ac Mon Sep 17 00:00:00 2001 From: "Bobby (aider)" Date: Sat, 8 Feb 2025 07:55:21 -0800 Subject: [PATCH] fix: Define previous_price to resolve undefined name error in function --- src/screener/t_atr_ema.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/screener/t_atr_ema.py b/src/screener/t_atr_ema.py index 0be262c..aa418c0 100644 --- a/src/screener/t_atr_ema.py +++ b/src/screener/t_atr_ema.py @@ -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""" # Get latest values from DataFrame 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 # Check if price is below EMA and has started moving up