Patterns Signals

40 signals in this category. See the full Signal Catalog for the cross-category index, or the Signals Overview for an introduction. Click a signal to expand parameters and examples.
Check if a bearish engulfing pattern completed on the current bar. Current bearish candle’s body completely contains the previous bullish candle’s body. Strong bearish reversal. References: [NISON], [KB-07], [STOCKCHARTS].No configurable parameters.Example
from mangrove_kb import RuleRegistry

rule = {
    "name": "bearish_engulfing_trigger",
    "parameters": {}
}
result = RuleRegistry.evaluate(rule, df)
print(result)  # True or False
Check if a bearish harami pattern completed on the current bar. Current small bearish candle’s body is inside the previous large bullish candle’s body. Potential bearish reversal. References: [NISON], [STOCKCHARTS].No configurable parameters.Example
from mangrove_kb import RuleRegistry

rule = {
    "name": "bearish_harami_trigger",
    "parameters": {}
}
result = RuleRegistry.evaluate(rule, df)
print(result)  # True or False
Check if any bearish candlestick pattern was detected within recent window. Scans for hanging man, shooting star, bearish engulfing, bearish harami, dark cloud cover, evening star, gravestone doji, three black crows, three inside down, tweezer tops, and bearish pin bar within the recent window.Parameters
NameTypeRangeDefaultDescription
windowint1 — 205Number of recent bars to check
Example
from mangrove_kb import RuleRegistry

rule = {
    "name": "bearish_pattern_recent",
    "parameters": {
        "window": 5
    }
}
result = RuleRegistry.evaluate(rule, df)
print(result)  # True or False
Check if a bearish pin bar is detected on the current bar. Long upper wick with body in the lower portion of the range. Bearish reversal at resistance. References: [KB-07], [TSR], [PRICEACTION].Parameters
NameTypeRangeDefaultDescription
wick_ratiofloat1.5 — 5.02.0Minimum dominant wick to body ratio
body_positionfloat0.1 — 0.50.33Maximum body distance from end as fraction of range
Example
from mangrove_kb import RuleRegistry

rule = {
    "name": "bearish_pin_bar_trigger",
    "parameters": {
        "wick_ratio": 2.0,
        "body_position": 0.33
    }
}
result = RuleRegistry.evaluate(rule, df)
print(result)  # True or False
Check if a bullish engulfing pattern completed on the current bar. Current bullish candle’s body completely contains the previous bearish candle’s body. Strong bullish reversal. References: [NISON], [KB-07], [STOCKCHARTS].No configurable parameters.Example
from mangrove_kb import RuleRegistry

rule = {
    "name": "bullish_engulfing_trigger",
    "parameters": {}
}
result = RuleRegistry.evaluate(rule, df)
print(result)  # True or False
Check if a bullish harami pattern completed on the current bar. Current small bullish candle’s body is inside the previous large bearish candle’s body. Potential bullish reversal. References: [NISON], [STOCKCHARTS].No configurable parameters.Example
from mangrove_kb import RuleRegistry

rule = {
    "name": "bullish_harami_trigger",
    "parameters": {}
}
result = RuleRegistry.evaluate(rule, df)
print(result)  # True or False
Check if any bullish candlestick pattern was detected within recent window. Scans for hammer, inverted hammer, bullish engulfing, bullish harami, piercing line, morning star, dragonfly doji, three white soldiers, three inside up, tweezer bottoms, and bullish pin bar within the recent window.Parameters
NameTypeRangeDefaultDescription
windowint1 — 205Number of recent bars to check
Example
from mangrove_kb import RuleRegistry

rule = {
    "name": "bullish_pattern_recent",
    "parameters": {
        "window": 5
    }
}
result = RuleRegistry.evaluate(rule, df)
print(result)  # True or False
Check if a bullish pin bar is detected on the current bar. Long lower wick with body in the upper portion of the range. Bullish reversal at support. References: [KB-07], [TSR], [PRICEACTION].Parameters
NameTypeRangeDefaultDescription
wick_ratiofloat1.5 — 5.02.0Minimum dominant wick to body ratio
body_positionfloat0.1 — 0.50.33Maximum body distance from end as fraction of range
Example
from mangrove_kb import RuleRegistry

