I'm trying to create a simple script to spot candlestick patterns using the TA-Lib library, however I'm not able to pass the correct data even if I'm following the talib instructions as per their github page. The error message I get is 'Input array has wrong dimensions' when passing ohlc prices.
import talib
import numpy as np
class GeekyYellowGreenDinosaur(QCAlgorithm):
def Initialize(self):
self.SetStartDate(2020,1,1) #Set Start Date
self.SetEndDate(2020,12,31)
self.SetCash(1000) # Set Strategy Cash
self.AddForex('EURUSD', Resolution.Hour)
def OnData(self, data):
'''OnData event is the primary entry point for your algorithm. Each new data point will be pumped in here.
Arguments:
data: Slice object keyed by symbol containing the stock data
'''
open_ = np.array(data['EURUSD'].Open)
close_ = np.array(data['EURUSD'].Close)
high_ = np.array(data['EURUSD'].High)
low_ = np.array(data['EURUSD'].Low)
hammer = talib.CDLHAMMER(open_, high_, low_, close_)