talib 如何检测模式?

how talib is detecting patterns?

sample_data = [
    ['1/22/14', 10, 18, 5, 20],
    ['1/23/14', 12, 21, 7, 22],
    ['1/24/14', 14, 24, 9, 24],
    ['1/25/14', 16, 27, 11, 26],
    ['1/26/14', 18, 30, 13, 28],
    ['1/27/14', 20, 33, 15, 30],
    ['1/28/14', 22, 36, 17, 32],
    ['1/29/14', 24, 39, 19, 34],
    ['1/30/14', 26, 41, 21, 38],
    ['1/31/14', 30, 45, 25, 30],
    ['2/03/14', 241.75, 243.15, 240.65, 241.80],
    ['1/31/14', 30, 45, 25, 30],
]

# convert data to columns
sample_data = np.column_stack(sample_data)

# extract the columns we need, making sure to make them 64-bit floats
o = sample_data[1].astype(float)
h = sample_data[2].astype(float)
l = sample_data[3].astype(float)
c = sample_data[4].astype(float)

print(talib.CDLDOJI(o, h, l, c))

输出是:[0 0 0 0 0 0 0 0 0 0 100 100]

但是如果你查看最后一个数据和倒数第三个数据是相同的,但它仍然没有检测到它,我注意到它只在 10 根蜡烛过去后才开始检测模式,这是对的还是我遗漏了一些东西.

根据代码:

/* real body is like doji's body when it's shorter than 10% the average of the 10 previous candles' high-low range */

并且函数 return 0 或 100 以防检测到蜡烛。 所以前 10 个值必须为 0。