NEPSE backtesting

NEPSE backtesting: test a trading strategy on Nepal's stock market

Nhuga Nepal lets you backtest rule-based strategies on more than ten years of daily Nepal Stock Exchange prices, with Nepali trading costs included. Write the rules in Pine Script v5, run them on any of 180+ instruments, and read the result as return, risk and drawdown.

What backtesting means

A backtest applies a fixed set of rules, such as “buy when the price closes above its 50-day average, sell when it closes below”, to historical prices and records every trade the rules would have made. The output is an equity curve and a set of statistics, so an idea can be judged on evidence instead of a hunch.

It is a research tool, not a forecast. It shows how a rule set behaved in the past, with hindsight, which is useful for rejecting weak ideas and for understanding how much pain a strategy can cause.

Why NEPSE needs costs and care

Trading costs in Nepal are not small. Every round trip pays broker commission, the SEBON fee and a DP charge, and profits can attract capital gains tax. A strategy that trades often can look excellent before costs and ordinary after them, so the Nhuga back-tester builds these charges into its results.

Data quality matters as well. Prices on the platform are end-of-day and unadjusted for bonus shares, which can overstate long-horizon returns. We say so on the results rather than hide it.

How the Nhuga NEPSE back-tester works

  • Pick a stock or index from 180+ instruments with more than ten years of daily history.
  • Load a ready-made strategy, or write your own in the Pine editor (Pine Script v5).
  • Describe an idea in plain words and let Nhuga AI (beta) draft the Pine code. It can make mistakes, so check the output.
  • Run the test and read the equity curve, CAGR, Sharpe ratio, drawdown, win rate and trade list.
  • Export the results to a spreadsheet for your own analysis.

How to read a backtest result

CAGR
Compound annual growth rate: the steady yearly return that would produce the same end result.
Sharpe ratio
Return per unit of volatility. Higher means the gains came with smoother swings.
Max drawdown
The largest peak-to-trough fall in the equity curve: the worst stretch an investor would have sat through.
Win rate
The share of trades that closed in profit. On its own it says little; a few big losses can outweigh many small wins.
Number of trades
How much evidence sits behind the numbers. A result built on a handful of trades is weak.

Common backtesting mistakes

  • Ignoring costs. Commission, SEBON and DP charges compound across many trades.
  • Overfitting. Tuning parameters until the past looks perfect usually produces a rule that fails on new data.
  • Too few trades. A great result from five trades is luck until proven otherwise.
  • Looking only at return. A high CAGR with a deep drawdown may be impossible to hold through in practice.
  • Trusting one stock. Check that a rule works across several instruments and market phases before believing it.

Frequently asked questions

What is NEPSE backtesting?

NEPSE backtesting means applying a fixed set of trading rules to historical Nepal Stock Exchange prices to see how the rules would have performed: the return, the risk taken and the worst losing stretch. It tests an idea on past data before any money is involved.

Can I backtest a strategy on NEPSE with Pine Script?

Yes. The Nhuga chart includes a Pine editor that accepts Pine Script v5, the language TradingView uses. You write or paste a strategy and run it over the NEPSE price history on the platform.

Do the results include transaction costs?

Yes. Back-tests include Nepali trading costs such as broker commission, SEBON fee, DP charge and capital gains tax, and can be run with either a flat per-side cost or the full NEPSE charges. A strategy that looks good before costs can look very different after them.

How far back does the NEPSE data go?

The platform holds more than ten years of daily end-of-day prices across 180+ instruments. Prices are unadjusted for bonus shares, which can overstate long-horizon returns.

Does a good backtest mean the strategy will make money?

No. A backtest shows what would have happened in the past, with hindsight. Markets change, and past performance does not guarantee future results. Treat it as research, not a prediction.

Nhuga provides research and analytics, not investment advice or trading signals. Backtested results are hypothetical and do not guarantee future performance. Nhuga is independent and is not affiliated with the Nepal Stock Exchange. Read the full disclaimer.