sobat.investor ID Home
← All articles

Education · Sobat Investor

Backtesting.

How to test a stock strategy honestly and scientifically, for retail investors on the Indonesia Stock Exchange (IDX).

Every trading strategy sounds plausible when someone tells it to you. "Buy when the price bounces off the 0.618 Fibonacci level." "Enter when RSI drops below 30." "Follow the smart money." The problem is that a plausible story and a money-making strategy are two different things. Backtesting is the bridge — or the chasm — between them.

This article explains what backtesting is, why it matters for retail investors on the Indonesia Stock Exchange (IDX), and — the part most often overlooked — how backtests can lie, and how to read them honestly.

The big picture: a backtest is an experiment, not a prophecy

A backtest, at its simplest, means taking a buy-sell rule, running it against historical price data, and calculating what would have happened had that rule been followed exactly. The result is a number — return, maximum drawdown, win rate — not an opinion.

This is what separates an evidence-based approach from market pseudoscience. A pattern that "always fits after the fact" can never be honestly tested, because there's always a new explanation for every outcome. A proper backtest forces you to commit to a rule before seeing the results, and then accept whatever comes out. It can prove your favorite strategy is actually useless — and that's a feature, not a bug.

But there's one uncomfortable truth to hold onto from the start:

A good backtest does not guarantee a good future.

Markets are non-stationary and reflexive — the rules of the game change, and the more people who trade on the same signal, the thinner its edge becomes. Even the most honest backtest only gives you a distribution of possibilities, not a certainty.

Why IDX retail investors should care

Without backtesting, you're testing a strategy with real money in real time — the most expensive way to learn there is. Backtesting gives you three things:

Reading backtest results honestly

A headline "300% profit" number means nothing without context. Here's what actually matters:

Seven traps that make a backtest lie

This is where most backtests — including the ones used to sell "miracle systems" — fall apart.

1. Overfitting (a forced-fit curve). If you tweak parameters until the results look perfect in the past, you haven't found a strategy — you've memorized history. A strategy with 10 parameters that all happen to line up almost always fails on new data. Bailey et al. (2014) even showed that impressive simulated performance is easy to achieve just by trying a small number of configurations — and the more configurations you try, the greater the chance the result is illusory.

2. Look-ahead bias. Using information that wasn't actually available at the moment the decision was made. A classic example: using that day's closing price to "decide" to buy that same morning. In the real world, you don't yet know the closing price.

3. Survivorship bias. Testing only on stocks that still exist today, ignoring the ones that were delisted or went bankrupt. Brown, Goetzmann, Ibbotson & Ross (1992) showed that survivorship bias can meaningfully inflate historical performance figures.

4. Ignoring real costs. Brokerage fees, sales tax, bid-ask spread, and slippage (the gap between the expected price and the actual execution price) can turn an apparently profitable strategy into a losing one — especially for frequent trading or illiquid IDX stocks.

5. Small sample size. A handful of trades cannot statistically distinguish skill from luck.

6. Data snooping / selection bias. Testing hundreds of parameter combinations, then reporting only the best one, without correcting for how many attempts were made. Harvey, Liu & Zhu (2016) argue that most "discovered" factors in finance research fail to hold up once this multiple-testing problem is properly accounted for.

7. Regime change. A rule that worked during a bull market, a low-interest-rate era, or a particular commodity cycle may fail completely once conditions shift. The past regime is not guaranteed to return.

IDX-specific factors that make backtests lie in particular ways

How to read a backtest without fooling yourself

Closing

Backtesting is neither a crystal ball nor a scam — it's a discipline. Used honestly, it tells you whether a strategy would have survived real market conditions, at what cost, and with what risk. Used dishonestly (tuned after the fact, stripped of costs, cherry-picked periods), it tells you nothing except what you wanted to hear.

This is the standard we hold ourselves to at Sobat Investor: state the methodology plainly, disclose the traps, and report uncertainty as it is — not as we wish it were.

References & Further Reading

The concepts in this article synthesize established quantitative finance literature, adapted to the IDX context. The list is split into sources directly cited and further reading.

Cited references

  • Bailey, D. H., Borwein, J. M., 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.
  • Brown, S. J., Goetzmann, W. N., Ibbotson, R. G., & Ross, S. A. (1992). Survivorship Bias in Performance Studies. Review of Financial Studies, 5(4), 553–580.
  • Harvey, C. R., Liu, Y., & Zhu, H. (2016). … and the Cross-Section of Expected Returns. Review of Financial Studies, 29(1), 5–68.
  • Lo, A. W. (2004). The Adaptive Markets Hypothesis: Market Efficiency from an Evolutionary Perspective. Journal of Portfolio Management, 30(5), 15–29.
  • López de Prado, M. (2018). Advances in Financial Machine Learning. Hoboken: Wiley.
  • Sharpe, W. F. (1994). The Sharpe Ratio. Journal of Portfolio Management, 21(1), 49–58.
  • Sullivan, R., Timmermann, A., & White, H. (1999). Data-Snooping, Technical Trading Rule Performance, and the Bootstrap. Journal of Finance, 54(5), 1647–1691.

Further reading

  • Bailey, D. H., & López de Prado, M. (2014). The Deflated Sharpe Ratio: Correcting for Selection Bias, Backtest Overfitting and Non-Normality. Journal of Portfolio Management, 40(5), 94–107.
  • Brock, W., Lakonishok, J., & LeBaron, B. (1992). Simple Technical Trading Rules and the Stochastic Properties of Stock Returns. Journal of Finance, 47(5), 1731–1764.
  • Chan, E. P. (2021). Quantitative Trading: How to Build Your Own Algorithmic Trading Business (2nd ed.). Hoboken: Wiley.
  • Fama, E. F. (1970). Efficient Capital Markets: A Review of Theory and Empirical Work. Journal of Finance, 25(2), 383–417.
  • Harvey, C. R., & Liu, Y. (2014). Evaluating Trading Strategies. Journal of Portfolio Management, 40(5), 108–118.
  • White, H. (2000). A Reality Check for Data Snooping. Econometrica, 68(5), 1097–1126.

This article is educational and does not constitute investment advice. Investment decisions and their risks are entirely your own responsibility. Past performance does not guarantee future results.