Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Finding Lows with PeakUtils #3

raoofhujairi opened this issue Apr 26, 2018 · 1 comment


Copy link

commented Apr 26, 2018

Just wanted to command you for your great effort in comparing the options of finding peaks .

as to Peak utils not detecting lows, i found a quick solutions for that , by 馃榾

  1. Inverting the data set ( multiplying by -1)
  2. passing the data set/frame to peakutils.indexes( )

indexes returned are now actually the lows of the data set.
you could plot the lows along with the peaks by passing the indexes to mplot
as indexes for the same signal data.

Quick example

load the date and select columns 

Dates = df['Date']
Close = df['Close'] # Second column data
Close_Inversed = df['Close'] * -1

peaks  = peakutils.indexes(Close, thres=0.15, min_dist=50)
lows = peakutils.indexes(Close_Inversed, thres=0.15, min_dist=50)

print('Peaks are:\n %s' % (Dates[peaks]))
print('Lows are:\n %s' % (Dates[Lows]))

#plot closing price 
plt.plot(col1,col2, lw=2 )

#plot peaks in green markers
plt.plot(Dates[peaks],Close[peaks], marker="8", markersize=10, color='G', ls="")

#plot buttoms in red markers 
plt.plot(Dates[lows],Close[lows], marker="8", markersize=10, color='R', ls="")


note the plot below .




This comment has been minimized.

Copy link

commented Apr 26, 2018

Oh yes, it works neatly!

I added an example inspired by your example. Thanks Raoof!


@MonsieurV MonsieurV closed this Apr 26, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
2 participants
You can鈥檛 perform that action at this time.