rule = {
    "name": "bullish_pin_bar_trigger",
    "parameters": {
        "wick_ratio": 2.0,
        "body_position": 0.33
    }
}
result = RuleRegistry.evaluate(rule, df)
print(result)  # True or False
Check if a bearish continuation pattern was detected within recent window. Scans for three black crows and three inside down.Parameters
NameTypeRangeDefaultDescription
windowint1 — 205Number of recent bars to check
Example
from mangrove_kb import RuleRegistry

rule = {
    "name": "continuation_pattern_bearish",
    "parameters": {
        "window": 5
    }
}
result = RuleRegistry.evaluate(rule, df)
print(result)  # True or False
Check if a bullish continuation pattern was detected within recent window. Scans for three white soldiers and three inside up.Parameters
NameTypeRangeDefaultDescription
windowint1 — 205Number of recent bars to check
Example
from mangrove_kb import RuleRegistry

rule = {
    "name": "continuation_pattern_bullish",
    "parameters": {
        "window": 5
    }
}
result = RuleRegistry.evaluate(rule, df)
print(result)  # True or False
Check if a dark cloud cover pattern completed on the current bar. Bearish reversal: bullish candle followed by bearish candle opening above prior high (classic) or prior close (relaxed) and closing below midpoint of prior body. The classic definition requires a price gap, which is rare in 24/7 crypto/forex markets. Set require_gap=False for those markets. References: [NISON], [KB-07].Parameters
NameTypeRangeDefaultDescription
min_penetrationfloat0.3 — 0.80.5Minimum penetration into previous body
require_gapbool-TrueIf True, requires open above previous high (classic Nison). If False, requires open above previous close (relaxed for 24/7 markets)
Example
from mangrove_kb import RuleRegistry

rule = {
    "name": "dark_cloud_cover_trigger",
    "parameters": {
        "min_penetration": 0.5,
        "require_gap": true
    }
}
result = RuleRegistry.evaluate(rule, df)
print(result)  # True or False
Check if a doji pattern is detected on the current bar. A doji forms when open and close are nearly equal relative to the candle’s range, signaling indecision. References: [NISON], [KB-07], [CM45T3R].Parameters
NameTypeRangeDefaultDescription
body_thresholdfloat0.01 — 0.30.1Maximum body-to-range ratio
Example
from mangrove_kb import RuleRegistry

rule = {
    "name": "doji_trigger",
    "parameters": {
        "body_threshold": 0.1
    }
}
result = RuleRegistry.evaluate(rule, df)
print(result)  # True or False
Check if a dragonfly doji is detected on the current bar. A doji with open/close near the high and a long lower shadow. Bullish signal at support. References: [NISON], [STOCKCHARTS], [TRENDSPIDER].Parameters
NameTypeRangeDefaultDescription
body_thresholdfloat0.01 — 0.30.1Maximum body-to-range ratio
upper_wick_maxfloat0.01 — 0.20.1Maximum upper wick-to-range ratio
Example
from mangrove_kb import RuleRegistry

rule = {
    "name": "dragonfly_doji_trigger",
    "parameters": {
        "body_threshold": 0.1,
        "upper_wick_max": 0.1
    }
}
result = RuleRegistry.evaluate(rule, df)
print(result)  # True or False
Check if an evening star pattern completed on the current bar. Three-candle bearish reversal: bullish candle, small-bodied star, then bearish candle closing below midpoint of first. References: [NISON], [KB-07].Parameters
NameTypeRangeDefaultDescription
body_thresholdfloat0.1 — 0.50.3Maximum body-to-range ratio for middle candle
Example
from mangrove_kb import RuleRegistry

