Hammer Pattern Tested on A-Shares — Full Breakdown & Transcript

用Python量化100个K线形态(2):反转形态锤子线【量化投资邢不行啊】

0h 02m video Published Oct 12, 2022 Transcribed Sep 12, 2026 量化投资邢不行啊 量化投资邢不行啊
992 views Recent velocity 0.0 views/hour View full performance history →
Beginner 2 min read For: Traders and investors interested in technical analysis, especially those using candlestick patterns in A-shares.
AI Trust Score 65/100
⚠️ Average / Some Fluff

"Title promises a scientific test of a popular pattern, and the video delivers exactly that with clear methodology and results."

AI Summary

This video tests the effectiveness of the hammer candlestick pattern in the Chinese A-share market using historical data and Python. The creator quantifies the pattern's conditions, runs a full backtest from 2007 to the present, and finds that the hammer pattern does not predict price increases, contrary to popular belief.

[00:00]
Introduction to candlestick pattern testing

The video begins a series testing classic candlestick patterns in A-shares using Python and full historical data.

[00:24]
Hammer pattern definition

The hammer is a reversal pattern appearing in a downtrend, with a long lower shadow (at least twice the body), almost no upper shadow, and the close below the next day's close.

[01:03]
Common belief vs. reality

Common belief says the hammer signals a downtrend end and a buy signal, but the video aims to verify this with data.

[01:16]
Quantification and testing method

The creator converts the pattern's vague description into precise, quantifiable conditions, then runs Python code on all A-share historical data.

[01:29]
Backtest results

Over 100,000 hammer patterns found since 2007. After the pattern, prices are more likely to fall, average returns are negative, and the profit/loss ratio is near 1.

[01:56]
Detailed performance metrics

For 1 to 20 days after the pattern, both the probability of price increase and average returns are poor, confirming the hammer is not a bottom-fishing signal in A-shares.

[02:08]
Data and code sharing

The creator offers to share the data and code via WeChat for viewers interested in replicating the analysis.

The hammer candlestick pattern, despite popular belief, does not predict price increases in the A-share market. This data-driven approach provides a scientific reference for traders, showing that the pattern is not a reliable buy signal.

Mentioned in this Video

Tutorial Checklist

1 00:24 Define the hammer pattern conditions: downtrend, lower shadow at least twice the body, no upper shadow, close below next day's close.
2 01:16 Convert the pattern description into precise, quantifiable rules for coding.
3 01:16 Use Python to scan all A-share historical data for occurrences of the pattern.
4 01:29 Run the code and collect statistics on future price movements after each occurrence.
5 01:56 Analyze the probability of price increase and average returns for 1 to 20 days after the pattern.

💡 Key Takeaways

📊

Large-scale backtest

Over 100,000 occurrences provide statistically significant evidence against the pattern's effectiveness.

01:29
💡

Negative average returns

Directly contradicts the common belief that the hammer predicts price increases.

01:42
📊

Consistent poor performance

The pattern fails across all time horizons from 1 to 20 days, strengthening the conclusion.

01:56

[00:00] 很多人炒股喜欢研究K线 他们认为不同K线形态暗含着未来股价的涨跌信息 比如认为起明星形态出现后股价会上涨 高位出现三只乌鸦形态预示着价格即将下跌等等等等

[00:12] 那么这些K线形态在A股到底真的有效吗? 我会用一系列的视频 逐一研究各个经典的K线形态 编写相应的Python代码 并用全量的历史数据来验证它们的效果 感兴趣的朋友可以点击关注,以防迷路

[00:24] 大家好,我是专注于量化投资的行不行 今天我们要介绍的K线形态是锤子线 它属于反转形态 这里的锤子不是大锤80,小锤40的那个锤子 更不是骂人的话哦 而是一个K线形态 我们结合这张图来介绍一下这个形态

[00:37] 大家看这一天的K线 形状上确实很像一个锤子 这也是它名字的由来 它有几个显著的特征 首先它必须出现在下跌区域当中 然后它的下影线是非常的长 一般来说得是本身柱体长度的两倍以上

[00:51] 然后上影线却几乎为零 收盘价必须低于第二天的收盘价 也就是说第二天必须上涨 满足以上条件呢 那么这根K线就是很典型的垂直线形态了 一般大家认为出现这种形态

[01:03] 就预示着下跌趋势的结束我们应该买入相应的股票这是一个买入信号那么这个信号到底是否有效呢为了验证我们就准备找出A股历史上所有的垂直线形态 再去看一下它之后的股价涨跌

[01:16] 这样最有说服力 那么为了达到我们的目的 我们需要尝试着把它模糊的描述语言 转化为精确的可量化的语言 然后使用Python把这些条件实现 找来所有股票的历史数据 运行一下代码 我们就可以看到统计结果

[01:29] 我们可以看到 A股历史上从2007年至今 总共出现10万多次垂直线的形态 这个数据量很大 足以说明问题 我们尝试统计它未来几天股价的涨跌 但是与预想不同的是 这个形态出现之后

[01:42] 股价大概率不会出现明显的上涨 反而出现了下跌 未来的平均收益也是负的 盈亏比也接近于1 大家感兴趣可以暂停看一下这个结果 我就不多加赘述了 我这里还列出了垂直线出现之后 未来1到20天的股价上涨概率和平均收益

[01:56] 表现也都是不佳 这也进一步说明了 垂直线这种形态在A股并不是超底信号 出现它之后还会继续大概率的下跌 大家下次再遇到的话就有科学的参考依据了 本期视频中用到的数据和代码

[02:08] 都是可以分享给大家的 可以加评论右下角或者这里面请取我的微信 都是可以直接发给你的 希望大家多多点赞和关注 后续我们还会分享更多的K线形态的验证结果

More from 量化投资邢不行啊

View all

⚡ Saved you 0h 02m reading this? Transcribe any YouTube video for free — no signup needed.