Skip to content

Forecasting the Nasdaq-100's volatility with HAR-RV

Micro E-mini Nasdaq-100 (MNQ) · 5-minute bars · 2016 to 2026 · Volatility · The model of Corsi (2009)

Marginal: profit factor 1.10 out of sample, not clearly above break-even, t = 0.7.

Profit factor, out of sample
1.10
Average trade, out of sample
+0.04R
Win rate, out of sample
45%
Trades, 10 years
1,210
Max drawdown
$7,911
Pass odds, median plan
4.8%

Hypothetical results. These results are based on simulated or hypothetical performance results that have certain inherent limitations. Unlike the results shown in an actual performance record, these results do not represent actual trading. Also, because these trades have not actually been executed, these results may have under- or over-compensated for the impact, if any, of certain market factors, such as lack of liquidity. Simulated or hypothetical trading programs in general are also subject to the fact that they are designed with the benefit of hindsight. No representation is being made that any account will or is likely to achieve profits or losses similar to these being shown.

Abstract

We backtested the HAR-RV volatility forecast rules on Micro E-mini Nasdaq-100 (MNQ) 5-minute bars from 2016-01-11 to 2026-10-30: 1,210 trades, with commission and a tick of slippage on every market and stop fill. In sample (to 2023-08-03) it made +0.04R per trade with a profit factor of 1.04; out of sample (from 2023-08-04) +0.04R per trade and 1.10 over 386 trades. 13 of the 16 parameter settings we tried were profitable out of sample. Sized at $250 of risk a trade, simulated 50K evaluations passed 1% to 9% of the time across 36 tracked plans.

1Hypothesis

Realized volatility clusters: today's predicts tomorrow's. We fit Corsi's HAR model on the past only, then trade the opening range breakout only on days it expects to be volatile.

If breakouts need volatility and HAR forecasts it, trading the opening range breakout only on high-forecast days should do better than trading it every day.

2Data

Instrument
Micro E-mini Nasdaq-100 (MNQ), traded on the NQ price series (NQ.c.0: front month, rolled on the calendar). CME Globex via Databento.
Period
2016-01-11 to 2026-10-30: 2,745 sessions, 1,056,797 one-minute bars, built into 210,814 5-minute bars of the regular session (09:30 to 16:00 ET).
Costs
$0.75 commission a contract each way and 1 tick ($0.50) of slippage on every market and stop fill. Limit orders fill when price touches them; market orders fill at the next bar's open and stops at their price, each with one tick of slippage; when a bar touches both the stop and the target, the stop counts.
Position size
About $250 of risk a trade: micro contracts, rounded down, at least one. R is a trade's net P&L divided by its risk at entry.
Out of sample
The last 30% of weekdays: 2023-08-04 on (846 days), after 1,974 in-sample days. The rules were fixed before either side was run.

3Method

Our reading of the publicly described rules; the creator may trade it differently. The rules, exactly as the code runs them:

  1. Realized volatility (RV) of a session is the square root of the sum of its squared 5-minute log returns, regular session only (the overnight gap left out).
  2. After each session, the model log RV(t+1) = b0 + b1 log RV(t) + b2 mean(log RV, last 5 days) + b3 mean(log RV, last 22 days) is refitted by least squares on every past day, and forecasts the next.
  3. Trade the next day only if its forecast is at least the min_quantile (0.5, the median) of the last 250 forecasts, and at most their max_quantile (1), and after 250 days of forecasts.
  4. The trade is the 15-minute opening range breakout: the first 5-minute close outside the 09:30-09:45 ET range, until 12:00 ET, stop at the other side, target target_r (2) times the risk, flat at 15:55 ET.
  5. Size: about risk_usd dollars of risk a trade (micro contracts, rounded down, at least 1 and at most max_contracts).
bot.py, the file the engine ran
"""A HAR-RV volatility forecast as a filter for the 15-minute opening range breakout, on Micro E-mini Nasdaq-100 (MNQ). The forecast is Corsi's (2009) HAR model of realized volatility, in logs, fitted day by day on the pastonly (an expanding window), so every forecast is out of sample when it is made. Rules:  1. Realized volatility (RV) of a session is the square root of the sum of its squared 5-minute log     returns, regular session only (the overnight gap left out).  2. After each session, the model log RV(t+1) = b0 + b1 log RV(t) + b2 mean(log RV, last 5 days) + b3     mean(log RV, last 22 days) is refitted by least squares on every past day, and forecasts the next.  3. Trade the next day only if its forecast is at least the `min_quantile` (0.5, the median) of the     last 250 forecasts, and at most their `max_quantile` (1), and after 250 days of forecasts.  4. The trade is the 15-minute opening range breakout: the first 5-minute close outside the 09:30-09:45     ET range, until 12:00 ET, stop at the other side, target `target_r` (2) times the risk, flat at     15:55 ET.  5. Size: about `risk_usd` dollars of risk a trade (micro contracts, rounded down, at least 1 and at     most `max_contracts`)."""import math import qy  def ready(*values):    """True when every value is a number (indicators have no value until they have enough data)."""    return all(v is not None and v == v for v in values)  def solve(a, b):    """Gaussian elimination with partial pivoting for a small system a x = b."""    n = len(b)    m = [row[:] + [b[i]] for i, row in enumerate(a)]    for c in range(n):        p = max(range(c, n), key=lambda r: abs(m[r][c]))        if abs(m[p][c]) < 1e-12:            return None        m[c], m[p] = m[p], m[c]        for r in range(n):            if r != c:                f = m[r][c] / m[c][c]                m[r] = [x - f * y for x, y in zip(m[r], m[c])]    return [m[i][n] / m[i][i] for i in range(n)]  class Bot(qy.Strategy):    """Trade the opening range breakout only on days the HAR model expects to be volatile."""     symbol = "MNQ"    timeframe = "5m"    session = "rth"    params = {"min_quantile": 0.5, "max_quantile": 1.0, "target_r": 2.0, "risk_usd": 250, "max_contracts": 50}    max_position = 50    entry_window = ("09:45", "12:00")    flatten_time = "15:55"    overnight = False     def setup(self):        self.or_high, self.or_low = self.opening_range(minutes=15)        self.day = None        self.last = None        self.ss = 0.0        self.logrv = []        self.xtx = [[0.0] * 4 for _ in range(4)]        self.xty = [0.0] * 4        self.n = 0        self.forecasts = []        self.trade_today = False        self.done_day = None     def _size(self, risk_points):        per_contract = risk_points * self.point_value        n = int(self.p.risk_usd // per_contract) if per_contract > 0 else 1        return max(1, min(self.p.max_contracts, n))     def _features(self, k):        lr = self.logrv        return [1.0, lr[k], sum(lr[k - 4:k + 1]) / 5, sum(lr[k - 21:k + 1]) / 22]     def _end_of_day(self):        if self.ss <= 0:            return        self.logrv.append(math.log(math.sqrt(self.ss) * 100))        k = len(self.logrv) - 1        if k >= 22:  # yesterday's features, today's value: one more pair for the fit            x = self._features(k - 1)            for i in range(4):                self.xty[i] += x[i] * self.logrv[k]                for j in range(4):                    self.xtx[i][j] += x[i] * x[j]            self.n += 1        if k >= 21 and self.n >= 60:            beta = solve(self.xtx, self.xty)            if beta:                self.forecasts.append(sum(b * v for b, v in zip(beta, self._features(k))))                self.forecasts = self.forecasts[-251:]     def _decide(self):        past = self.forecasts[:-1]        if len(past) < 250:            return False        f = self.forecasts[-1]        rank = sum(1 for v in past if v <= f) / len(past)        return self.p.min_quantile <= rank <= self.p.max_quantile     def on_bar(self, bar):        if bar.date != self.day:            if self.day is not None:                self._end_of_day()            self.day, self.ss, self.last = bar.date, 0.0, bar.close            self.trade_today = self._decide()        else:            r = math.log(bar.close / self.last)            self.ss += r * r            self.last = bar.close        high, low = self.or_high[0], self.or_low[0]        if not self.trade_today or not ready(high, low) or self.done_day == bar.date or not self.position.is_flat:            return        close = bar.close        if low <= close <= high:            return        self.done_day = bar.date        if bar.dt.hour * 60 + bar.dt.minute + 5 > 720:            return        f = (high - low) / close * 100        if close > high:            self.buy(self._size(close - low), stop_price=low, target_r=self.p.target_r, tag=f"HAR ORB long | f={f:.4f}")        else:            self.sell(self._size(high - close), stop_price=high, target_r=self.p.target_r, tag=f"HAR ORB short | f={f:.4f}")

4Results

Table 1. In sample (2016-01-11 to 2023-08-03) against out of sample (2023-08-04 to 2026-10-30), after costs.
StatisticIn sampleOut of sampleAll
Trades8243861,210
Net P&L+$3,909+$4,868+$8,777
Profit factor1.041.101.06
Average trade+0.04R+0.04R+0.04R
95% interval of the average−0.04 to 0.12−0.07 to 0.15−0.03 to 0.10
t-statistic of trade R0.910.711.15
Win rate43%45%44%
Average win / average loss1.381.321.36
Max drawdown$7,821$7,911$7,911
Sharpe ratio (daily, annualized)0.280.610.40
Longest losing streak13613
Long / short profit factor1.12 / 0.971.09 / 1.101.11 / 1.02
Average holding time214 min222 min217 min
Commission paid$2,850$633$3,483
Cumulative P&LDrawdown from the highOut of sample from 2023-08-04

Drag across the chart to zoom into a period, double-click to reset.

Figure 1. Cumulative P&L after costs and its drawdown from the running high, 2016-01-11 to 2026-10-30, at about $250 of risk a trade. The shaded part is out of sample.
In sample (824 trades)Out of sample (386)Averages

Averages: +0.04R in sample, +0.04R out of sample.

Figure 2. The distribution of trade results in R, as a share of each side's trades. Bars are in sample; the line is out of sample.
In sampleOut of sampleOLS fitDensity contoursy = x

1,600 of 2,727 points drawn; the fit and the means use all of them. Drag a box to zoom, double-click to reset.

In sampleOut of sampleOLS fitDensity contoursy = x

Drag a box to zoom, double-click to reset.

Below: the HAR forecast against what was realized, out-of-sample days only, log x-axis, log y-axis; the dashed line is the OLS fit (r = 0.55, p < 0.001, n = 821; Spearman ρ = 0.57). Out of sample alone: r = 0.55, p < 0.001. The dotted line is y = x.

Figure 3. Above: tomorrow's regular-session realized volatility (5-minute returns) against today's, every day of the sample, log x-axis, log y-axis; the dashed line is the OLS fit (r = 0.67, p < 0.001, n = 2,727; Spearman ρ = 0.70). Out of sample alone: r = 0.50, p < 0.001. The dotted line is y = x. HAR coefficients fitted on 1,906 in-sample days (constant -0.03, day 0.36, week 0.37, month 0.19); out of sample, R² of log realized volatility is 0.29 for the HAR forecast against 0.21 for a regression on yesterday's value alone, over 821 days.
In sampleOut of sampleQuintile mean, 95% intervalOLS fitDensity contours

Drag a box to zoom, double-click to reset.

Figure 4. Trade R against the opening range's width, on the days the filter traded, log x-axis; the dashed line is the OLS fit (r = −0.02, p = 0.40, n = 1,209; Spearman ρ = 0.15). Out of sample alone: r = 0.03, p = 0.56. Squares are the means of five equal-count bins, with 95% intervals.
Table 2. The same rule with one change at a time, after costs.
VersionTradesPF in samplePF out of sampleAvg R outSharpe outMax drawdown
High-forecast days (as tested)1,2101.041.10+0.04R0.61$7,911
Every day, no forecast filter2,3631.051.07+0.04R0.43$10,071
Low-forecast days only1,1611.061.03+0.05R0.19$5,227

5Robustness

We reran the strategy on a grid of 16 settings of its two main parameters, each on the full history with the same split. 9 were profitable in sample and 13 out of sample.

3
1.06
1.04
1.09
0.95
2
1.07
1.06
1.10
0.96
1.5
1.09
1.08
1.10
0.98
1
1.10
1.11
1.15
1.08
0
0.33
0.50
0.67

Forecast at least (quantile) across, target (R) up. Solid outline: the defaults we tested; dashed: the in-sample best.

Hover a cell for both sides of the split.

Forecast at least (quantile) 0.00 to 0.67 across · Target (R) 1.00 to 3.00 in depth · Profit factor, out of sample 0.95 to 1.15 as height and shade. Drag or use the arrow keys to turn it.

Drag to rotate; ctrl or ⌘ and scroll to zoom.

Figure 5. Profit factor across forecast at least (quantile) and target (R), as a map and as a surface of the same grid. Values above 4 are drawn at 4.

What would change it

Nothing on the grid helps. Its in-sample best, forecast at least (quantile) 0 and target (R) 3, had profit factor 1.06 in sample but 1.06 out of sample, against 1.10 for the defaults.

In-sample yearOut-of-sample year95% interval
Figure 6. Average trade by calendar year with its 95% interval: a year-by-year walk through the history. Lighter bars are in-sample years.
Figure 7. Average trade in three volatility regimes: terciles of the 20-session average of the daily range (% of the open), up to the day before the trade (regular session). The cut-offs use the whole period, so this describes, it doesn't forecast.
Figure 8. Average trade by weekday and by the hour of entry (New York time), with 95% intervals.
Median25th to 75th percentile5th and 95thRuin: down $2,000
Figure 9. 2,000 simulated years of 252 sessions, drawn session by session from the whole backtest (days without trades included), with 48 paths drawn; red paths lost $2,000 at some point. Risk of ruin 40.6% [38.5%, 42.8%]; 60% of years ended up; median ending P&L +$826, 5th to 95th percentile −$4,383 to +$6,091.

6Prop-firm implications

The backtest's sessions run through the rules of 36 tracked 50K evaluations: 2,000 runs of up to 60 sessions each, with the drawdown and daily limits checked against each trade's intraday low. Intervals are Wilson 95% intervals of the simulation. A simulation of the past, not the chance that anyone passes.

PlanPass odds, 95% intervalPassFailOut of timeMedian sessions
FundedNext Futures Flex Challenge 50K9.1%43%48%46
Alpha Futures Zero 50K Evaluation5.0%22%73%49
Apex Trader Funding 50K EOD Evaluation5.0%22%73%49
Apex Trader Funding 50K Intraday Trailing Drawdown Evaluation5.0%28%67%49
AquaFutures Beginner 50K Evaluation5.0%10%85%49
Bulenox 50K Qualification Account (Legacy, Option 1, trailing drawdown)5.0%13%82%49
Bulenox 50K Qualification Account (Legacy, Option 2, EOD drawdown)5.0%10%85%49
Elite Trader Funding 50K 1-Step Evaluation5.0%29%66%49
Elite Trader Funding 50K End of Day Drawdown Evaluation5.0%23%73%49
Funded Futures Family 50K Evaluation (standard plan)5.0%22%73%49
Scale 0 to 25%.
Figure 10. Simulated pass odds by plan, best first, with each plan's fail and out-of-time shares and the median sessions to a pass.

7Limitations

  • The forecast uses regular-session 5-minute returns only.
  • The filter is tested on one breakout rule and one market (MNQ).
  • A backtest on the past, with fills simulated from one-minute bars; live fills, queues and outages differ.

8Conclusion

Marginal: profit factor 1.10 out of sample, not clearly above break-even, t = 0.7. Nothing on the grid helps. Its in-sample best, forecast at least (quantile) 0 and target (R) 3, had profit factor 1.06 in sample but 1.06 out of sample, against 1.10 for the defaults. The result is too close to break-even to tell apart from noise after costs.

9References

  1. Corsi, F. (2009). A Simple Approximate Long-Memory Model of Realized Volatility. Journal of Financial Econometrics, 7(2), 174-196.
  2. Andersen, T. G., Bollerslev, T., Diebold, F. X., and Labys, P. (2003). Modeling and Forecasting Realized Volatility. Econometrica, 71(2), 579-625.

Every number on this page comes from the MNQ bot above, run by our backtest engine on our own data. We publish what doesn't work as well as what does, and we don't tune rules to look good.

Hypothetical results. These results are based on simulated or hypothetical performance results that have certain inherent limitations. Unlike the results shown in an actual performance record, these results do not represent actual trading. Also, because these trades have not actually been executed, these results may have under- or over-compensated for the impact, if any, of certain market factors, such as lack of liquidity. Simulated or hypothetical trading programs in general are also subject to the fact that they are designed with the benefit of hindsight. No representation is being made that any account will or is likely to achieve profits or losses similar to these being shown.