code:
import pandas as pd
from pathlib import Path
from concurrent.futures import ThreadPoolExecutor, as_completed
import os
import ta
import talib

directory_out = r"E:\01_calculate_talib"


def calculate_talib(file_path, folder_name):
    try:
        # Load the CSV file into a DataFrame
        df = pd.read_csv(file_path)

        output_dir_path = os.path.join(directory_out, folder_name)
        os.makedirs(output_dir_path, exist_ok=True)

        file_name = os.path.basename(file_path)

        output_file_path = os.path.join(output_dir_path, file_name)

        df = ta.add_all_ta_features(
            df, open="Open", high="High", low="Low", close="Close", volume="volume_crypto", fillna=True)

        sma_days = [3, 5, 7, 10, 20, 50]
        ema_days = [3, 5, 7, 9, 12, 20, 26, 50]
        rsi_days = [3, 5, 7, 14, 9, 25, 50]
        wma_days = [3, 5, 7, 9, 14, 20, 50]

        for day in sma_days:
            df[f'sma_{day}'] = talib.SMA(df['Close'], timeperiod=day)
        for day in ema_days:
            df[f'ema_{day}'] = talib.EMA(df['Close'], timeperiod=day)
        for day in wma_days:
            df[f'wma_{day}'] = talib.WMA(df['Close'], timeperiod=day)
        for day in rsi_days:
            df[f'rsi_{day}'] = talib.RSI(df['Close'], timeperiod=day)

        macd_short, signal_short, hist_short = talib.MACD(df['Close'], fastperiod=5, slowperiod=13, signalperiod=5)

        # df[['macd_short', 'signal_short', 'hist_short']] = (macd_short, signal_short, hist_short)
        #
        df['macd_short'] = macd_short
        df['signal_short'] = signal_short
        df['hist_short'] = hist_short

        macd_shorter, signal_shorter, hist_shorter = talib.MACD(df['Close'], fastperiod=3, slowperiod=6, signalperiod=3)

        # df[['macd_shorter', 'signal_shorter', 'hist_shorter']] = (macd_shorter, signal_shorter, hist_shorter)
        df['macd_shorter'] = macd_shorter
        df['signal_shorter'] = signal_shorter
        df['hist_shorter'] = hist_shorter

        macd_short_mid, signal_short_mid, hist_short_mid = talib.MACD(df['Close'], fastperiod=8, slowperiod=17,
                                                                      signalperiod=9)
        # df[['macd_short_mid', 'signal_short_mid', 'hist_short_mid']] = (macd_short_mid, signal_short_mid, hist_short_mid)
        df['macd_short_mid'] = macd_short_mid
        df['signal_short_mid'] = signal_short_mid
        df['hist_short_mid'] = hist_short_mid

        macd_short_long, signal_short_long, hist_short_long = talib.MACD(df['Close'], fastperiod=26, slowperiod=52,
                                                                         signalperiod=18)

        # df[['macd_short_long', 'signal_short_long', 'hist_short_long']] = (macd_short_long, signal_short_long, hist_short_long)
        df['macd_short_long'] = macd_short_long
        df['signal_short_long'] = signal_short_long
        df['hist_short_long'] = hist_short_long

        df.to_csv(output_file_path, index=False)
        print(f"talib calculated {file_path}")
    except Exception as e:
        print(f"Failed to process {file_path} due to {e}")


# Path to the base directory containing your 4 separate folders with CSV files
base_directory_path = r"C:\Users\Fazel\PycharmProjects\downloaded_files\Binance\00_rename_columns_sort\spot"

with ThreadPoolExecutor() as executor:
    futures = []

    # List of folders to iterate through
    folders = [d for d in Path(base_directory_path).iterdir() if d.is_dir()]

    # Loop through each folder and then through each CSV file within them
    for folder in folders:
        folder_name = folder.name
        for file_path in folder.glob('*.csv'):
            print(f"Processing {file_path}…")
            futures.append(executor.submit(calculate_talib, file_path, folder_name))
    for future in as_completed(futures):
        pass  # Future results or exceptions can be processed here if needed


error:
index 14 is out of bounds for axis 0 with size 5