# Buggy code
def _load_strategy(
    strategy_name: str, config: dict, extra_dir: Optional[str] = None
) -> IStrategy:
    """
    Search and loads the specified strategy.
    :param strategy_name: name of the module to import
    :param config: configuration for the strategy
    :param extra_dir: additional directory to search for the given strategy
    :return: Strategy instance or None
    """

    abs_paths = StrategyResolver.build_search_paths(
        config, user_subdir=USERPATH_STRATEGY, extra_dir=extra_dir
    )

    if ":" in strategy_name:
        logger.info("loading base64 encoded strategy")
        strat = strategy_name.split(":")

        if len(strat) == 2:
            temp = Path(tempfile.mkdtemp("freq", "strategy"))
            name = strat[0] + ".py"

            temp.joinpath(name).write_text(urlsafe_b64decode(strat[1]).decode("utf-8"))
            temp.joinpath("__init__.py").touch()

            strategy_name = strat[0]

            # register temp path with the bot
            abs_paths.insert(0, temp.resolve())

    strategy = StrategyResolver._load_object(
        paths=abs_paths, object_name=strategy_name, kwargs={"config": config}
    )
    if strategy:
        strategy._populate_fun_len = len(
            getfullargspec(strategy.populate_indicators).args
        )
        strategy._buy_fun_len = len(getfullargspec(strategy.populate_buy_trend).args)
        strategy._sell_fun_len = len(getfullargspec(strategy.populate_sell_trend).args)
        if any(
            [
                x == 2
                for x in [
                    strategy._populate_fun_len,
                    strategy._buy_fun_len,
                    strategy._sell_fun_len,
                ]
            ]
        ):
            strategy.INTERFACE_VERSION = 1

        return strategy

    raise OperationalException(
        f"Impossible to load Strategy '{strategy_name}'. This class does not exist "
        "or contains Python code errors."
    )


# Traceback (Exception)
2020-02-20 22:47:28,025 - freqtrade - ERROR - Fatal exception!
Traceback (most recent call last):
File "/opt/tradebot/freqtrade/.env/lib/python3.7/site-packages/talib/__init__.py", line 20, in wrapper
for arg in chain(args, kwargs.values())
StopIteration

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/freqtrade/freqtrade/main.py", line 36, in main
return_code = args['func'](args)
File "/freqtrade/freqtrade/commands/optimize_commands.py", line 76, in start_hyperopt
hyperopt.start()
File "/freqtrade/freqtrade/optimize/hyperopt.py", line 488, in start
preprocessed = self.backtesting.strategy.tickerdata_to_dataframe(data)
File "/freqtrade/freqtrade/strategy/interface.py", line 448, in tickerdata_to_dataframe
for pair, pair_data in tickerdata.items()}
File "/freqtrade/freqtrade/strategy/interface.py", line 448, in <dictcomp>
for pair, pair_data in tickerdata.items()}
File "/freqtrade/freqtrade/strategy/interface.py", line 464, in advise_indicators
return self.populate_indicators(dataframe, metadata)
File "/freqtrade/user_data/strategies/MyDev.py", line 205, in populate_indicators
dataframe['mfi'] = ta.MFI(dataframe)
File "talib/_abstract.pxi", line 352, in talib._ta_lib.Function.__call__
File "talib/_abstract.pxi", line 383, in talib._ta_lib.Function.__call_function
File "/opt/tradebot/freqtrade/.env/lib/python3.7/site-packages/talib/__init__.py", line 24, in wrapper
return func(*args, **kwargs)
File "talib/_func.pxi", line 8454, in talib._ta_lib.MFI
Exception: volume is not double

# Fixed code
def _load_strategy(
    strategy_name: str, config: dict, extra_dir: Optional[str] = None
) -> IStrategy:
    """
    Search and loads the specified strategy.
    :param strategy_name: name of the module to import
    :param config: configuration for the strategy
    :param extra_dir: additional directory to search for the given strategy
    :return: Strategy instance or None
    """

    abs_paths = StrategyResolver.build_search_paths(
        config, user_subdir=USERPATH_STRATEGIES, extra_dir=extra_dir
    )

    if ":" in strategy_name:
        logger.info("loading base64 encoded strategy")
        strat = strategy_name.split(":")

        if len(strat) == 2:
            temp = Path(tempfile.mkdtemp("freq", "strategy"))
            name = strat[0] + ".py"

            temp.joinpath(name).write_text(urlsafe_b64decode(strat[1]).decode("utf-8"))
            temp.joinpath("__init__.py").touch()

            strategy_name = strat[0]

            # register temp path with the bot
            abs_paths.insert(0, temp.resolve())

    strategy = StrategyResolver._load_object(
        paths=abs_paths, object_name=strategy_name, kwargs={"config": config}
    )
    if strategy:
        strategy._populate_fun_len = len(
            getfullargspec(strategy.populate_indicators).args
        )
        strategy._buy_fun_len = len(getfullargspec(strategy.populate_buy_trend).args)
        strategy._sell_fun_len = len(getfullargspec(strategy.populate_sell_trend).args)
        if any(
            [
                x == 2
                for x in [
                    strategy._populate_fun_len,
                    strategy._buy_fun_len,
                    strategy._sell_fun_len,
                ]
            ]
        ):
            strategy.INTERFACE_VERSION = 1

        return strategy

    raise OperationalException(
        f"Impossible to load Strategy '{strategy_name}'. This class does not exist "
        "or contains Python code errors."
    )