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(chart, candle, num_lines, param): # chart: chart object # candle: number of the candle to draw fibo from # num_lines: number of lines to draw # param: either 'max' or 'min' to determine from candle low or high to draw fibo from # set baseline and extreme baseline = getattr(chart.iloc[candle], param) extreme = getattr(chart.iloc[candle], param) # set baseline to candle before baseline = getattr(chart.iloc[candle-1], param) # find the next candle with a higher high for i in range(candle+1, len(chart)): if getattr(chart.iloc[i], param) > extreme: extreme = getattr(chart.iloc[i], param) else: break # find the next candle with a lower low for i in range(candle+1, len(chart)): if