VALYNOX
VALYNOXSTRATEGY RESEARCH TECHNOLOGY
AlphaPrimeAlphaPrime
ACADEMY / Strategy generation

Near-Month vs Next-Month TAIEX Futures for Backtesting

The near month is the contract closest to settlement that has not yet expired, and the next month is the one after it. Daily trading and backtests mainly use the near month. But research data must be a continuous contract that rolls on a fixed rule and has the roll gaps adjusted; raw prices of a single contract month are enough only for short checks of a few weeks.

By · Published · updated · Editorial policy

Contents
  1. What are the near month and next month of TAIEX futures? Which one should you backtest?
  2. How do the near month and next month differ in liquidity, spread and basis?
  3. When is the next month better than the near month for TAIEX futures?
  4. Should you switch to the next month on the roll day? Where do continuous-data gaps come from?
  5. Should a backtest use the near month or a continuous contract? How do you choose a research series?
  6. Frequently asked questions
  7. References

What are the near month and next month of TAIEX futures? Which one should you backtest?

The near month and next month of TAIEX futures are the first and second contract months. The near month is the contract month closest to settlement day that has not yet expired; the next month is the month after it. Daily trading and most backtests use the near month. But a backtest cannot use the raw prices of a single contract month. It needs a continuous series that rolls on a fixed rule and has the roll gaps adjusted.

TAIEX futures (TX) list several contract months at once: the current month, the next month, and the three quarterly months after that. When traders say “near month,” they mean the current-month contract, and “next month” means the following month's contract. When each month's settlement day arrives, the near month settles and disappears, the old next month moves up to become the new near month, and the old third month becomes the new next month. Settlement day is the last trading day of the current-month contract, and for TAIEX futures it is the third Wednesday of the delivery month. The code for each contract month is TXF plus a month code. If you cannot read the codes, start with how to read TAIEX futures symbol codes and month codes. You can look up each month's settlement date with the free TAIEX futures settlement dates tool. TAIFEX can change contract specifications and settlement rules, so treat TAIFEX's contract specification page as the official source for exact figures.

Why can't a backtest use a single contract month? A contract month lives only a few months from listing to settlement, and only its last month or two have decent volume. To test a strategy over three or five years, you have to join dozens of contract months one segment after another. Whether you join them correctly matters more than whether you pick the near month or the next month. That is the one point this article keeps trying to convince you of.

The near-month and next-month labels move at every settlement: before settlement, March is the near month and April is the next month; after settlement, March has settled, April becomes the near month and May becomes the next month Near/next month shift monthly Every third-Wednesday settlement Mar Apr May Before Near Next After Settled Near Next Next month becomes the near month. So: track the contract, not the label.
The near and next months are defined by the settlement calendar. On every third Wednesday, both labels move one slot to the right, and today's next month is the near month of the following month.

How do the near month and next month differ in liquidity, spread and basis?

At any given moment, the near month usually has far more volume and order book depth than the next month, so its bid-ask spread is smaller and its slippage is lower. The next month is farther from settlement, and its basis to the spot index is also larger than the near month's. These three things matter differently for a backtest, so look at them separately.

First, define the terms. The bid-ask spread is the distance between the best bid and the best ask, and it decides how many ticks you pay on each of entry and exit with market orders. Slippage is the gap between the fill price a backtest assumes and the actual fill price; the worse the liquidity, the larger the slippage. The basis is the futures price minus the spot index. A positive value is called a premium and a negative value a discount.

ItemNear monthNext monthWhat it means for a backtest
Volume and order book depthHighLowThe slippage setting in your backtest should match the contract you would actually trade
Bid-ask spread and slippageSmallLargerA short-term strategy earns only a few points per trade, so one tick of spread can change the conclusion
Basis to spotSmallerLargerThe two contract months trade at different prices on the same day, so joining the data creates a gap
Days to settlementFewerMoreDecides where the roll day falls and how long a position can be held

Why is the next month's basis larger? In theory, a futures price equals the spot price plus the cost of funds up to settlement, minus the dividends the underlying stocks pay in that period. The farther from settlement, the more cost of funds and dividends accumulate, so the next month's basis is usually larger in absolute value than the near month's. Ex-dividend dates for Taiwan stocks cluster around mid-year, and during that time TAIEX futures often trade at a discount, with a deeper discount for months further out. This is the same reasoning.