rule = {
    "name": "evening_star_trigger",
    "parameters": {
        "body_threshold": 0.3
    }
}
result = RuleRegistry.evaluate(rule, df)
print(result)  # True or False
Check if a gravestone doji is detected on the current bar. A doji with open/close near the low and a long upper shadow. Bearish signal at resistance. References: [NISON], [STOCKCHARTS], [TRENDSPIDER].Parameters
NameTypeRangeDefaultDescription
body_thresholdfloat0.01 — 0.30.1Maximum body-to-range ratio
lower_wick_maxfloat0.01 — 0.20.1Maximum lower wick-to-range ratio
Example
from mangrove_kb import RuleRegistry

rule = {
    "name": "gravestone_doji_trigger",
    "parameters": {
        "body_threshold": 0.1,
        "lower_wick_max": 0.1
    }
}
result = RuleRegistry.evaluate(rule, df)
print(result)  # True or False
Check if a hammer shape is detected on the current bar. Small body at upper end with long lower wick and minimal upper wick. Bullish reversal after downtrend. References: [NISON], [KB-07], [CM45T3R].Parameters
NameTypeRangeDefaultDescription
wick_ratiofloat1.5 — 5.02.0Minimum lower wick to body ratio
upper_wick_maxfloat0.01 — 0.50.1Maximum upper wick to body ratio
Example
from mangrove_kb import RuleRegistry

rule = {
    "name": "hammer_trigger",
    "parameters": {
        "wick_ratio": 2.0,
        "upper_wick_max": 0.1
    }
}
result = RuleRegistry.evaluate(rule, df)
print(result)  # True or False
Check if a hanging man shape is detected on the current bar. Same shape as hammer (small body, long lower wick) but interpreted as a bearish reversal when appearing after an uptrend. References: [NISON], [STOCKCHARTS].Parameters
NameTypeRangeDefaultDescription
wick_ratiofloat1.5 — 5.02.0Minimum lower wick to body ratio
upper_wick_maxfloat0.01 — 0.50.1Maximum upper wick to body ratio
Example
from mangrove_kb import RuleRegistry

rule = {
    "name": "hanging_man_trigger",
    "parameters": {
        "wick_ratio": 2.0,
        "upper_wick_max": 0.1
    }
}
result = RuleRegistry.evaluate(rule, df)
print(result)  # True or False
Check if an indecision pattern was detected within recent window. Scans for doji, spinning top, inside bar, and NR7.Parameters
NameTypeRangeDefaultDescription
windowint1 — 205Number of recent bars to check
Example
from mangrove_kb import RuleRegistry

rule = {
    "name": "indecision_pattern_recent",
    "parameters": {
        "window": 5
    }
}
result = RuleRegistry.evaluate(rule, df)
print(result)  # True or False
Check if an inside bar is detected on the current bar. Current bar’s range is completely contained within the previous bar’s range. Signals consolidation and potential breakout. References: [KB-07], [TSR].No configurable parameters.Example
from mangrove_kb import RuleRegistry

rule = {
    "name": "inside_bar_trigger",
    "parameters": {}
}
result = RuleRegistry.evaluate(rule, df)
print(result)  # True or False
Check if an inverted hammer shape is detected on the current bar. Same shape as shooting star (small body, long upper wick) but interpreted as a bullish reversal when appearing after a downtrend. References: [NISON], [STOCKCHARTS].Parameters
NameTypeRangeDefaultDescription
wick_ratiofloat1.5 — 5.02.0Minimum upper wick to body ratio
lower_wick_maxfloat0.01 — 0.50.1Maximum lower wick to body ratio
Example
from mangrove_kb import RuleRegistry

