If yes please the share code examples
I find one examples but it not work on live market
Hello, Shirish,
Yes, it is possible to find Higher High and Lower Low price action or trend breakout patterns in Python using technical analysis libraries such as pandas, numpy, and ta.
You can use the approach in the blog you have shared but you can't directly use the code. To find if today is maxima or minima, in addition to today's data it needs future 5 datapoints since the order is 5 in argrelextrema function.
The order parameter in argrelextrema function defines how many points on each side to use for the comparison to consider. So, to check price at time t is minima or maxima, it compares prices of t-5 till t+5 with the price at t.
You can compare the current price with the previous highest high or lowest low to identify the breakout patterns.
I hope this helps!
Thanks… Please share code simple…
the current price with the previous highest high or lowest low to identify the breakout patterns.
Current price in current dataframe and highest high or lowest low point in different data frame
confuse with compares different data frame
Hello Shirish,
you can write as below:
Assuming you have current price data in the dataframe df and the highest high and lowest low in the dataframe df_h_l with columns hh and ll,
# Select the current price
current_price = df.iloc[-1]['close']
# Select the latest higher high, lower low and store in 'hh', 'll'
hh = df_h_l.iloc[-1]['hh']
ll = df_h_l.iloc[-1]['ll']
# Check if 'current_price' is greater than 'hh'
if current_price > hh:
print("Breakout to the upside!")
# Check if 'current_price' is less than 'll'
elif current_price < ll:
print("Breakout to the downside!")
# If neither of the above conditions is met, print 'No breakout.'
else:
print("No breakout.")
I hope this helps!