Hypothetical example

On one day, the TAIEX weighted index closes at 22,050 points, the near month closes at 22,000 points and the next month closes at 21,900 points. The near month's basis is 22,000 − 22,050 = −50 points, and the next month's basis is 21,900 − 22,050 = −150 points. The two contracts differ by 100 points on the same day. Those 100 points are not market action; they come from the two contracts having different expiry dates. The roll gap in the next section is these 100 points getting into the continuous data.

The most direct place the liquidity difference shows up in a backtest is the slippage setting. If you backtest on near-month data with one tick of slippage, but you actually fill in the next month, which you roll to only in settlement week, then one tick is underestimated. Trading Mini-TAIEX (MXF) has the same problem; see the notes on full-session and day-session liquidity in Mini-TAIEX near-month full-session data in backtests.

Four differences between the near month and next month at the same moment: near-month volume is much higher, which sets slippage; the next-month spread is wider, so one tick makes a difference; the basis is larger, which leaves gaps when joining data; more days remain, which sets the roll day How near and next month differ At the same moment; → backtest impact Volume Near: much higher → sets slippage Spread Next: wider → one tick counts Basis Next: larger → gaps in data Days left Next: more → sets roll day
Four differences between the near month and next month at the same moment, with the effect of each row on a backtest noted on the right.

When is the next month better than the near month for TAIEX futures?

In the last few trading days of settlement week, the next month is better than the near month. Position holders roll their positions to the next month one after another, and the next month's volume overtakes the near month's. During this period, both orders and backtests should be based on the next month, and on settlement day itself the near month serves only for settlement.

The whole process roughly goes like this:

  1. Before settlement week: the near month dominates, while the next month has low volume and a wide spread. Switching to the next month now only costs you slippage.
  2. Mid settlement week: holders who do not want to be settled begin to change contract month, meaning they close the near month and open the next month at the same time. The next month's volume rises noticeably and its spread narrows.
  3. One or two trading days before settlement day: the next month's volume catches up with and passes the near month's. This crossover is when most people roll in practice.
  4. Settlement day itself: the near month trades only until the end of the day session, then settles at the final settlement price, which comes from an average of the spot index over a stretch of time before the close. That day the near month's price action is pulled along by the settlement price, so do not read it as ordinary market action. For the detailed rules, see TAIEX futures settlement day: dates, final price and backtests.

For backtests, only one rule applies: the roll rule must be fixed and written down. Two common ones are “roll N trading days before settlement” and “roll on the day volume crosses.” The first is simple and the same every month. The second is closer to real volume but needs volume data for both contracts. Either works. What matters is that you use the same rule over the whole history, not rolling early in one month and waiting until settlement day in another.

Settlement week schematic: near-month volume falls and next-month volume rises; they cross one to two days before settlement, which is the roll point, and the near month ends on settlement day Roll at the volume cross Volume in settlement week Schematic Roll point Next Near Earlier Settle Once volume crosses, next month wins. So: same roll rule in every year.
A schematic of volume flowing from the near month to the next month in settlement week. The crossover is the roll point, and on settlement day itself the near month serves only for settlement.

Should you switch to the next month on the roll day? Where do continuous-data gaps come from?

On the roll day you switch to the next month, but you have to handle the price difference at the same time. The roll day is the day you switch your data or position from the near month to the next month. The two contract months trade at different prices that day, so joining them directly leaves a gap in the continuous data that the market did not cause. Whether you adjust for this gap decides whether the strategy gets a phantom gain or loss on the roll day.

Here is an everyday comparison. You have two watches, one five minutes fast and one on time. During the day you read the fast one, and in the evening you switch to the accurate one. If you copy both readings straight into one logbook, time appears to go back five minutes at the moment you switch. Time did not go backward; the watches differ. The gap in a continuous contract is that moment of switching watches.

A continuous contract is data that joins a series of contract months into one long series by a fixed roll rule. There are two ways to join them:

  1. Direct splice (unadjusted): before the roll day, copy the near month's prices; after it, copy the next month's. The open of the bar on the roll day then carries a gap that is not market action. A strategy holding a position across the roll day gets a phantom gain or loss that day. A strategy with no position on the roll day is not affected, but indicators that depend on the previous few days' prices are disturbed by the gap.
  2. Gap adjustment (back-adjustment): on the roll day, compute the price difference between the two contracts, then shift the entire history before the roll day by that difference so the line joins. Each roll shifts the history again, so the older the history, the more it has been shifted. The point differences are kept, but the absolute price levels are no longer the prices that actually traded back then.

Hypothetical example

On the roll day, the near month closes at 22,000 points and the next month at 21,920 points, 80 points apart. A strategy goes long one full-size TAIEX futures (TX) contract before the roll day and holds it overnight. On unadjusted spliced data, the next day's price starts straight from the next month's 21,920, which is 80 points lost out of thin air. At NT$200 per point for the full-size contract, that is a phantom loss of NT$16,000. After the gap is adjusted, the whole near-month history before the roll day shifts down 80 points, the phantom loss disappears, and the next day's profit or loss reflects only real market action.

The cost of adjusting is that absolute price levels are distorted. In a continuous contract that spans several years, early prices can be shifted far from what actually traded then, so rules written on absolute levels, such as “breaks below the 20,000-point round number,” cannot be used directly. Percentage stops also get distorted, because the same 80 points is a larger percentage at a shifted, lower price. Stops, indicators and profit or loss measured in points are all correct, because the point differences are untouched.

Roll day schematic: joining the near month directly to the next month leaves a fake 80-point step; after the earlier near-month history is shifted by the difference, the line joins The roll gap isn't real Roll day: 80 points apart Schematic Spliced Near Next Fake step Adjusted Joined Direct joins book fake profit or loss. So: shift the history by the gap.
Top: two contracts joined directly on the roll day leave a gap that is not market action. Bottom: after the earlier contract is shifted by the difference, the line joins.

Should a backtest use the near month or a continuous contract? How do you choose a research series?

Research data should be a continuous contract that rolls on a fixed rule (a set number of days before settlement, or a volume cross) and has the gaps adjusted; a single near-month contract is enough only for short checks of a few weeks. Below, four common series are compared first, then a real report shows how to read results under the same roll rule.

ItemSingle near monthUnadjusted spliced seriesGap-adjusted continuous contractNext-month series
Best used forShort checks of a few weeks, confirming fill detailsResearch that looks only at absolute price levelsStrategy search and multi-year backtestsSettlement-week behavior, basis research
History lengthA few monthsMultiple yearsMultiple yearsMultiple years, but thin volume in the early part
Roll gapsNoneYesNoneYes
Are absolute prices real?RealRealShiftedReal
Stops and point calculationsCorrectDistorted on the roll dayPoints correct, percentages distortedPoints correct, slippage higher
Four contract series and what each is for: a single month suits checks of a few weeks but is only a few months long; a direct splice shows price levels only and has roll gaps; a gap-adjusted series suits multi-year search but its prices are shifted; a next-month series suits settlement-week research but has a wide spread Search on gap-adjusted data One use for each series Single month Few-week checks Months of history Spliced Price levels only Has roll gaps Gap-adjusted Multi-year search Prices shifted Next month Settlement week Wide spread
What each of the four contract series suits. For multi-year strategy search, use the gap-adjusted continuous contract; the other three each have a specialized use.

Once you have picked a series, the remaining settings (session, point value, commission, slippage) have to line up too; five settings to check before backtesting TAIEX futures lists them. AlphaPrime (Valynox) evaluates every candidate on whatever continuous series you feed in, together with commission, slippage and filling on the next bar, and it takes the roll gaps as they are, adjusted or not. So prepare the data before it goes into backtesting.

To show how to read a report on a continuous series whose rolls have been handled, we ran an AlphaPrime backtest on a continuous daily series of ES (E-mini S&P 500) from 2019-01-02 to 2025-06-30, long and short, 1 contract each time. This tested a stand-in rule, not the TAIEX near month or next month itself: entry and exit use a single Efficiency Ratio rule, with no stop loss, no profit target and no filter. For how the efficiency ratio works, see how the Kaufman efficiency ratio shows trend quality. The candidate in the report is the one kept, by return against drawdown, from 1,024 candidates tried in the search. Picking the best-looking one after the fact always makes the numbers prettier than you can expect; that is selection bias, which Bailey et al. (2014) explain in full. The numbers below describe what this one backtest produced over that stretch of history. They are not how much money the rule made, and not a result anyone should expect in the future.