rule = {
    "name": "inverted_hammer_trigger",
    "parameters": {
        "wick_ratio": 2.0,
        "lower_wick_max": 0.1
    }
}
result = RuleRegistry.evaluate(rule, df)
print(result)  # True or False
Check if a long-legged doji is detected on the current bar. A doji with both upper and lower wicks at least wick_threshold of the total range, indicating extreme indecision. References: [NISON], [STOCKCHARTS].Parameters
NameTypeRangeDefaultDescription
body_thresholdfloat0.01 — 0.30.1Maximum body-to-range ratio
wick_thresholdfloat0.1 — 0.50.25Minimum wick-to-range ratio for both wicks
Example
from mangrove_kb import RuleRegistry

rule = {
    "name": "long_legged_doji_trigger",
    "parameters": {
        "body_threshold": 0.1,
        "wick_threshold": 0.25
    }
}
result = RuleRegistry.evaluate(rule, df)
print(result)  # True or False
Check if a bearish marubozu is detected on the current bar. Full-bodied bearish candle with minimal or no wicks. Signals strong selling conviction. References: [NISON], [KB-07], [CM45T3R].Parameters
NameTypeRangeDefaultDescription
wick_tolerancefloat0.0 — 0.10.05Maximum wick-to-range ratio
Example
from mangrove_kb import RuleRegistry

rule = {
    "name": "marubozu_bearish_trigger",
    "parameters": {
        "wick_tolerance": 0.05
    }
}
result = RuleRegistry.evaluate(rule, df)
print(result)  # True or False
Check if a bullish marubozu is detected on the current bar. Full-bodied bullish candle with minimal or no wicks. Signals strong buying conviction. References: [NISON], [KB-07], [CM45T3R].Parameters
NameTypeRangeDefaultDescription
wick_tolerancefloat0.0 — 0.10.05Maximum wick-to-range ratio
Example
from mangrove_kb import RuleRegistry

rule = {
    "name": "marubozu_bullish_trigger",
    "parameters": {
        "wick_tolerance": 0.05
    }
}
result = RuleRegistry.evaluate(rule, df)
print(result)  # True or False
Check if a morning star pattern completed on the current bar. Three-candle bullish reversal: bearish candle, small-bodied star, then bullish candle closing above midpoint of first. References: [NISON], [KB-07].Parameters
NameTypeRangeDefaultDescription
body_thresholdfloat0.1 — 0.50.3Maximum body-to-range ratio for middle candle
Example
from mangrove_kb import RuleRegistry

rule = {
    "name": "morning_star_trigger",
    "parameters": {
        "body_threshold": 0.3
    }
}
result = RuleRegistry.evaluate(rule, df)
print(result)  # True or False
Check if a narrow range day is detected on the current bar. Current bar has the smallest range within the window period. Signals volatility compression and imminent breakout. Default window=7 for NR7; use 4 for NR4. References: [CRABEL], [KB-07], [BULKOWSKI].Parameters
NameTypeRangeDefaultDescription
windowint4 — 207Number of bars to compare range against
Example
from mangrove_kb import RuleRegistry

rule = {
    "name": "nr7_trigger",
    "parameters": {
        "window": 7
    }
}
result = RuleRegistry.evaluate(rule, df)
print(result)  # True or False
Check if an outside bar is detected on the current bar. Current bar’s range completely engulfs the previous bar’s range. Signals increased volatility. References: [KB-07], [TSR].No configurable parameters.Example
from mangrove_kb import RuleRegistry

rule = {
    "name": "outside_bar_trigger",
    "parameters": {}
}
result = RuleRegistry.evaluate(rule, df)
print(result)  # True or False
Check if a piercing line pattern completed on the current bar. Bullish reversal: bearish candle followed by bullish candle opening below prior low (classic) or prior close (relaxed) and closing above midpoint of prior body. The classic definition requires a price gap, which is rare in 24/7 crypto/forex markets. Set require_gap=False for those markets. References: [NISON], [KB-07].Parameters
NameTypeRangeDefaultDescription
min_penetrationfloat0.3 — 0.80.5Minimum penetration into previous body
require_gapbool-TrueIf True, requires open below previous low (classic Nison). If False, requires open below previous close (relaxed for 24/7 markets)
Example
from mangrove_kb import RuleRegistry

