Skip to content
vp.Ven Petrov
WorkAI demoWritingResourcesResume / CVAboutAt a glance
← Projects & notes
MNQ time-series researchExperiment · 5 min read

A time-series model that failed on later data

A model gained about $2,351 in the research simulation, then lost about $1,728 in three later windows. I followed the experiment from data acquisition and time intervals to costs, evaluation and the decision to reject it for trading.

Ven PetrovResearch results

A model can look useful on the data used to choose it and disappoint as soon as the period changes. That happened in this MNQ price-prediction experiment: about +$2,351 in the selected research simulation became −$1,728 across three later windows. I rejected the configuration for trading.

MNQ is the Micro E-mini Nasdaq-100 futures contract, linked to the Nasdaq-100 stock index. NQ is its larger E-mini counterpart. The dataset records market prices and traded volume over time.

The question had started much earlier, with the data. I had built a custom NinjaTrader extractor, but could access only three months of history at the time. I wanted a longer, detailed time series to explore whether a model could find patterns that continued into other periods.

I directed Claude Code through the implementation and runs. The Python pipeline used MNQ price and volume data, Polars for preparation and LightGBM for prediction. The result was a research experiment, with approximate historical trade simulations, rather than a verified trading return.

Choose the history before choosing the model

Earlier acquisition work used Databento. I asked for actual cost estimates before building the download pipeline, then asked how much one-second history the available credit could cover. Longer history would provide more periods to compare.

The choice was between records of individual transactions and summaries of each second. The recorded estimate for two years of MNQ transaction data was well beyond the budget. The acquisition instead used roughly two and a half years of one-second summaries.

Each summary, often called a bar, contains opening, highest, lowest and closing price plus total volume. It keeps much more timing detail than daily data, but loses the sequence of trades inside that second. It also lacks the transaction count and separate actual buying and selling activity. Those limits determine which features can be built from it.

I had noticed differences between NQ and MNQ activity data in the earlier work. In the model project, I corrected the assumption that NQ should be the evaluation dataset. Testing an MNQ model required more MNQ data. NQ could become a separate comparison later.

More detail is a choice to test

Preparation checks the required fields, converts timestamps to UTC, sorts observations and removes duplicate timestamps. An inspection script reports date and price ranges, average volume and duplicate counts. The target builder excludes an example when its required future observation is missing or crosses a session boundary.

That makes the inputs more consistent without establishing complete coverage. Acquisition notes flagged three degraded days, which need explicit treatment in a fresh evaluation. A small one-day file used to check that the pipeline runs overlaps the later evaluation period, so the research runner excludes it.

I also questioned how much detail to keep. Combining five seconds into one row reduces the work, but can remove a pattern. I asked for comparisons of five and ten seconds, then progressively wider intervals, eventually extending the search to an hour.

Aggregation keeps the first opening price, highest and lowest prices, last closing price and summed volume. The selected configuration used 20-minute summaries to predict the next 20-minute price return. Starting with detailed data let us compare intervals after acquisition.

That search reused the research period. It selected a configuration; the same period could not then independently establish that the choice would continue to work.

A prediction has to survive the cost of acting on it

The evaluator turned the strongest positive and negative estimates into simulated trades. Tightening the selection changed the research result:

Selection in the research period Simulated trades Approximate result after primary costs
Top and bottom 10% 3,907 -$905
Top and bottom 3% 2,605 +$2,351

The primary assumption charged $1.50 for entering and leaving a trade. At $2.25, the research gain fell to about $397. The extra $0.75 across 2,605 simulated trades consumed $1,953.75. These are historical simulation assumptions; the return-to-dollar conversion uses a representative price.

Evaluation moved forward through time: train on six earlier months, evaluate on roughly the next month, then repeat. In the September 2023 through November 2025 research dataset, 14 of 21 evaluation windows were positive under primary costs.

The selected configuration then ran through three additional windows covering December 2025 through February 2026. All three lost money: about $737, $750 and $241. Together they lost $1,728 across 353 simulated trades, or about $1,993 under the higher cost assumption.

SAVED FOLD CSV / APPROXIMATE SIMULATED P&L, USD

21 research folds, then three losing folds.

Historical simulated profit and loss across 24 foldsResearch folds one through twenty-one total $2,350.90. Later folds twenty-two through twenty-four total -$1,728.24. All three later folds are negative. Exact values are in the expandable table.RESEARCH · 01–21LATER-2,500-1,25001,2502,500Fold 1: -$308.07, 52 simulated trades1Fold 2: -$1,379.34, 408 simulated tradesFold 3: $697.12, 24 simulated tradesFold 4: $455.43, 22 simulated trades4Fold 5: -$435.00, 84 simulated tradesFold 6: $1,509.77, 193 simulated tradesFold 7: $841.68, 22 simulated trades7Fold 8: -$791.77, 396 simulated tradesFold 9: -$498.26, 107 simulated tradesFold 10: $62.12, 174 simulated trades10Fold 11: $634.76, 22 simulated tradesFold 12: $357.03, 25 simulated tradesFold 13: -$93.28, 168 simulated trades13Fold 14: $96.96, 24 simulated tradesFold 15: $195.83, 193 simulated tradesFold 16: -$2,122.38, 228 simulated trades16Fold 17: $26.21, 24 simulated tradesFold 18: $331.58, 24 simulated tradesFold 19: $643.97, 24 simulated trades19Fold 20: $281.04, 36 simulated tradesFold 21: $1,845.50, 355 simulated tradesFold 22: -$736.84, 113 simulated trades22Fold 23: -$750.43, 218 simulated trades23Fold 24: -$240.97, 22 simulated trades24fold
Research · 21 folds$2,350.90
Later · 3 folds-$1,728.24
Inspect all 24 fold values
FoldPeriodP&L · USDTrades
1Research-$308.0752
2Research-$1,379.34408
3Research$697.1224
4Research$455.4322
5Research-$435.0084
6Research$1,509.77193
7Research$841.6822
8Research-$791.77396
9Research-$498.26107
10Research$62.12174
11Research$634.7622
12Research$357.0325
13Research-$93.28168
14Research$96.9624
15Research$195.83193
16Research-$2,122.38228
17Research$26.2124
18Research$331.5824
19Research$643.9724
20Research$281.0436
21Research$1,845.50355
22Later-$736.84113
23Later-$750.43218
24Later-$240.9722
Recomputed from saved walk-forward CSVs. Different period lengths; not annualized or live returns. The evaluator uses a representative price, outer validation for early stopping and whole-fold prediction percentiles. See the article for these limits.

The earlier research notes called the result a breakthrough. The later entry says DO NOT TRADE this configuration as-is. The additional data changed the decision.

The later period still needs a cleaner test

The time split removes the prediction horizon plus an additional hour from the end of training. For a 20-minute prediction, that creates an 80-minute gap before evaluation, keeping nearby training targets from extending into that window.

Approximate evaluation windows

Train on earlier bars, evaluate on later bars

Fold 1
6 months · traingapevaluate
Fold 2
6 months · traingapevaluate
Fold 3
6 months · traingapevaluate
The split includes temporal purging and a gap. Outer-fold early stopping and whole-fold thresholds still limit what this evaluation establishes.

Two implementation choices still weaken the separation. The final model uses the later evaluation answers to decide when training stops. The evaluator also sets its selection cutoffs from all eligible predictions in each evaluation window:

# Shortened illustration of the current selection rule.
upper_threshold = np.percentile(predictions, 97)
lower_threshold = np.percentile(predictions, 3)

At the start of the window, its remaining predictions would not yet exist. A cleaner test would determine both training decisions and selection cutoffs from earlier information. I therefore describe these as later-period results, rather than claiming a completely untouched statistical holdout.

The existing 126 causality and time-split tests passed locally. They check useful properties, including whether adding future rows changes an earlier feature value. They do not remove those two evaluation dependencies or establish that trades could be executed profitably.

This work left me with a rejected configuration and a more specific next experiment: treat degraded days explicitly, set model and selection decisions using earlier data, then evaluate on a new period. Buying detailed data and building a working pipeline gave me a way to ask the question. The later losses were the reason not to act on the selected result.

Project sources & checks
Data acquisition decisions

Earlier MNQ acquisition work records Databento cost estimates, completed one-second OHLCV downloads and degraded-day warnings. Direct Claude Code requests establish the preference to estimate costs first and investigate longer history.

Local repository and code review

mnq-nq-xgboos-lightgbm: research/notes.md, scripts/01_prepare_data.py, scripts/02_run_walkforward.py, src/mnq_research/data_io.py, labels.py, splits.py and train.py.

Recorded experiment outputs

Recomputed totals from metrics_by_fold.csv in runs 20260410_124942 and 20260410_125941; these are approximate historical simulations.

Focused verification

126 existing causality and temporal-split tests passed locally. This does not establish that the entire evaluation is free of bias.

On this page
Choose the history before choosing the modelMore detail is a choice to testA prediction has to survive the cost of acting on itThe later period still needs a cleaner testSources & checks
PythonLightGBMData engineeringValidation

