VALYNOX
VALYNOXSTRATEGY RESEARCH TECHNOLOGY
AlphaPrimeAlphaPrime
ACADEMY / Strategy generation

Write TAIEX Futures Entry Points as Backtestable Rules

A TAIEX futures entry point can be backtested only when it is written as conditions a computer can judge true or false on every bar. Split the idea into price, time and filter conditions and write down a parameter range for each. Then judge it with average trade after costs, day/night session and yearly breakdowns, and a neighboring-parameter check. Only an idea that passes all three checks is worth taking further.

By · Published · updated · Editorial policy

Contents
  1. How do you turn a TAIEX futures entry point into a backtestable rule?
  2. When do you enter TAIEX futures? Common signal building blocks
  3. How do you tell whether a TAIEX futures entry signal is useful?
  4. Should you test the same entry rule separately for the day session, the night session and each year?
  5. How do you check that a TAIEX futures entry point is not overfitted?
  6. Frequently asked questions
  7. References

How do you turn a TAIEX futures entry point into a backtestable rule?

To backtest a TAIEX futures entry point, you have to write it as a condition a computer can judge true or false on every bar: which price to use, how many bars to look back, which session to limit it to, and which filter to add. A phrase like “buy the pullback” first has to be split into explicit conditions with written parameter ranges. Then you judge it with a backtest that includes costs, day/night and yearly breakdowns, and a neighboring-parameter check, so you no longer have to guess at entries.

A backtestable rule is a set of conditions. For every bar in the historical data, the computer can answer “enter now?” with only yes or no. “Buy the pullback” cannot answer that. How far down counts as a pullback? Is it judged on the close or the low? What do you wait for after the pullback before buying? The same sentence turns into two different sets of trades in the hands of two people. The first step of a backtest is to fill in these blanks. Think of it this way: a vague entry idea is like a hand-drawn map, and you have to guess the whole way. A backtestable rule is like turn-by-turn directions that say left or right at every intersection.

In practice, the conditions of a TAIEX futures entry point fall into three types, and you need to write all three:

  • Price conditions: which price to use (close, high, low, open), what to compare it with (the high of the previous N bars, a moving average, a channel boundary), and how many bars to look back.
  • Time conditions: which session allows entries, after what time no new positions are opened, and how many minutes before the close to force an exit.
  • Filters: a filter is an extra condition, separate from the entry signal, that decides whether to act on that signal. Examples are requiring volatility to be large enough, or the larger-timeframe trend to point the same way.

Once the conditions are written, add one more thing: whichever bar the signal appears on, you enter at the open of the next bar. The signal is computed from that bar's close, and by the time you see that close, it is already too late to trade at it.

The entry idea “buy the pullback” leaves four gaps; a testable rule fills every one of them: price source, lookback range, session, filter Turn an idea into a rule Fill every gap Idea “Buy the pullback” 4 gaps Rule Price: close Lookback: 10–40 Session: day Filter: trend Every bar gets a clear yes or no. So: fill in all four first.
On the left is the TAIEX futures entry point most people describe. On the right is a version a computer can judge bar by bar. The difference is that the price source, lookback length, session and filter are all spelled out.

The order from idea to a conclusion you can trust is always five steps:

  1. Write down the idea. Describe in one sentence what you now do by feel, for example “go long when the open is strong.”
  2. Break it into conditions and parameter ranges. Turn every blank into a price, time or filter condition, and write every number as a range, not a single value.
  3. Backtest with costs. Put in commission, futures transaction tax and slippage from the very first backtest, and fill at the next bar's open.
  4. Split by session and by year. A single combined number can hide a rule that works only in one session or one year.
  5. Check for overfitting. Look at neighboring parameters, the out-of-sample period and the number of trades. If any check fails, treat the rule as a new idea and go back to step one.
Five steps from idea to a trustworthy result: write down the idea, add conditions and ranges, backtest with costs, split by session and year, check for overfitting; a failed check goes back to step one as a new idea Five steps, forward only A failed check means starting over 1 2 3 4 5 Write down the idea Conditions and ranges Backtest with costs Split by session, year Overfitting check Failed: Restart Don't just tweak one number and retest. So: a failed check is a new idea.
The five steps only move forward. When the last step fails, you do not go back, change one number and test again. You treat the rule as a new idea and start over.

If you have not written any rules yet, start with program trading for TAIEX futures, from zero to your first strategy, then come back for step two. If contracts, margin and point value are still unfamiliar, futures trading basics and why to write rules first covers what you need to know before backtesting in one article.

When do you enter TAIEX futures? Common signal building blocks

