Skip to content

Latest commit

 

History

History
194 lines (168 loc) · 11.9 KB

evaluation.md

File metadata and controls

194 lines (168 loc) · 11.9 KB

Strategy evaluation protocol

Operator guides describe how to run each strategy. This protocol governs evidence for changing configurations or strategy behavior.

Evaluate a proposed change against the current configuration on the same unseen market history. Judge portfolio performance after costs, not training loss. This procedure does not establish that the current defaults are optimal.

What the backtest measures

The native FreqAI backtest runs in two phases:

  1. Train models and construct each pair's rolling predictions (training loop).
  2. Replay enabled fit_live_predictions() updates over those predictions (replay loop).

QuickAdapter replay follows the same observation and gap-warmup rules as live calibration; see its prediction contract. Label HPO reads OHLCV only through the current replay candle, even when predictions are missing. Its parameter changes feed the strategy's per-candle NATR and distance calculations. Model RMSE remains tied to its original training window.

Limit: replay cannot change models trained in the first phase. Evaluating the complete live feedback loop requires a chronological runner that interleaves training, prediction and state updates, or a forward dry-run. This repository provides no such runner. Do not present native-backtest results as validation of that complete loop.

Use QuickAdapter's model-error guidance to interpret RMSE and unavailable scores; neither establishes profitability. With method=train_test_split, test_size=0 disables internal validation and deployment refit, not later rolling predictions. timeseries_split does not accept zero.

Backtest result caching

Both strategies bind native result-cache reuse to the selected strategy/model implementations, their local ancestors, Python/Freqtrade versions and relevant dependency versions. Source coverage includes every .py file recursively below each local implementation's directory, including dynamically imported and unused files. Adding, editing, deleting or renaming any such file invalidates reuse. Keep implementation code in dedicated directories, separate from generated data.

Installed libraries, bytecode, virtual environments and non-Python artifacts do not expand this source boundary. Directory symlinks are not followed; Python file symlinks contribute their target contents unless the target is an installed library. Code and resources outside these boundaries, and same-version changes to installed dependencies, require separate identifiers for cold comparisons.

Unchanged inputs retain native parameter handling, cache-age rules and storage identifiers. Existing artifacts are not deleted. Restart the bot or webserver after editing local code; cache identity does not reload modules.

This outer cache is separate from FreqAI models and predictions. Invalidation does not erase their state or reconstruct a historical environment. Native result identity also does not hash downloaded candle contents: use --cache none after replacing market history. Use separate identifiers and storage for cold comparisons as described below.

Archived strategy charts

Freqtrade 2026.10 can reanalyse the strategy source stored in a backtest ZIP for charts. This is separate from running a backtest or reusing its prediction cache. With the supplied models, replay refuses a fallback to the current strategy when the archived source cannot load.

QuickAdapter rejects this archived chart replay: native archives omit its local helper modules, and already imported current helpers are not historical copies. Use current-strategy charts with the intended project revision, or rerun the backtest from that revision. Self-contained RLAgentStrategy archives may replay when the extracted source loads, but the current server still supplies the FreqAI model and runtime configuration; this does not reproduce a saved policy or freeze the historical environment.

ReforceXY can resolve training fees without a pairlist provider. Archived chart analysis still uses current data and training settings; use normal backtesting for controlled policy training and evaluation.

These checks run in QuickAdapterRegressorV3 and ReforceXY, not in other FreqAI models. Reserve ft_bt_strategy* directories containing <archive>_<strategy>.py for native archive extraction; do not configure that layout as an ordinary strategy_path.

Design the comparison

  1. Fix the question before inspecting results. Specify the incumbent, candidate change, pair universe, evaluation dates, training/prediction window lengths, HPO budget, seeds and costs. Choose a primary economic metric, a minimum worthwhile improvement and acceptable risk limits. Record all tried configurations, including failures. Reserve a final chronological period for confirmation; once used to revise the strategy, it is no longer unseen.
  2. Reproduce the information available at each decision. Train on earlier data and compare both configurations on identical subsequent timestamps. Account for listing/delisting dates and missing candles; selecting only today's surviving pairs biases historical results. Fit preprocessing and select features/model hyperparameters inside each training window, using time-ordered inner validation. Keep scoring windows outside model selection. Threshold calibration must use only predictions available at that time.
  3. Respect label availability. Keep causal_mode enabled. A historical row is not usable for training until all observations needed for its labels and weights are known. Compare each known_at_lookahead candle offset with the cutoff minus its row position in the unsliced window; use the latest availability across labels and weights. Reject unknown, invalid or out-of-frame availability per row, not by discarding an entire availability column. causal_mode alone is not proof of this invariant. Allow for additional publication/execution delays where relevant. Purging removes overlapping label information; an embargo excludes training samples immediately after a validation block when a split uses future training data (López de Prado). Prefer earlier-only training here, not an arbitrary universal embargo duration.
  4. Isolate the change and its state. Start with fixed label/model parameters when comparing a component; evaluate tuning separately if it is part of the proposed behavior. Dynamic label HPO optimizes morphology in fit_live_predictions(), not held-out trading returns: judge its choices on subsequent economic results using the live-loop evaluation above. With validation enabled, QuickAdapter cold-starts regressor trials and the selection model; inherited models are reserved for deployment refit. Use separate freqai.identifier values and model, prediction and Optuna storage for each configuration/seed. --cache none bypasses backtest-result caching, not FreqAI model or prediction reuse.

Measure economics and uncertainty

  • Model costs and execution. Hold sizing, protections and execution rules constant unless they are the change under test. Set --fee explicitly, use --enable-protections when evaluating protections, and use downloaded detail candles with --timeframe-detail where feasible. Compare plausible base and adverse cost scenarios, including spread, slippage, impact and funding/borrow costs where applicable. Freqtrade's candle assumptions do not establish realistic fills or capacity; non-fee execution effects need a separate model. A dry-run checks forward behavior, not actual exchange fills.
  • Report portfolio outcomes. Compare net return, maximum drawdown, exposure, turnover and trade count, with results by period and long/short side. State the equity convention and sampling interval. Closed-trade balance omits unrealized losses: use equity including open positions for portfolio drawdown, or label the reported balance-based measure and its limitation. Do not average window drawdowns. Report prediction coverage, failed windows, holdout_rmse and training latency alongside economics. Do not discard failed runs to improve averages. Cash/buy-and-hold provide context, not a replacement for the incumbent.
  • Separate market uncertainty from training randomness. Repeat stochastic fits/searches with the same planned seed list for both configurations and report the paired differences, not just the best run. Seeds reuse the same market history; they are not independent market samples. There is no universal sufficient seed count. Record sampler/model seeds and parallelism; a fixed seed alone does not guarantee identical HPO or GPU results.
  • Match inference to the data. For uncertainty in mean performance, compare aligned portfolio returns at a stated frequency. A paired block bootstrap can preserve temporal dependence by resampling the same time blocks for both configurations (Politis and Romano). State the effect, interval method, confidence level, block-length choice and sensitivity to it. Justify the dependence/stationarity assumptions; neither extra seeds nor more bootstrap draws compensate for short history or regime changes. Maximum drawdown is path-dependent: an interval for mean return is not its risk bound. Report results as inconclusive when the data cannot support the intended claim.
  • Account for strategy selection. Repeatedly choosing the best backtest inflates apparent performance (Bailey et al.). If making significance claims across candidates, define the comparison family and use valid dependence-aware tests with a multiple-testing correction such as Holm's procedure; correction cannot repair invalid underlying p-values. Report effect sizes and uncertainty, not only significance. Keep drawdown and cost sensitivity visible rather than reducing the decision to a single score.

Confirm and preserve the evidence

Run lookahead analysis and recursive analysis to investigate leakage and startup sensitivity. Use adequate history for every informative timeframe and a separate disposable FreqAI identifier for each analysis, with no existing model directory. Both commands delete the selected identifier's model directory during analysis. Never use retained or live-run identifiers. Exempt only confirmed target-construction flags; investigate feature and signal differences. Clean results cover only the paths exercised, not the absence of all leakage.

Evaluate the frozen candidate on the reserved period, then check forward behavior in dry-run. Adopt it only if the evidence supports the planned economic and risk criteria; otherwise retain the incumbent and distinguish rejection from insufficient evidence. Archive a timestamped run manifest with commits, resolved image/dependency versions, configuration/data hashes, commands, identifiers, seeds, HPO histories, split cutoffs, costs and results. The Docker base tag moves; record the image digest, not just stable_freqai.