Skip to content

Validation and Autotune

node3 edited this page Sep 16, 2026 · 5 revisions

Validation and Autotune

Use this workflow before relying on FXNews for Live market monitoring. Validation reports how the composer behaves on locally available broker M1 data. Autotune compares the current parameter baseline with eight fixed candidates and reports the best qualifying recommendation; it does not change the current indicator session.

Neither mode places trades or writes files. Detailed results are written to the MT5 Journal and drawn on the chart (long lines wrap onto several labels), and the instance stays parked in its mode with the report visible until it is re-attached or its inputs change.

What the Historical Model Measures

Since 3.0 the historical modes score bar history through the same composer, breakout structure, impulse blend and regime blend as the live scanner. Only the feature extraction differs:

  • Scan-timeframe bars, the ATR and the range box are aggregated from M1 bars by time; a bar with fewer than half its minutes present is rejected and counted, and higher timeframes such as H4 and D1 are scored like any other.
  • Execution uses the bar's spread column, else the median of the previous two hours' bars that carry one, else the symbol's current spread; the report prints the mix per boundary. Quote age and tick gap do not exist in bar data and leave the blend.
  • The impulse speed windows are 5, 10 and 30 minutes, not seconds, each against a baseline of same-length windows, with their own proxy threshold (minute_impulse_z, printed as such). They are not comparable with MinImpulseZForSignal.
  • Hold is one minute of resolution: a bar that closed outside the range counts as held. No re-entry is tracked. Consequently hold_score saturates at its maximum and fakeout_penalty is always zero in a historical run, so the weak_hold_cap (74) and range_snapback_cap (64) composite caps cannot bind here although both are active on a live scan. Historical scores are therefore penalised less than live scores at the same quality, and every report states this limitation on its own lines.
  • The currency basket and the calendar are unavailable, so every historical score carries the same flow_absent_cap (84) and no_calendar_cap (94) a live instance without those readings gets. Bucket comparisons therefore run over the scores that exist; the 85+ bucket stays empty by construction.
  • Outcomes pay the spread: a long enters at the ask and is measured against bid highs and lows, a short enters at the bid and is measured against the ask. A window missing more than half its minutes is counted as unevaluable, not scored as zero.

Treat historical results as comparative evidence about the ranking, not as a replay of live signals and not as a forecast. Follow them with forward observation in a demo or other non-production terminal.

1. Prepare History

  1. Compile and attach FXNews from MQL5/Indicators/FXNews.
  2. Put the chart on M1. MetaTrader builds the M1 series for the symbol the chart is on only when the chart timeframe is M1. On any other timeframe that one symbol returns 4401 and is skipped while every other symbol in the basket downloads on demand — so the symbol most likely to be dropped is the one you were looking at. The indicator warns before the run when this applies, and its skip message names it. Attaching to an M1 chart is enough.
  3. For a window longer than the chart has loaded, point the chart at a symbol you are not evaluating. An M1 chart is necessary but not sufficient: the chart symbol's M1 series holds only what the chart itself loaded, so a multi-year request for it still fails. The headless gate does this with FXNEWS_CHART_SYMBOL.
  4. Add the evaluated symbols to Market Watch and let the terminal download their history. A symbol without history in the window is named in the Journal with the error code and skipped.
  5. Check the terminal's max bars in chart setting (Options → Charts). A low value silently truncates every window whatever you request — 50000 returned 48.8 days on a 90-day request and would cap a multi-year one the same way. The only place it shows is the report's Window: line, so read that line rather than assuming it matches HistoricalLookbackDays.
  6. Start with a practical subset of symbols and timeframes before expanding the workload.

Suggested baseline inputs:

HistoricalLookbackDays = 90
HistoricalStepMinutes = 1
HistoricalWarmupBars = 500
HistoricalMaxBoundariesPerProfile = 2000
OutcomeTargetAtr = 0.50
OutcomeStopAtr = 0.35

2. Run Baseline Validation

Set:

OperatingMode = FXNEWS_MODE_VALIDATION

The Journal announces the start; the run is synchronous and the chart updates when it completes. Read the complete report. Review, in order:

  • the span actually loaded per symbol (a warning names symbols covering less than half the requested days);
  • boundaries evaluated versus available, the sub-sampling stride, boundaries rejected for gaps, and the spread source mix;
  • signal count, average score, profit-factor proxy, average R at 5, 15 and 30 minutes;
  • target-first and stop-first rates and the score edge between them;
  • count and average 30-minute R per score bucket (<65, 65-69, 70-74, 75-79, 80-84).

Do not rely on a configuration when the sample is small or higher buckets fail to show more favourable behaviour than lower ones. A first run on the development broker over two profiles (EURUSD and GBPUSD on M5 and H1, 89 days) produced 224 signals with a stop-first rate near 76% and negative average R at every horizon; that is the kind of answer the validator exists to give, and it is not evidence about any other broker, basket or window.

What the largest run to date found, so you know the shape of the answer to expect. Seven majors over eight years (2018–2026), 20 665 917 M1 bars, 25 074 boundaries, 2 714 signals: profit-factor proxy 0.70, average 30-minute R −0.197, bucket hit rates 31.5–33.2%, and no populated bucket reaches the 41.2% break-even rate for the default 0.50/0.35 geometry. Two facts from that work are worth carrying into any run you do:

  • The window matters more than any single number. The same rules scored profit-factor 0.75 on 48.8 days, 0.90 on 730 days and 0.70 on 2900 days. The default 90 days is not representative, and the ranking verdict flipped between windows across that work — so treat a single-window result as one sample, not as the answer.
  • The score edge is the line to read first. It compares the average score of signals that reached the target against those that hit the stop. On the largest run the difference was −0.1 points: signals that won and signals that lost scored essentially the same. When that number is near zero the score is not separating outcomes on your data, whatever the bucket table appears to show.

None of it is a forecast for your broker, basket or target geometry, and none of it is a reason to tune the score until your own backtest looks better — that is fitting to the sample that exposed the weakness.

3. Run Autotune

Set:

OperatingMode = FXNEWS_MODE_AUTOTUNE
AutotuneMinSignals = 100

Autotune evaluates eight fixed candidate profiles against the current baseline. A candidate varies the range lookback, the breakout buffer, the minimum score, the spread-to-ATR limit, the overextension level and the minute-scale impulse threshold. Every candidate is judged on the same outcome definition (OutcomeTargetAtr and OutcomeStopAtr), so a candidate can only win on better signals, never on a more forgiving target geometry. Boundary features are computed once and shared by all candidates, so a sweep costs little more than a validation.

It reports a candidate only when it has enough samples and improves the built-in objective (average 30-minute R, target-first rate, stop-first rate, profit-factor proxy, and score edge). Review the Journal rather than the candidate name alone; prefer broad improvement across several metrics.

4. Record Effective Settings

When a candidate qualifies, the Journal lists the settings whose meaning is identical in the live scanner:

  • RangeLookbackM1
  • BreakoutBufferATR
  • MinBreakoutBufferPips
  • MinDisplayConfidence
  • MaxSpreadToAtrRatio
  • MaxOverextensionAtr

The candidate's minute-scale impulse threshold is printed separately as a historical-only proxy; MinImpulseZForSignal is measured on second-scale windows and must be derived from forward observation.

Autotune cannot change the read-only values in the MT5 input dialog, active runtime settings, or files. Record the recommendation from the Journal, validate it on a separate holdout period, then enter approved values manually in the input dialog or save them through MetaTrader's normal input-set workflow. The instance stays in Autotune mode with its report until you change its inputs.

5. Perform Robustness Checks

Changing an input reinitializes the indicator, so first enter the recorded candidate values manually. Then rerun Validation with deliberately varied conditions, such as:

  • a shorter recent lookback;
  • a different symbol subset;
  • fewer or different scan timeframes;
  • a different broker or account type when available.

A shorter lookback that ends at the same latest bar is a recent-window robustness check, not a true out-of-sample test. The indicator has no historical end-date or train/test split input; a genuine out-of-sample workflow requires external period control.

6. Observe Live Behavior

For a fresh Live attachment, set:

OperatingMode = FXNEWS_MODE_LIVE

Use a demo or other non-production terminal and compare Live behavior with the historical expectations:

  • confirm execution conditions are normal;
  • inspect row reasons and tooltips;
  • watch correlation groups and leader selection;
  • verify that high score buckets are selective rather than frequent;
  • check behavior across sessions and changing volatility;
  • keep alerts disabled until duplicate suppression and signal frequency are understood.

Re-run the comparison after changing broker, account type, symbol basket, scan timeframes, or materially important scoring inputs.

Headless runs on macOS

./tools/selftest-macos.sh --validation and --autotune run a short pass over EURUSD and GBPUSD on M5 and H1 through the terminal and fail unless the report completes. They exercise the engine end to end; they are not a substitute for a run over your own basket.

The gate takes FXNEWS_HISTORICAL_SYMBOLS, FXNEWS_HISTORICAL_LOOKBACK_DAYS, FXNEWS_CHART_SYMBOL and FXNEWS_SELFTEST_TIMEOUT. The lookback override does not reach the indicator — the test harness passes only its first three inputs, so the run silently uses the default value; the script says so rather than pretending otherwise. Change the input default if you need a non-default window in a headless run.

Clone this wiki locally