Most TAIEX futures entry signals break down into four building blocks: breakout, pullback, range and time. Each has a fixed calculation and its own parameters. Pick one, write down its parameter ranges, test it, and only then combine blocks. Do not stack many conditions from the start. The more conditions you have, the more coincidences can match historical price action, and you cannot tell which condition is doing the work.

Building blockWhat entry meansParameters to write downTypical starting range
BreakoutGo long when the close is above the highest high of the previous N bars, and short when it is below the lowest lowLookback N; close or intrabar touchN from 10 to 40 bars
PullbackWhen the larger direction is up, go long only after price returns near the moving average and turns strong againAverage length, how close the pullback must get, definition of turning strongAverage of 10 to 60 bars; turning strong means closing back above the average
RangeGo long when price touches the lower channel edge and short at the upper edge, betting on a return to the middleChannel width, calculation length, whether to wait for a reversal barWidth of 1.5 to 2.5 standard deviations; length of 15 to 30 bars
TimeEnter only during a certain window, or use the high or low of a window as the entry priceWindow start and end, which session, the time after which no new positions open15 to 60 minutes after the open
Four entry building blocks and the parameter range each one needs: breakout lookback N of 10 to 40 bars, pullback moving average of 10 to 60 bars, range band of 1.5 to 2.5 standard deviations, time window of 15 to 60 minutes after the open Four entry building blocks Every parameter should be a range Breakout N: 10–40 bars Pullback MA: 10–60 Range Band: 1.5–2.5 SD Time First 15–60 min
The parameters each of the four blocks needs written down. A parameter that is not written as a range cannot be used for a neighboring-parameter check later.

The time block has to match TAIEX futures trading hours. The day session runs from 08:45 to 13:45, and the night session runs from 15:00 to 05:00 the next day. TAIFEX may change these times, so check TAIFEX's contract specification page before you write rules. You can also use the free futures market hours tool to compare them with the time in your own time zone. Volatility in the first stretch after the open differs from the rest of the session, so “time” is often not a standalone entry block but a filter on other blocks. For example, a breakout may be allowed to enter only between 08:45 and 10:00.

Writing parameters as ranges instead of single values has two uses. First, it forces you to admit that “20 bars” is only a guess, and that 18 bars and 22 bars have no reason to be very different. Second, it gives the checks in the next section something to look at. In the strategy generation of AlphaPrime (Valynox), each row of the table above is a set of entry and exit conditions whose ranges you can set. The search space sits next to the rule, so you do not need to go back and fill it in when you check neighboring parameters later.

When you combine blocks, follow one order. First test a single block and confirm that its average trade is positive after costs. Then add one filter and see whether the average trade improves and how much the number of trades drops. A filter that cuts the number of trades in half while improving the average trade only slightly is usually not worth adding.

How do you tell whether a TAIEX futures entry signal is useful?

To judge an entry signal, look at the average trade after commission and slippage, the profit factor and the number of trades, not only the win rate. A rule with a 70% win rate can lose money after costs if its winners are much smaller than its losers. A breakout rule with a 40% win rate can hold up because each win is large. Read the three numbers together; if you drop one, you can be misled.

The average trade is the net profit over the backtest period after all costs, divided by the number of trades. It is the only number you can compare directly with costs:

Average trade after costs = total net profit after costs ÷ number of trades

Here “costs” means commission, futures transaction tax and slippage added up for one round trip, and a “trade” is a complete trade, with the entry and exit counted as one. The average trade should be several times the round-trip cost, so that the rule does not turn negative if slippage is a little worse than you estimated. The profit factor is the sum of all winning trades divided by the sum of all losing trades; below 1 means the losers outweigh the winners. The number of trades decides whether the first two numbers can be trusted. With 30 trades, swapping out two or three can move the average a lot. An average over several hundred trades holds up better.

Hypothetical example

Take a hypothetical Mini-TAIEX (MXF) pullback entry rule. Over six years it makes 400 trades and earns NT$120,000 before costs, an average trade of NT$300. One Mini-TAIEX point is worth NT$50, so an average trade of NT$300 equals 6 points. Assume commission, futures transaction tax and one tick of slippage add up to NT$150 per round trip. After costs the average trade is NT$150, only about one times the cost. With one more tick of slippage, the rule is close to zero. The same rule would be worth discussing only if its average trade after costs were NT$600, four times the cost.

The backtest box below shows how to read these numbers. It does not test TAIEX futures, and it does not test a pullback or breakout block. It tests a stand-in DMI rule on NQ (Nasdaq-100 futures) daily bars. DMI is the only entry and exit condition, with no stop loss, no profit target and no filter, over 2019-01-02 to 2025-06-30, with one contract per side, long and short. It is a stand-in built from a standard indicator, not the subject of this article. It is the one candidate kept, by return against drawdown, from 1,024 candidates tried in the search. Picking the best one out of more than a thousand after the fact makes the numbers look better than they deserve.

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

