Open
Description
Not sure if I am misunderstanding something... but I am getting all zeros for many pattern rec functions...
numpy v1.26.4
pandas v2.2.2
TA-Lib v0.4.28
example code:
import numpy as np
import pandas as pd
import talib
# Create a sample DataFrame with OHLC data
data = {
'Open': [22, 21, 20, 18, 16, 16, 18, 19, 20, 21, 22, 23, 24],
'High': [23, 22, 21, 19, 17, 17, 19, 20, 21, 22, 23, 24, 25],
'Low': [21, 20, 19, 17, 15, 15, 17, 18, 19, 20, 21, 22, 23],
'Close': [21, 20, 18, 16, 16, 18, 19, 20, 21, 22, 23, 24, 25]
}
df = pd.DataFrame(data)
# Convert the DataFrame columns to NumPy arrays with type float64
open_prices = np.array(df['Open'], dtype='float64')
high_prices = np.array(df['High'], dtype='float64')
low_prices = np.array(df['Low'], dtype='float64')
close_prices = np.array(df['Close'], dtype='float64')
# Apply the CDLMORNINGSTAR function
morning_star = talib.CDLMORNINGSTAR(open_prices, high_prices, low_prices, close_prices)
# Print the input data and the result
print("Open Prices: ", open_prices)
print("High Prices: ", high_prices)
print("Low Prices: ", low_prices)
print("Close Prices: ", close_prices)
print("Morning Star Pattern: ", morning_star)
Results:
Open Prices: [22. 21. 20. 18. 16. 16. 18. 19. 20. 21. 22. 23. 24.]
High Prices: [23. 22. 21. 19. 17. 17. 19. 20. 21. 22. 23. 24. 25.]
Low Prices: [21. 20. 19. 17. 15. 15. 17. 18. 19. 20. 21. 22. 23.]
Close Prices: [21. 20. 18. 16. 16. 18. 19. 20. 21. 22. 23. 24. 25.]
Morning Star Pattern: [0 0 0 0 0 0 0 0 0 0 0 0 0]
Metadata
Metadata
Assignees
Labels
No labels