Millenium

Generation

generate functionMon, 10 Apr 2023

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 find_extremes(dataframe): high = dataframe['high'].max() low = dataframe['low'].min() extreme_candle = dataframe[dataframe['high'] == high] extreme_candle = extreme_candle[extreme_candle['low'] == low] if len(extreme_candle) != 1: raise Exception('More than one candle is extreme') extreme_price = extreme_candle['close'].values[0] fibs = [0.0, 0.382, 0.5, 0.618, 1.0] fib_prices = [extreme_price * (1 - x) + x * low for x in fibs] return fib_prices

Questions about programming?Chat with your personal AI assistant