TAYU Academy course material · Backtest & Live Deployment
Text walkthrough
Preventing backtest bias
A self-paced text walkthrough, without video or audio. See the article below for worked examples and materials.
Course Notes
1. Understand the core idea of “Preventing backtest bias” and explain it in your own words
2. Master this module's focus: Building a backtesting framework
3. Complete the assignment on your own and check it against the reference answer
Backtest bias includes future information, survivorship, sample selection, data revision, and unrealistic matching. Price curves cannot be excluded from these issues when compared to final returns.
To do a reliable backtest, use accurate historical data (including spread), assume trading on the next candle, include commissions and slippage, avoid survivorship bias and lookahead bias, and save reproducible configurations (data version, parameters, random seed).
For the same strategy with zero costs, an annualization of 25% drops to 8% when accounting for a 1 pip spread and commissions, highlighting how sensitive this strategy is to costs.
Check data version → Verify available time → Isolate feature/tags → Execute after validating close signal → Retain fees/fail orders.
Deciding to buy on the day's close and assuming a fill at that same close with no delay: identify the bias and a reproducible alternative experiment.
Contains the strong assumption of forced execution at the same price; this can be changed to using closed signals, simulating the next open and charging fees. Real transactions still require other evidence and cannot guarantee the next open will be available.
Closing at 100 generates a signal for the next open at 103; backtesting at 100 for a trade would be equivalent to using an unavailable price. If the same H=110, L=90, both the SL95 and TP105 orders are covered, the order of triggering is unknown, and automatic profit calculation cannot be done automatically.
A longer sample does not remove systematic look-ahead leakage; synthetic data is only for checking calculations and does not prove a strategy works.
The script covers data cleaning, a traceable next-open simulation, and equity and risk arithmetic. It is not a production trading engine; the hand calculations and report tasks for this lesson still have to be done independently.
python research_lab.py --self-test
python research_lab.py --output academy-results1. Costs must be included in the backtest
2. Reproducible configuration
3. Avoid look-ahead and other biases
Risk warning: leveraged trading in forex, precious metals and similar products carries a high level of risk and you may lose all of your capital, or more. This course is for education only. It is not investment advice and does not promise any return. Example prices and contract specifications are teaching assumptions; always use what your own platform discloses. Past performance and backtests do not indicate future results.
All values, prices, accounts and cases in this course are teaching assumptions; the fixed materials can be reproduced offline. Marking a lesson complete only records your study. It is not a certification, a service approval or a promise of returns. Workbooks and answer files are currently provided in Chinese.
Key Takeaways
Completion records your own study, not verified competence. Exercises use fictional data; no real account or deposit is required.