Quant research workflow:
Put 5MA, volatility and backtests into the same chain of evidence.
Quantitative work isn't about making charts more complicated; it's about clearly documenting the research question, data scope, formulas, execution rules and failure conditions. This article uses 5MA/20MA offsets, volatility Z‑Score and out‑of‑sample backtesting to establish a reproducible process. Z-Score
Read the conclusion first.
- MA offset describes the difference between the prices removed from the window and the new prices; it is not a standalone buy/sell signal.
- A volatility Z‑Score only indicates whether current volatility is high or low relative to its own historical distribution; it cannot infer direction. Z-Score
- The most important thing in backtesting is not a pretty curve but time splits, next‑bar execution, costs, out‑of‑sample validation and failure monitoring.
1. First write the research question as a falsifiable proposition
1.1 Change “will it rise?” into observable conditions
“5MA up so it will rise” is not a complete proposition because it omits the signal timestamp, entry price, holding period, trading costs, and failure conditions. A more testable phrasing is: “When the 5‑day MA at close is above the 20‑day MA, hold one daily bar the next trading day; after deducting two‑way costs, is the average return still positive?” That clarifies which fields to collect.
1.2 Fixed data scope
Before research, record the instrument, exchange, currency, adjustment method, frequency and cutoff date. If using ETFs, whether dividends are reinvested changes results; if using futures, the roll method for continuous contracts changes returns. Different measurement bases must not be silently mixed on the same curve. ETF
2. 5MA/20MA offset: understand the window first, then discuss turning points
2.1 Moving averages and deduction formulas
An n‑day simple moving average is the mean of the most recent n closes. Between today and tomorrow the window drops the oldest price and adds the new one, so the moving average can change for reasons other than today's return.
MA(n,t+1) − MA(n,t) = (C_{t+1} − C_{t-n+1}) / n
2.2 Reproducible demonstration
2.3 Usage boundaries for 5MA and 20MA
Short moving averages are sensitive to noise, long moving averages are slow to react to turns. When comparing offset values, also observe volume, volatility state, support/resistance and transaction costs; do not present “higher offset → aids decline, lower offset → aids rise” as deterministic causation. Can directly useVolatility Z‑Score tool Z-ScoreCheck the volatility environment at the time, then reconcile historical close prices in your own spreadsheet.
3. Volatility Z‑Score: clearly define high vs low volatility Z-Score
3.1 From price to returns
Calculate daily returns first using prices adjusted to the same adjustment convention. r_t=P_t/P_{t-1}−1,then compute the sample standard deviation over a fixed window. If you use prices directly to compute standard deviation, you will mistake price level for risk.
Z_t = (σ_t − mean(σ)) / stdev(σ)
3.2 Interpreting three situations
| result | What may be said | Things you shouldn't say |
|---|---|---|
| Z ≥ 2 | Current rolling volatility is high relative to the sample's own distribution | Cannot directly tell you to short or that something will definitely fall |
| −2 < Z < 2 | Approaching the midpoint of its own sample | Do not say the risk has disappeared |
| Z ≤ −2 | Current volatility is low relative to its own distribution | Do not say low volatility equals safety |
Window, sample length and market structure all affect the Z‑Score. It is suitable for research stratification — e.g., adjusting backtest cost assumptions or shortening leveraged exposure — not as a substitute for a trading plan. Z-Score
4. Out‑of‑sample backtest: prevent mistaking historical noise for edge
4.1 Slice by lookahead time, then retune parameters
Split data into research, validation and archived out‑of‑sample periods. Parameters may only be set in the research period; out‑of‑sample data may only be used after rules are locked. If you repeatedly view out‑of‑sample results and then change parameters, it is no longer out‑of‑sample.
4.2 Next‑bar execution and costs
Signals formed at the close cannot assume execution at that same closing trade, unless you can prove a close‑matching mechanism. A conservative approach is to execute on the next bar and include commissions, spreads, slippage, taxes, rollovers and suspensions. Strategy returns and buy‑and‑hold should be compared using the same price basis.
4.3 Drawdown is not a cosmetic metric
Beyond total return, you should at least report maximum drawdown, drawdown duration, number of trades, single‑trade distribution, worst consecutive losses and out‑of‑sample deviation. Achieving a high Sharpe on a small number of trades may be estimation error; using many parameters to make a curve look straight risks overfitting.
Can be paired withHistorical VaR estimator與Kelly risk budget tool,turn research results into stress tests rather than directly into position sizing.
5. Reproducible quantitative research checklist
- Can the research hypothesis be falsified by the data?
- Are price, dividends and futures roll conventions fixed?
- Is the out‑of‑sample period clearly isolated?
- Are signal and fill at least one candle apart?
- Have cost, slippage, taxes, and liquidity been stress‑tested?
- Is the number of parameters proportional to the sample size?
- Are versions, cut‑off dates and reasons for each change recorded?
- Are failure conditions and shutdown rules written down in advance?
Turn the research process into operational calculations.
Paste in your verified daily returns first, use the Z‑Score to check volatility positioning, and finally use risk budgeting to check position limits. Z-Score
Common questions
Does a higher offset value necessarily contribute to price declines?
No. The offset value only describes the mechanical effect of replacing the moving‑average window; actual prices remain affected by new information, volume, liquidity and market microstructure.
Can the Z‑Score predict crashes? Z-Score
No. It is a descriptive statistic of the relative distribution; even with a high volatility Z‑Score, it provides no information on direction or timing. Z-Score
Does poor out‑of‑sample performance necessarily mean the strategy is invalid?
It at least indicates that the current rules and data scope did not reproduce an edge during the out‑of‑sample period. You should first check data, cost and execution assumptions before deciding to stop research, rather than retroactively tweaking out‑of‑sample parameters.