refactor: update entry conditions in ATR EMA scanners for better precision

This commit is contained in:
Bobby (aider) 2025-02-08 21:59:06 -08:00
parent 1b852b2d8d
commit a9d380897a
2 changed files with 18 additions and 8 deletions

View File

@ -38,11 +38,16 @@ def check_entry_signal(df: pd.DataFrame) -> list:
lower_band = results['lower_band'].iloc[i] lower_band = results['lower_band'].iloc[i]
prev_lower_band = results['lower_band'].iloc[i-1] prev_lower_band = results['lower_band'].iloc[i-1]
# Entry conditions # Entry conditions:
# 1. Previous close was below the lower band
# 2. Current close is at or above the lower band
# 3. Price is moving up (current close > previous close)
# 4. Price is still below EMA (maintaining downtrend context)
entry_signal = ( entry_signal = (
current['close'] < ema and previous['close'] < prev_lower_band and
previous['close'] <= prev_lower_band and current['close'] >= lower_band and
current['close'] > previous['close'] current['close'] > previous['close'] and
current['close'] < ema
) )
if entry_signal: if entry_signal:

View File

@ -38,11 +38,16 @@ def check_entry_signal(df: pd.DataFrame) -> list:
lower_band = results['lower_band'].iloc[i] lower_band = results['lower_band'].iloc[i]
prev_lower_band = results['lower_band'].iloc[i-1] prev_lower_band = results['lower_band'].iloc[i-1]
# Entry conditions from Pine script: # Entry conditions:
# 1. Previous close was below the lower band
# 2. Current close is at or above the lower band
# 3. Price is moving up (current close > previous close)
# 4. Price is still below EMA (maintaining downtrend context)
entry_signal = ( entry_signal = (
current['close'] < ema and previous['close'] < prev_lower_band and
previous['close'] <= prev_lower_band and current['close'] >= lower_band and
current['close'] > previous['close'] current['close'] > previous['close'] and
current['close'] < ema
) )
if entry_signal: if entry_signal: