I used this code: 
active_signal = None
orderId = None
clientOrderId = None
buy_entry_price = None 
sell_entry_price = None
orderId = None
order = None
 
def calculate_percentage_difference_buy(entry_price, exit_price):
    result = exit_price - entry_price
    price_result = entry_price / 100 
    final_result = result / price_result
    result = final_result * 40
    return result

def calculate_percentage_difference_sell(sell_entry_price, sell_exit_price):
    percentage_difference = sell_entry_price - sell_exit_price
    price_result = sell_entry_price / 100  # price result = 1%
    price_percent_difference = percentage_difference / price_result
    result = price_percent_difference * 40
    return result

while True:
    if df is not None:
        # Get balance function
        balance = client.balance()
        #Get USDT balance function
        for asset in balance:
            if asset['asset'] == 'USDT':
                balance_usdt = float(asset['balance'])
        balance_usdt_futures = balance_usdt * 40

        #Constant
        price_bch = mark_price
        dollars = balance_usdt_futures

        #Counting Balance : BCH price
        bch_amount = dollars / price_bch
        bch_amount_rounded = round(bch_amount, 2)
        quantity = bch_amount_rounded / 2

        signals = signal_generator(df)
        mark_price_data = client.ticker_price(symbol=symbol)
        mark_price = float(mark_price_data['price']) if 'price' in mark_price_data else 0.0
        if signals == ['buy'] or signals == ['sell']:
            print(f"The signal time is: {dt.datetime.now().strftime('%Y-%m-%d %H:%M:%S')}, Price {mark_price} - Signals: {signals}")

            if 'buy' in signals and active_signal != 'buy' and orderId is None and clientOrderId is None:
                try:
                    active_signal = 'buy'
                    buy_entry_price = mark_price
                    print("Buy entry price:", buy_entry_price)
                    order = client.new_order(symbol=symbol, side='BUY' , type='MARKET', quantity=quantity)
                    print("Order opened: ", order)
                    orderId = order['orderId']
                    clientOrderId = order['clientOrderId']
                except binance.error.ClientError as e:
                    print(f"Error executing long order: {e}")

                if sell_entry_price is not None and buy_entry_price is not None:
                    sell_exit_price = mark_price
                    difference_sell = calculate_percentage_difference_sell(sell_entry_price, sell_exit_price)
                    profit_sell = difference_sell 
                    total_profit_sell = profit_sell
                    profit_sell_percent = total_profit_sell - 4
                    print(f"sell entry price {sell_entry_price}, sell exit price {sell_exit_price} , Sell P&L: {round(total_profit_sell, 2)}%   with fee {round(profit_sell_percent, 2)}%")
                else:
                    print("Sell Entry price or Buy Entry price is not defined.")

                if 'buy' in signals and orderId is not None and clientOrderId is not None:
                    try:
                        client.cancel_order(symbol=symbol, orderId=orderId, origClientOrderId=clientOrderId)
                        print("Order closed successfully")
                        orderId = None
                        clientOrderId = None
                        order = client.new_order(symbol=symbol, side='BUY' , type='MARKET', quantity=quantity)
                        orderId = order['orderId']
                        clientOrderId = order['clientOrderId']
                        active_signal = 'buy'
                        buy_entry_price = mark_price
                        print("Buy entry price:", buy_entry_price)
                        print("Order opened: ", order)
                    except binance.error.ClientError as e:
                        print(f"Error closing order: {e}")
                
                israel = []
                
                if signals == ['buy_exit']:
                        active_signal = None
                        israel.append("Long !!! EXIT !!!")
                        if buy_entry_price is not None and israel is not None:
                            buy_exit_price = mark_price
                            difference_buy = calculate_percentage_difference_buy(buy_entry_price, buy_exit_price)
                            profit_buy = difference_buy 
                            total_profit_buy = profit_buy
                            profit_buy_percent = total_profit_buy - 4
                            try:
                                client.cancel_open_orders(symbol=symbol)
                                client.new_order(symbol=symbol, side='SELL', type='MARKET', quantity=quantity)
                            except binance.error.ClientError as e:
                                print(f"Long position successfully exited! ")
                            print(" !!! EXIT !!! ")
                            print(f"Time was : {dt.datetime.now().strftime('%Y-%m-%d %H:%M:%S')}  buy entry price {buy_entry_price}, buy exit price: {mark_price}, Buy P&L: {round(total_profit_buy, 2)}%   with fee {round(profit_buy_percent, 2)}%")
                            buy_entry_price = None
                            buy_exit_price = None
                        else:
                            print("Buy Entry price or Sell Entry price is not defined.")  # Print israel when condition is met
                else: 
                    israel.append('')

            elif 'sell' in signals and orderId is None and clientOrderId is None:
                try:
                    active_signal = 'sell'
                    sell_entry_price = mark_price
                    print("Sell entry price", sell_entry_price)
                    order = client.new_order(symbol=symbol, side='SELL', type='MARKET', quantity=quantity)
                    orderId = order['orderId']
                    clientOrderId = order['clientOrderId']
                    print("Order opened: ", order)
                except binance.error.ClientError as e:
                    print(f"Error opening order: {e}")

                if 'sell' in signals and orderId is not None and clientOrderId is not None:
                    try:
                        client.cancel_order(symbol=symbol, orderId=orderId, origClientOrderId=clientOrderId)
                        print("Order closed successfully")
                        orderId = None
                        clientOrderId = None
                        active_signal = 'sell'
                        sell_entry_price = mark_price
                        print("Sell entry price", sell_entry_price)
                        order = client.new_order(symbol=symbol, side='SELL', type='MARKET', quantity=quantity)
                        orderId = order['orderId']
                        clientOrderId = order['clientOrderId']
                        print("Order opened: ", order)
                    except binance.error.ClientError as e:
                        print(f"Error closing order: {e}")

                if buy_entry_price is not None and sell_entry_price is not None:
                    buy_exit_price = mark_price
                    difference_buy = calculate_percentage_difference_buy(buy_entry_price, buy_exit_price)
                    profit_buy = difference_buy 
                    total_profit_buy = profit_buy
                    profit_buy_percent = total_profit_buy - 4
                    print(f"buy entry price {buy_entry_price}, buy exit price: {sell_entry_price}, Buy P&L: {round(total_profit_buy, 2)}%   with fee {round(profit_buy_percent, 2)}%")
                else:
                    print("Buy Entry price or Sell Entry price is not defined.")

            
                jerusalem = []

                if signals == ['sell_exit']:
                        active_signal = None
                        jerusalem.append("Short !!! EXIT !!!")
                        if sell_entry_price is not None and jerusalem is not None:
                            sell_exit_price = mark_price
                            difference_sell = calculate_percentage_difference_buy(sell_entry_price, sell_exit_price)
                            profit_sell = difference_sell 
                            total_profit_sell = profit_sell
                            profit_sell_percent = total_profit_sell - 4
                            try:
                                client.new_order(symbol=symbol, side='BUY', type='MARKET', quantity=quantity)
                            except binance.error.ClientError as e:
                                print(f"Short position successfully exited!")
                            print(" !!! EXIT !!! ")
                            print(f"Time was : {dt.datetime.now().strftime('%Y-%m-%d %H:%M:%S')}  sell entry price {sell_entry_price}, sell exit price: {mark_price}, Sell P&L: {round(total_profit_sell, 2)}%   with fee {round(profit_sell_percent, 2)}%")
                            sell_entry_price = None
                            sell_exit_price = None
                        else:
                            print("Buy Entry price or Sell Entry price is not defined.")  # Print israel when condition is met
                else: 
                    jerusalem.append('')

    time.sleep(1)

But i getting ERROR: Error opening order: (400, -4164, "Order's notional must be no smaller than 20 (unless you choose reduce only).", {'Date': 'Thu, 30 Nov 2023 15:26:01 GMT', 'Content-Type': 'application/json', 'Content-Length': '99', 'Connection': 'keep-alive', 'Server': 'Tengine', 'x-mbx-used-weight-1m': '-1', 'x-mbx-order-count-10s': '1', 'x-mbx-order-count-1m': '1', 'x-response-time': '0ms', 'Access-Control-Allow-Origin': '*', 'Access-Control-Allow-Methods': 'GET, POST, PUT, DELETE, OPTIONS'})