Source: AlphaPrime product engine (CPU), run 2026-10-31. ES daily, 2019-01-02 to 2025-06-30, long and short, 1 contract, commission $20 and slippage $25 per trade.

NumberResult
Net profit (closed trades)$50,967.5
Max drawdown$19,100
Trades41
Win rate56.1%
Profit factor2.107
Average trade$1,243.11
Time in market15.84%
Schematic for checking the equity curve: every rise matches a trade, and a step on a roll day with no trade is flagged as a data problem Every step should be a trade Equity curve vs roll days Schematic Trade Roll day No trade A step on a roll day is a data error. So: match every step to a trade.
Check whether the equity curve has steps near the quarterly roll days that do not belong to any trade. On a continuous series with gaps adjusted, every change in the curve should match a trade, not a roll day. ES · daily · 2019-01-02 to 2025-06-30 · CPU engine backtest

How do you use this report to read the effect of rolls? First, 41 trades and 15.84% time in market mean this candidate is flat most of the time and usually has no position on a roll day, so gap handling matters little to it. For a strategy that is in the market 70 to 80% of the time, the same series problem would be much bigger. Second, ES rolls four times a year, while TAIEX futures roll twelve times a year. Move the same rule to TAIEX futures and the chance that a position is held across a roll day is about three times higher, so adjusting the gap goes from “good to have” to “must have.” Third, match every move in the equity curve to the trade list. A move that matches a trade is the strategy's own result. A move that matches no trade and falls on a roll day is a data problem. The average trade of $1,243.11 should be read against the $45 cost per trade, not just against net profit. The ratio of the two decides whether the conclusion flips when slippage is one tick higher than estimated.

If you have not started running your first strategy, program trading for TAIEX futures, from zero to your first strategy starts from data preparation. A concrete next step you can take now: open your TAIEX futures continuous data, find the last three settlement days, and see how many points the roll-day bar's open differs from the previous bar's close. Then check the close difference between the near month and next month on the same day. If the two numbers are about the same, you have an unadjusted spliced series; adjust it before you run any backtest.

Frequently asked questions

On which day do TAIEX futures change contract month?

The settlement day of each month for TAIEX futures is the third Wednesday of the delivery month, and on that day the near month settles at the final settlement price. In practice, most position holders move to the next month one or two trading days before settlement day, when the next month's volume passes the near month's. The roll day for a backtest can be set at a fixed number of trading days before settlement, or on the day volume crosses. Use the same rule over the whole history.

Why is the price gap between the near month and next month often negative?

The price difference between the two contracts comes from their different expiry dates. A futures fair value equals the spot price plus the cost of funds, minus the dividends paid before expiry. Ex-dividend dates for Taiwan stocks cluster around mid-year, and in that period dividends exceed the cost of funds, with more deducted the further out the month is. So the next month is often lower than the near month, which is a discount. This difference is not market action, and when data is joined it becomes a roll gap.

Can a backtest use a continuous series of the next month directly?

You can use it to study settlement-week behavior or the near-to-next-month spread, but it is not suited as the main series for strategy research. The next month is farther from settlement, and most of the time it has low volume and a wide spread, so the one tick of slippage a backtest assumes is mostly not available in real trading. For strategy search, use a continuous contract rolled from the near month, and switch to the next month in settlement week at the volume crossover. That is closer to the contract you would actually trade.

After the gap is adjusted, prices are not real price levels. How do stops work?

Adjustment shifts the earlier history as a whole and leaves the point differences unchanged, so stops, targets and indicators measured in points are all correct, and so is profit or loss. What gets distorted are rules on absolute price levels (for example, a round-number level) and percentage stops, because the shifted prices differ from the prices at the time. In research, write stops as a fixed number of points or a multiple of ATR, and you avoid the problem.

References

  • Taiwan Futures Exchange. Mini-TAIEX Futures. https://www.taifex.com.tw/enl/eng2/mTX
  • Bailey, D. H., Borwein, J., López de Prado, M., & Zhu, Q. J. (2014). Pseudo-Mathematics and Financial Charlatanism: The Effects of Backtest Overfitting on Out-of-Sample Performance. Notices of the American Mathematical Society, 61(5), 458–471.
  • Pardo, R. (2008). The Evaluation and Optimization of Trading Strategies (2nd ed.). John Wiley & Sons.