diff --git a/src/screener/t_atr_ema.py b/src/screener/t_atr_ema.py index 25c0606..0be262c 100644 --- a/src/screener/t_atr_ema.py +++ b/src/screener/t_atr_ema.py @@ -11,6 +11,7 @@ def check_atr_ema_bullish_signal(df: pd.DataFrame) -> bool: """Check for bullish signal based on ATR EMA indicator""" # Get latest values from DataFrame last_price = df.iloc[-1] + previous_price = df.iloc[-2] # Get the previous row for comparison indicator = ThreeATREMAIndicator() results = indicator.calculate(df) indicator = ThreeATREMAIndicator() @@ -35,8 +36,8 @@ def check_atr_ema_buy_condition(df: pd.DataFrame) -> bool: return ( last_price['close'] < ema and - last_price['close'].shift(1) <= lower_band and - last_price['close'] > last_price['close'].shift(1) + previous_price['close'] <= lower_band and + last_price['close'] > previous_price['close'] ) def run_atr_ema_scanner(min_price: float, max_price: float, min_volume: int, portfolio_size: float = None) -> None: