mirror of
https://github.com/freqtrade/freqtrade.git
synced 2025-12-17 05:11:15 +00:00
feat: Override order types for lookahead analysis
this avoids false positives - but could cause false-negatives if the problem is in a pricing callback. `--allow-limit-orders` can re-allow limit orders to test for this scenario. part of #12168
This commit is contained in:
@@ -260,7 +260,12 @@ ARGS_LOOKAHEAD_ANALYSIS = [
|
|||||||
a
|
a
|
||||||
for a in ARGS_BACKTEST
|
for a in ARGS_BACKTEST
|
||||||
if a not in ("position_stacking", "backtest_cache", "backtest_breakdown", "backtest_notes")
|
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"]
|
ARGS_RECURSIVE_ANALYSIS = ["timeframe", "timerange", "dataformat_ohlcv", "pairs", "startup_candle"]
|
||||||
|
|
||||||
|
|||||||
@@ -806,6 +806,14 @@ AVAILABLE_CLI_OPTIONS = {
|
|||||||
help="Specify startup candles to be checked (`199`, `499`, `999`, `1999`).",
|
help="Specify startup candles to be checked (`199`, `499`, `999`, `1999`).",
|
||||||
nargs="+",
|
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": Arg(
|
||||||
"--show-sensitive",
|
"--show-sensitive",
|
||||||
help="Show secrets in the output.",
|
help="Show secrets in the output.",
|
||||||
|
|||||||
@@ -147,6 +147,17 @@ class LookaheadAnalysisSubFunctions:
|
|||||||
"Protections were enabled. "
|
"Protections were enabled. "
|
||||||
"Disabling protections now since they can produce false positives."
|
"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"]:
|
if config["targeted_trade_amount"] < config["minimum_trade_amount"]:
|
||||||
# this combo doesn't make any sense.
|
# this combo doesn't make any sense.
|
||||||
raise OperationalException(
|
raise OperationalException(
|
||||||
|
|||||||
Reference in New Issue
Block a user