Connected to this

All writing
NQ/MNQ backtest engine · Technical note

Yesterday’s short was blocking today’s trades in the simulator

Small-cap edge research · Project story

What would make a small-cap price pattern worth testing?

Ven PetrovSoftware engineer · Barcelona
GitHub ↗LinkedIn ↗Email ↗

Find a project or a note

18 results

Transfutur ERP · ExperienceERP for transport and logisticsAs the sole engineer, I built an ERP from zero for transport and logistics. It supported roughly €5–6 million in annual invoicing across two offices, and I kept it running for about a year.Finance evidence desk · Project storyCan an AI reviewer improve a financial explanation?A finance review needs the right explanation as well as the right numbers. I tested one AI analyst, an added reviewer and self-review on the same public report. The added review produced fewer supported answers.Financial review lab · Project storyWhat contributed to an $86 million rise in operating income?I built a financial-report explorer around a question I could check: how did seven income-statement movements add up to an $86 million increase? The same source now supports comparisons of sales, cash flow and reported versus core results.MNQ time-series research · ExperimentA time-series model that failed on later dataA model gained about $2,351 in the research simulation, then lost about $1,728 in three later windows. I followed the experiment from data acquisition and time intervals to costs, evaluation and the decision to reject it for trading.Crude-oil narrative tracker · Project storyFollowing crude-oil news without losing the market numbersI used a short personal experiment to follow global events alongside crude-oil prices and position values. The prototype calculates the numbers before asking Claude Code for an assessment and keeps a limited recent history.NQ/MNQ backtest engine · Technical noteYesterday’s short was blocking today’s trades in the simulatorWhen input stopped before the scheduled close, the strategy forgot a position but a shared counter kept counting it. Closing the old position before resetting the day restored the trade record and released the block.Small-cap edge research · Project storyWhat would make a small-cap price pattern worth testing?I built a Python and DuckDB prototype to turn trading ideas into named tests, compare their costs and revisit them in later periods. The candidates deteriorated under further checks, and the source exposed a misleading pass flag.Gadgeon Europe applications · ExperienceConnected-device dashboards and mobile apps at Gadgeon EuropeThe dashboards let people monitor energy use and control connected devices through data from several APIs. My work covered customized Ionic and Angular apps, integrations, store releases and maintenance.ctxforge · Project storyctxforge: turn “add search” into a task an agent can build“Add search” leaves decisions about data, matching and behavior unanswered. I built an editable toolkit that asks an LLM to uncover those requirements and show its assumptions before a coding agent starts.Sociedades Inactivas enquiries · Technical noteAn enquiry should survive a failed emailA failed notification should not make someone submit the same enquiry twice. The implemented form keeps the saved request and its reference while email delivery is retried; live activation is still pending.Astro local-services website · Project storyKeeping local service pages and their FAQs consistentA city page should only offer services enabled for that location. I used shared Astro templates with explicit availability rules, and one FAQ selection for both the visible page and its structured data.3D Spaces website migration · Project storyMoving 3D Spaces without moving its mailboxThe website could move to Next.js and Vercel, while email still depended on the old host. I carried over the pages, enquiry flow and analytics, then checked what the cutover had actually preserved.Capture CRM · Project storySave the listing now, connect the person when the details arriveA classified listing may arrive before its phone number or contact name. Capture CRM keeps those records separate, then lets a later capture complete the existing listing and bring contact status back to the browsing page.Product-description comparison bench · ExperimentWhere did the product description get that detail wrong?A product description can go wrong when the image is read or when the copy is written. This local bench exposes both steps, lets me switch models and records request measurements. A matched quality comparison is still unfinished.Between Us · Project storyBetween Us: keeping control of a generated filmA more emotional dialogue take still needed convincing acting and framing. I kept the alternatives, widened shots to reveal gestures and changed the workflow when its studio limited the films I wanted to make.Restaurant-service voice agent · ExperimentDesigning a restaurant-service call around the real offerThe first correction was the offer: a paid service had become a free visit in one draft. I then compared how the Spanish voice-agent prompts handled new speakers, technical limits and booking results.Vapi and Telnyx voice integration · Technical noteThe Vapi agent could speak, but it could not hear me clearlyI could hear the assistant, but it could not understand my distorted audio. Three codec tests changed the connection behavior and brought the greeting back; the caller-audio problem remains unresolved.Warloop: Echoes of Solmara · Project storyWarloop: turning generated character art into a playable prototypeGood-looking character images became tiny figures, a backwards walk and misplaced bosses in the game. I worked through the gap between generated art and playable behavior.
esc to close · Tab to move through results