perform a search on the BNBUSDT chart.P any maximum and minimum determine the maximum and minimum of the Japanese candle, which is at the extreme, and build Fibonacci levels from 0 to 1 on the extreme candle, where 0 should be at the extreme.
def search_fibo(symbol, timeframe, max_candles, min_candles): # 1. Find MAX and MIN from the chart. chart = fetch_ohlcv(symbol, timeframe) chart_max = chart.iloc[-max_candles:].max() chart_min = chart.iloc[-min_candles:].min() # 2. Determine the candle of the extremum and build Fibonacci levels if chart_max == chart['high'].max(): extreme_candle = chart[chart['high'] == chart_max] build_fibo(symbol, timeframe, extreme_candle.index[0]) elif chart_min == chart['low'].min(): extreme_candle = chart[chart['low'] == chart_min] build_fibo(symbol, timeframe, extreme_candle.index[0])