rule = {
    "name": "piercing_line_trigger",
    "parameters": {
        "min_penetration": 0.5,
        "require_gap": true
    }
}
result = RuleRegistry.evaluate(rule, df)
print(result)  # True or False
Check if a bearish reversal pattern was detected within recent window. Scans for hanging man, shooting star, bearish engulfing, evening star, dark cloud cover, and gravestone doji — the classic bearish reversal patterns.Parameters
NameTypeRangeDefaultDescription
windowint1 — 205Number of recent bars to check
Example
from mangrove_kb import RuleRegistry

rule = {
    "name": "reversal_pattern_bearish",
    "parameters": {
        "window": 5
    }
}
result = RuleRegistry.evaluate(rule, df)
print(result)  # True or False
Check if a bullish reversal pattern was detected within recent window. Scans for hammer, inverted hammer, bullish engulfing, morning star, piercing line, and dragonfly doji — the classic bullish reversal patterns.Parameters
NameTypeRangeDefaultDescription
windowint1 — 205Number of recent bars to check
Example
from mangrove_kb import RuleRegistry

rule = {
    "name": "reversal_pattern_bullish",
    "parameters": {
        "window": 5
    }
}
result = RuleRegistry.evaluate(rule, df)
print(result)  # True or False
Check if a shooting star shape is detected on the current bar. Small body at lower end with long upper wick and minimal lower wick. Bearish reversal after uptrend. References: [NISON], [STOCKCHARTS].Parameters
NameTypeRangeDefaultDescription
wick_ratiofloat1.5 — 5.02.0Minimum upper wick to body ratio
lower_wick_maxfloat0.01 — 0.50.1Maximum lower wick to body ratio
Example
from mangrove_kb import RuleRegistry

rule = {
    "name": "shooting_star_trigger",
    "parameters": {
        "wick_ratio": 2.0,
        "lower_wick_max": 0.1
    }
}
result = RuleRegistry.evaluate(rule, df)
print(result)  # True or False
Check if a spinning top is detected on the current bar. Small body with significant wicks on both sides, signaling indecision. References: [NISON], [CM45T3R], [STOCKCHARTS].Parameters
NameTypeRangeDefaultDescription
body_maxfloat0.1 — 0.50.3Maximum body-to-range ratio
wick_minfloat0.1 — 0.50.2Minimum wick-to-range ratio for both wicks
Example
from mangrove_kb import RuleRegistry

rule = {
    "name": "spinning_top_trigger",
    "parameters": {
        "body_max": 0.3,
        "wick_min": 0.2
    }
}
result = RuleRegistry.evaluate(rule, df)
print(result)  # True or False
Check if a marubozu (strong body) was detected within recent window. Scans for both bullish and bearish marubozu patterns.Parameters
NameTypeRangeDefaultDescription
windowint1 — 205Number of recent bars to check
Example
from mangrove_kb import RuleRegistry

rule = {
    "name": "strong_body_recent",
    "parameters": {
        "window": 5
    }
}
result = RuleRegistry.evaluate(rule, df)
print(result)  # True or False
Check if three black crows pattern completed on the current bar. Three consecutive bearish candles with lower closes, each opening within the previous body. Strong bearish signal. References: [NISON], [KB-07], [STOCKCHARTS].Parameters
NameTypeRangeDefaultDescription
min_body_ratiofloat0.3 — 0.80.5Minimum body-to-range ratio per candle
Example
from mangrove_kb import RuleRegistry

rule = {
    "name": "three_black_crows_trigger",
    "parameters": {
        "min_body_ratio": 0.5
    }
}
result = RuleRegistry.evaluate(rule, df)
print(result)  # True or False
Check if three inside down pattern completed on the current bar. Bullish candle, bearish harami, then bearish close below first candle’s open. Confirmed bearish reversal. References: [NISON], [KB-07], [TRENDSPIDER].No configurable parameters.Example
from mangrove_kb import RuleRegistry

