{"slug":"bullish-candlestick-patterns","qid":"hammer_by_ticker","label":"hammer_by_ticker","post_title":"bullish-candlestick-patterns","post_url":"/blog/lang/pcm/bullish-candlestick-patterns#q-hammer_by_ticker","columns":["ticker","hammer_count","hammer_next_up_pct","any_day_up_pct"],"rows":[{"ticker":"KO","hammer_count":224,"hammer_next_up_pct":58.9,"any_day_up_pct":52.5},{"ticker":"AAPL","hammer_count":201,"hammer_next_up_pct":58.2,"any_day_up_pct":53.6},{"ticker":"WMT","hammer_count":193,"hammer_next_up_pct":57,"any_day_up_pct":53.5},{"ticker":"MSFT","hammer_count":233,"hammer_next_up_pct":56.7,"any_day_up_pct":53.7},{"ticker":"PG","hammer_count":188,"hammer_next_up_pct":56.4,"any_day_up_pct":52.7},{"ticker":"HD","hammer_count":210,"hammer_next_up_pct":53.8,"any_day_up_pct":52.5},{"ticker":"JNJ","hammer_count":216,"hammer_next_up_pct":53.2,"any_day_up_pct":51.8},{"ticker":"NVDA","hammer_count":214,"hammer_next_up_pct":51.4,"any_day_up_pct":54.6},{"ticker":"JPM","hammer_count":210,"hammer_next_up_pct":50.5,"any_day_up_pct":52.1},{"ticker":"XOM","hammer_count":213,"hammer_next_up_pct":49.3,"any_day_up_pct":50.9}],"shape":"ranking","sql":"SELECT\n    ticker,\n    countIf(is_hammer)                        AS hammer_count,\n    round(100 * avgIf(next_up, is_hammer), 1) AS hammer_next_up_pct,\n    round(100 * avg(next_up), 1)              AS any_day_up_pct\nFROM\n(\n    SELECT\n        ticker,\n        if(least(o, c) - l >= 2 * abs(c - o)\n           AND h - greatest(o, c) <= 0.25 * (h - l), 1, 0) AS is_hammer,\n        if(next_c > c, 1, 0)                              AS next_up\n    FROM\n    (\n        SELECT\n            ticker,\n            toFloat64(open)               AS o,\n            toFloat64(high)               AS h,\n            toFloat64(low)                AS l,\n            toFloat64(close)              AS c,\n            leadInFrame(toFloat64(close)) OVER fwd AS next_c\n        FROM global_markets.stocks_daily_aggs\n        WHERE ticker IN ('AAPL','MSFT','NVDA','JPM','JNJ','KO','PG','WMT','XOM','HD')\n          AND date >= '2016-01-01'\n          AND date <= '2025-12-31'\n        WINDOW\n            fwd AS (PARTITION BY ticker ORDER BY date\n                    ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING)\n    )\n    WHERE h > l AND next_c > 0\n)\nGROUP BY ticker\nHAVING countIf(is_hammer) >= 20\nORDER BY hammer_next_up_pct DESC","computed_at":"2026-09-25T15:12:04.913716+00:00","elapsed":0.004355505}