NumberResult
Net profit (closed trades)$50,370
Max drawdown$21,320
Trades76
Win rate59.21%
Profit factor1.702
Average trade$662.76
Time in market7.72%
Reading order for the NQ daily demo report: net profit is about 2.4 times max drawdown, then 76 trades is few, then average trade of $663 against $30 in costs, and win rate of 59% last Read the report in this order NQ daily bars demo, 2019–2025 1 2 3 4 Net vs drawdown ≈2.4 to 1 Trades 76: too few Average trade $663 vs $30 cost Win rate 59%: last Costs are fine; 76 trades is too thin. So: look at win rate last.
When you read a report, check three things first: the ratio of net profit to maximum drawdown, the number of trades, and the average trade after costs. Look at the win rate last. NQ · daily · 2019-01-02 to 2025-06-30 · CPU engine backtest

Apply the method above to this box. The average trade of $662.76 against $30 per trade in commission and slippage is a large multiple, so costs are not the problem. A profit factor of 1.702 means the winners add up to about 1.7 times the losers. But there are only 76 trades. Six and a half years of daily bars never produce many trades, so the average trade has limited reliability. A maximum drawdown of $21,320 against a net profit of $50,370 is not small either. These numbers describe what happened to this one kept candidate over that stretch of history. They do not mean that DMI or this rule earned this money, and they are not a result you should expect. Treat it only as a demonstration of how to read a report.

Should you test the same entry rule separately for the day session, the night session and each year?

Yes. Split the backtest into the day session (08:45–13:45), the night session (15:00–05:00 the next day) and individual years. A TAIEX futures entry point that makes money in only one session or one year has most likely run into that stretch of market action, and the rule itself is not what works. A combined number is like a class average. One student with a perfect score can pull the average up to passing, even though most of the class failed.

The difference between the day and night sessions is more than the clock. The night session follows US stocks and trades lower volume than the day session, and the price often moves in larger steps, so the same breakout rule gets different slippage at night. The day session open has to absorb news from the night session and the US market, so volatility is concentrated in the first half hour. It is therefore normal for the same parameters to show different average trades in the two sessions. The question is which session your rule depends on. To test by session, the session settings in your data have to be right. Five settings to check before backtesting TAIEX futures lists the places, such as session, contract and costs, that can throw the whole result off. Another detail that is often overlooked is the night session close: which night-session close price a backtest should use explains why that choice changes the signals of a daily-bar rule.

The method is a table, not a single number:

  1. Label each trade as day session or night session by its entry time.
  2. For each year and each session, compute one cell with the average trade after costs and the number of trades, and add one more column for the combined total.
  3. Count how many cells are positive. Positive cells should be spread across most years and both sessions. For a rule concentrated in one cell, little is usually left once you take that cell out.
  4. Compare that cell with the market at the time. For example, if the night session in one year rallied in one direction, a long-only breakout rule will naturally look good in that cell, but that is the market, not the entry point.
Hypothetical seven-year by day/night grid: total average trade is +400, but only one night-session cell is positive and all other cells are near zero One cell carries the total Hypothetical: net average trade per cell Y1 Y2 Y3 Y4 Y5 Y6 Y7 Day Night ≈0 ≈0 ≈0 ≈0 ≈0 ≈0 ≈0 ≈0 ≈0 ≈0 + ≈0 ≈0 ≈0 Total +400 per trade Remove it and the edge is gone. So: most cells should be positive.
A grid of years by sessions. The combined total is positive, but only one cell is positive. A rule like this is not worth taking further.

Hypothetical example

Suppose a breakout rule has a combined average trade after costs of NT$400 over seven years, across 350 trades. Broken apart, the night session of one year alone contributes 90 trades at an average trade of NT$1,500, while the other 20 cells together average close to zero. Take out that one cell and the remaining 260 trades average only NT$20, which does not even cover costs. The combined number of this rule is real, but what it measured was the one-way night-session move of that one year.

How do you check that a TAIEX futures entry point is not overfitted?

