Auditing Online Course Strategies with AI: Out-of-Sample Backtesting and Building Your Own XQ Minute-Bar Database
TL;DR: The course strategy really did make money back when the instructor taught it, but its out-of-sample results are poor, so you need AI plus a complete historical database to run a backtest audit and see whether the performance can last.
Key ideas
- Verifying course material can be handed to AI in stages: first understand the key points of the material and decide which techniques can be quantified, then backtest the quantifiable ones, and finally produce a summary report; this time the conclusion was that the instructor did not lie, but the backtest showed no edge.
- Good in-sample performance does not mean a strategy works: it may be overfitting, or the market at the time may simply have suited it; many parameters that are extremely critical (for example, a moving average of 38 works but 39 and 37 both fail) is a warning sign, and you should also be wary when an instructor shows only successful cases.
- A backtest must confirm that there is trading volume, otherwise AI may carry over the previous bar's closing price and create fake trades; you also need to prepare the database and a pre-written research-rules prompt in advance.
- To build your own minute-bar database: in XQ, use the single-run output in the view tool, split the output into segments when the data for over 1800 stocks is large, update weekly, then convert and store it as Parquet with DuckDB; if you don't want to maintain it, you can rent the paid FinMind service instead, depending on your budget.
Ask AI about this episode
Copy the prompt, paste it into an AI service, and add the question. The AI reads the notes on this site and links to the page and the video timestamps.
Or open directly:ChatGPTClaudeGrokPerplexity
Section summaries
0:05Original performance of an options course, backtested by AI
This demonstrates using AI to backtest the material of an options course; besides the original conditions, the AI also tries other conditions on its own. The backtest of the original conditions did make a profit, and the period covered by the handout performed especially well, then fell back and fluctuated, yet overall it still made money, showing that the performance at the time of teaching was real.
▶ Watch from here1:25AI produces the backtest analysis and summary report
Give the course's PDF and videos to AI and ask it to organize the material, decide which techniques can be quantified, backtest them and write a summary. The instructor claimed a big profit of 36 × 10,000 and a 69% win rate; the AI backtest gave about 32 × 10,000, with the gap attributed to fees and how fills are determined, confirming that what the instructor said was true. But the out-of-sample results were poor, possibly because of overfitting or because the market at the time happened to suit it: after earning the most in 2021, it lost steadily. During the process you need to prepare the database and a prompt of rules in advance, and remind the AI that a backtest must have trading volume, otherwise fake trades will appear.
▶ Watch from here29:45Choosing the channel for exporting minute-bar data from XQ
Since you are already renting XQ, you should make good use of it; earlier I taught how to pull daily bars, and next we switch to minute bars. XQ has four places that can export: indicator, stock screening, view and trading. The indicator can only work one stock at a time, so it is ruled out; when exporting minute bars only two choices remain, view and trading, and here I chose view.
▶ Watch from here31:45Writing the minute-bar export script and explaining the fields
The export script is very simple: the user enters a start date, and it prints the output path, date and time, stock name, and open, high, low, close and volume; if you need other fields you can append them at the end, and you must tell the AI what each field means.
▶ Watch from here34:35Exporting 1-minute bars with a single run in Strategy Radar
Exporting 1-minute bars for over 1800 stocks by backtesting or automated trading doesn't work: because the backtest runs on XQ's servers, memory blows up quickly and only about 200–300 stocks have data. The correct way is to add the script to Strategy Radar and switch to single-run mode, setting the start date and a 1-minute bar frequency; when the data is large you must split it up, for example exporting once per half year, since pulling 5 years at once will definitely crash, and after that just update weekly.
▶ Watch from here41:35Storing minute-bar data and choosing a data source
Minute-bar data is stored with Parquet plus DuckDB rather than sqlite, because sqlite files for 1-minute bars or tick data become very large and queries are slow, while this kind of data is rarely modified, so what you want is a small footprint and fast reads. If building your own is a hassle, you can instead use the paid FinMind, at 8888 per year, which saves maintenance and includes historical options data, but has traffic limits; a self-built database has no traffic limits, so choose according to your budget.
▶ Watch from here


