diff --git a/freqtrade/commands/arguments.py b/freqtrade/commands/arguments.py index 17d8f43d7..8c3ddbcdb 100755 --- a/freqtrade/commands/arguments.py +++ b/freqtrade/commands/arguments.py @@ -260,7 +260,12 @@ ARGS_LOOKAHEAD_ANALYSIS = [ a for a in ARGS_BACKTEST if a not in ("position_stacking", "backtest_cache", "backtest_breakdown", "backtest_notes") -] + ["minimum_trade_amount", "targeted_trade_amount", "lookahead_analysis_exportfilename"] +] + [ + "minimum_trade_amount", + "targeted_trade_amount", + "lookahead_analysis_exportfilename", + "lookahead_allow_limit_orders", +] ARGS_RECURSIVE_ANALYSIS = ["timeframe", "timerange", "dataformat_ohlcv", "pairs", "startup_candle"] diff --git a/freqtrade/commands/cli_options.py b/freqtrade/commands/cli_options.py index 62a007f59..c00af1e97 100755 --- a/freqtrade/commands/cli_options.py +++ b/freqtrade/commands/cli_options.py @@ -806,6 +806,14 @@ AVAILABLE_CLI_OPTIONS = { help="Specify startup candles to be checked (`199`, `499`, `999`, `1999`).", nargs="+", ), + "lookahead_allow_limit_orders": Arg( + "--allow-limit-orders", + help=( + "Allow limit orders in lookahead analysis (could cause false positives " + "in lookahead analysis results)." + ), + action="store_true", + ), "show_sensitive": Arg( "--show-sensitive", help="Show secrets in the output.", diff --git a/freqtrade/optimize/analysis/lookahead_helpers.py b/freqtrade/optimize/analysis/lookahead_helpers.py index bc892727a..c9434c3d8 100644 --- a/freqtrade/optimize/analysis/lookahead_helpers.py +++ b/freqtrade/optimize/analysis/lookahead_helpers.py @@ -147,6 +147,17 @@ class LookaheadAnalysisSubFunctions: "Protections were enabled. " "Disabling protections now since they can produce false positives." ) + if not config.get("lookahead_allow_limit_orders", False): + logger.info("Forced order_types to market orders.") + config["order_types"] = { + "entry": "market", + "exit": "market", + "stoploss": "market", + "stoploss_on_exchange": False, + } + else: + logger.info("Using configured order_types, skipping order_types override.") + if config["targeted_trade_amount"] < config["minimum_trade_amount"]: # this combo doesn't make any sense. raise OperationalException(