kotak-logo
Products
Platform
Research
Market
Learn
Partner
Support
IPO
TradingView Simplified Logo Light Mode

Kotak

Stockshaala

Module 7
Pine Script – Build & Backtest
Course Index
Read in
English
हिंदी

Chapter 5 | 4 min read

Backtesting Do’s & Don’ts (Bias, Interpretation, Metrics)

Backtesting helps you answer one key question:

“Would this strategy have worked in the past?”

But interpreting backtest results the wrong way can lead to overconfidence, bad trades, or strategies that fall apart in live markets.

This chapter covers:

  • What to check in your backtest report
  • What mistakes to avoid
  • How to interpret the data with a clear head

Once you run your strategy in TradingView’s Strategy Tester, you’ll see a summary. Focus on these key metrics:

Let’s call them out directly.

You tweak the settings so much that it “looks perfect” on past data—but breaks in real life.

How to avoid:
Don’t chase the best settings. Instead, look for consistently okay results across different stocks and timeframes.

You test only 10 trades, and it looks profitable.

Why it’s risky:
That could be pure luck. A strong strategy needs at least 30–50 trades over varied conditions to mean anything.

This happens when your strategy accidentally uses information that isn’t available yet for example, when it makes trading decisions using future candle data on the same bar.

How to avoid it:

  • Always base your logic on completed candles, not live ones. Example: use ta.crossover() instead of comparing price values mid-bar.
  • Be extra careful when using data from higher timeframes (like daily data on an hourly chart). Higher-timeframe data updates only after its candle closes, so it can appear to “change” on lower charts as new data comes in.

In short:
Build your strategy so it reacts only after a bar closes and uses confirmed data and not values that can still update later.

You see a ₹10,000 profit and get excited—but ignore that the strategy dropped ₹5,000 halfway through.

What to do:
Always check Max Drawdown. If the strategy takes wild swings, it may not be practical even if it's profitable on paper.

Do This Instead

Say your strategy shows:

  • Net profit: ₹12,000
  • Win rate: 48%
  • Profit factor: 1.5
  • Drawdown: ₹3,000
  • Trades taken: 60 over 6 months

That’s a solid foundation.

It’s not “perfect,” but it’s repeatable. Not based on luck, and hence leaves room to optimize position sizing, filtering, or alerts.

A backtest is a guide, not a guarantee.
Use it to validate ideas, spot weaknesses, and build confidence, but never treat it as foolproof.

Smart backtesters build good strategies.
Blind optimizers build traps.

Note: Pine Script™ is a trademark of TradingView Inc.

Is this chapter helpful?
Previous
Strategy Logic Building (Example: RSI + Supertrend)
Next
Tweaking & Using Public Pine Scripts

Discover our extensive knowledge center

Explore our comprehensive video library that blends expert market insights with Kotak's innovative financial solutions to support your goals.

PreviousCourse IndexNext