Three checks catch most overfitting: whether the results of neighboring parameters are similar, whether the out-of-sample period is still positive, and whether the number of trades is enough. Only a rule that passes all three is worth taking further. If any one fails, treat it as a new idea and test again, instead of changing the parameters and rerunning. Overfitting means adjusting a rule until it fits the noise of one stretch of history, not behavior that repeats. It looks perfect on that history and falls apart on another stretch of data.

  1. Neighboring-parameter check. Run the lookback from 10 to 30 and plot the average trade for each value as a bar. A good result looks like a plateau: results from 16 to 26 are all about the same. A bad result looks like a single spike: only 20 is very good, while 18 and 22 are both poor. The market does not happen to know that you use 20 bars, so if only one value works, that value was almost certainly hit by luck. Parameter stability: plateau or lucky spike shows how to draw and read the full chart.
  2. Out-of-sample check. The out-of-sample period is the stretch of history you never touched while choosing the rule and adjusting its parameters. Hold back the last one or two years, and run the finished rule on them only once. It is normal for the out-of-sample average trade to be smaller than the in-sample one. It is a failure if it turns negative or is carried by a single month.
  3. Number-of-trades check. The out-of-sample period needs at least a few dozen trades to say anything, and a few hundred to be reliable. A result with 30 trades or fewer is only a hint. For a rule without enough trades, either lengthen the data, switch to smaller bars, or accept that it cannot be tested.
Average trade by lookback from 10 to 30 (illustration): on the left, a plateau where nearby values perform alike and can be trusted; on the right, a single spike surrounded by poor values, which is a coincidence Plateau or lucky spike? Illustration: average trade by lookback Plateau: trust Spike: luck Lookback 10–30 Lookback 10–30 Neighbors should look alike. So: test ±2 steps either side.
The plateau on the left can be trusted, and the spike on the right was hit by luck. The one candidate kept from the 1,024 in the earlier section also has to be checked the way this chart does before you decide whether to look at it further.

The backtest box in the third section shows why none of these three checks can be skipped. It is one candidate picked out of more than a thousand. Bailey et al. (2014) show mathematically why this matters: the more variants you try, the more likely the best in-sample result is just noise that happened to rank first, and the longer the history you need to tell it from luck. Pardo (2008) treats the neighboring-parameter check and walk-forward out-of-sample testing as standard steps for evaluating a trading system. The same logic applies to your own TAIEX futures entry point: every “perfect entry” you have spotted by looking back at a chart was already picked from many possibilities.

The order of the three checks also matters. The neighboring-parameter check does not touch the out-of-sample data, so do it first. You can see the number of trades while the backtest runs, so check it together with the first one. Leave the out-of-sample check for last, and look at it only once. If you go back and change parameters after seeing the out-of-sample result, that data has become in-sample.

You can take the next step today. Take the TAIEX futures entry point you use most, and write it as a short text using the three condition types from the first section, with every number as a range. Then do just one thing: run the main parameter two steps up and two steps down, and see whether the average trade forms a plateau or a spike. This check needs no new tool, yet it answers the question you most need answered first.

Frequently asked questions

Can a TAIEX futures entry point be backtested?

Yes, provided the entry point is written as a condition a computer can judge true or false on every bar: which price to use, how many bars to look back, which session, and which filter to add, with entry at the next bar's open once the signal is true. A statement that cannot be written as a condition (for example, “it feels like it will go up”) cannot be backtested. Once it is a condition, use a backtest that includes commission, futures transaction tax and slippage, then split it by day and night session and by year.

When is the best time to enter TAIEX futures?

No session is best for every rule, so test by session. The day session (08:45 to 13:45) and the night session (15:00 to 05:00 the next day) differ in volume, volatility and slippage, so the same entry rule usually has a different average trade in each. Split the results into a grid of day session, night session and individual years. A rule is credible when its positive cells are spread across most years and both sessions.

Which numbers show that a TAIEX futures entry signal is useful?

First check whether the average trade after costs is several times the round-trip cost. Then check whether the profit factor is clearly above 1, and then whether the number of trades is enough. The win rate alone does not tell you whether a rule is good: a rule with a high win rate but small wins can be negative after costs. When there are too few trades, the first two numbers are only hints.

How many trades does an entry point need to be tested enough?

Count trades, not years. A few dozen trades are only a hint, and an average over a few hundred trades moves less when a few trades are swapped out. A daily-bar rule often has only a few dozen trades after several years. You can lengthen the data, switch to smaller bars, or use walk-forward analysis to produce more out-of-sample trades from the same stretch of history.

If the out-of-sample result is worse than the in-sample result, is the entry point unusable?

Not necessarily. In-sample results were picked from many parameter sets, so they carry a selection bonus, and a smaller out-of-sample result is normal. It is a failure if it turns negative or is carried by a single month. Write the pass criteria before you look at the results, and do not go back and change parameters afterward, because that turns the out-of-sample data into in-sample data.

References

  • 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.
  • Taiwan Futures Exchange. Mini-TAIEX Futures. https://www.taifex.com.tw/enl/eng2/mTX