search the BNBUSDT chart for any maximum and minimum to determine the maximum and minimum of a Japanese candle that is in the extreme, and plot Fibonacci levels from 0 to 1 on the extreme candle, where 0 should be at the extreme.
def fibonacci_levels(df): # Find the maximum and minimum of candles that have an extreme position maximum = df.iloc[df.High.idxmax()].High minimum = df.iloc[df.Low.idxmin()].Low # Use the function to find the Fibonacci levels fibonacci = fib_retracements(df['High'], df['Low']) # Draw the Fibonacci levels on the chart plt.figure(figsize=(10,5)) plt.plot(df.index, df.High, label = 'High') plt.plot(df.index, df.Low, label = 'Low') plt.plot(df.index, df.Close, label = 'Close') plt.plot(df.index, df.Open, label = 'Open') plt.axhline(y=maximum, color='blue', linestyle='-') plt.axhline(y=minimum, color='red', linestyle='