rule = {
    "name": "three_inside_down_trigger",
    "parameters": {}
}
result = RuleRegistry.evaluate(rule, df)
print(result)  # True or False
Check if three inside up pattern completed on the current bar. Bearish candle, bullish harami, then bullish close above first candle’s open. Confirmed bullish reversal. References: [NISON], [KB-07], [TRENDSPIDER].No configurable parameters.Example
from mangrove_kb import RuleRegistry

rule = {
    "name": "three_inside_up_trigger",
    "parameters": {}
}
result = RuleRegistry.evaluate(rule, df)
print(result)  # True or False
Check if three white soldiers pattern completed on the current bar. Three consecutive bullish candles with higher closes, each opening within the previous body. Strong bullish signal. References: [NISON], [KB-07], [STOCKCHARTS].Parameters
NameTypeRangeDefaultDescription
min_body_ratiofloat0.3 — 0.80.5Minimum body-to-range ratio per candle
Example
from mangrove_kb import RuleRegistry

rule = {
    "name": "three_white_soldiers_trigger",
    "parameters": {
        "min_body_ratio": 0.5
    }
}
result = RuleRegistry.evaluate(rule, df)
print(result)  # True or False
Check if a tweezer bottoms pattern completed on the current bar. Two consecutive candles with approximately equal lows, first bearish and second bullish. Bullish reversal. References: [NISON], [CM45T3R].Parameters
NameTypeRangeDefaultDescription
tolerancefloat0.001 — 0.050.01Maximum low-to-low difference as fraction of average range
Example
from mangrove_kb import RuleRegistry

rule = {
    "name": "tweezer_bottoms_trigger",
    "parameters": {
        "tolerance": 0.01
    }
}
result = RuleRegistry.evaluate(rule, df)
print(result)  # True or False
Check if a tweezer tops pattern completed on the current bar. Two consecutive candles with approximately equal highs, first bullish and second bearish. Bearish reversal. References: [NISON], [CM45T3R].Parameters
NameTypeRangeDefaultDescription
tolerancefloat0.001 — 0.050.01Maximum high-to-high difference as fraction of average range
Example
from mangrove_kb import RuleRegistry

rule = {
    "name": "tweezer_tops_trigger",
    "parameters": {
        "tolerance": 0.01
    }
}
result = RuleRegistry.evaluate(rule, df)
print(result)  # True or False
Check if a bearish two-bar reversal completed on the current bar. Bullish bar followed by bearish bar that takes out the high then closes below the prior open. The close_proximity parameter controls how close the close must be to the high/low extreme. References: [KB-07], [TSR], [DAILYFOREX].Parameters
NameTypeRangeDefaultDescription
close_proximityfloat0.1 — 0.50.25How close the close must be to the extreme, as a fraction of range. Lower is stricter
Example
from mangrove_kb import RuleRegistry

rule = {
    "name": "two_bar_reversal_bearish_trigger",
    "parameters": {
        "close_proximity": 0.25
    }
}
result = RuleRegistry.evaluate(rule, df)
print(result)  # True or False
Check if a bullish two-bar reversal completed on the current bar. Bearish bar followed by bullish bar that takes out the low then closes above the prior open. The close_proximity parameter controls how close the close must be to the high/low extreme. References: [KB-07], [TSR], [DAILYFOREX].Parameters
NameTypeRangeDefaultDescription
close_proximityfloat0.1 — 0.50.25How close the close must be to the extreme, as a fraction of range. Lower is stricter
Example
from mangrove_kb import RuleRegistry

rule = {
    "name": "two_bar_reversal_bullish_trigger",
    "parameters": {
        "close_proximity": 0.25
    }
}
result = RuleRegistry.evaluate(rule, df)
print(result)  # True or False