Skip to content

Commit 4c35308

Browse files
committed
Add strong bull and bear signals
1 parent e285d9f commit 4c35308

1 file changed

Lines changed: 22 additions & 10 deletions

File tree

pyindicators/indicators/momentum_confluence.py

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -492,18 +492,30 @@ def _generate_reversals(
492492
reversal_bearish[i] = 1
493493

494494
# Strong bullish reversal
495-
# Overflow + money flow not near threshold (weak selling)
496-
if overflow_bearish[i] == 1 or overflow_bearish[i - 1] == 1:
497-
if not np.isnan(lower_threshold[i]):
498-
if money_flow[i] > lower_threshold[i] * 0.5:
499-
reversal_strong_bullish[i] = 1
495+
# Conditions: overflow bearish OR very low trend wave + turning up
496+
is_overflow_bear = (overflow_bearish[i] == 1 or
497+
overflow_bearish[i - 1] == 1)
498+
is_extreme_low = trend_wave[i] < 20
499+
is_turning_up = (trend_wave[i] > trend_wave[i - 1] and
500+
trend_wave[i - 1] <= trend_wave[i - 2])
501+
502+
if is_overflow_bear and is_turning_up:
503+
reversal_strong_bullish[i] = 1
504+
elif is_extreme_low and is_turning_up and money_flow[i] < -30:
505+
reversal_strong_bullish[i] = 1
500506

501507
# Strong bearish reversal
502-
# Overflow + money flow not near threshold (weak buying)
503-
if overflow_bullish[i] == 1 or overflow_bullish[i - 1] == 1:
504-
if not np.isnan(upper_threshold[i]):
505-
if money_flow[i] < upper_threshold[i] * 0.5:
506-
reversal_strong_bearish[i] = 1
508+
# Conditions: overflow bullish OR very high trend wave + turning down
509+
is_overflow_bull = (overflow_bullish[i] == 1 or
510+
overflow_bullish[i - 1] == 1)
511+
is_extreme_high = trend_wave[i] > 80
512+
is_turning_down = (trend_wave[i] < trend_wave[i - 1] and
513+
trend_wave[i - 1] >= trend_wave[i - 2])
514+
515+
if is_overflow_bull and is_turning_down:
516+
reversal_strong_bearish[i] = 1
517+
elif is_extreme_high and is_turning_down and money_flow[i] > 30:
518+
reversal_strong_bearish[i] = 1
507519

508520
return (reversal_bullish, reversal_bearish,
509521
reversal_strong_bullish, reversal_strong_bearish)

0 commit comments

Comments
 (0)