100-Day Trade Challenge: trade on our AI predictions, up to 2 trade ideas a day. Free · educational · unregulated & risky Create free account
Cryptos: 21,748 Exchanges: 1,506 Market Cap: $2.87T 2.73% 24h Vol: $100.49B Dominance: BTC: 58.3% ETH: 11.4% Fear & Greed: 74/100 USD/INR: ₹95.83
Trading

How to Backtest a Crypto Trading Strategy for Free

Backtest a crypto strategy free on TradingView, in a spreadsheet or with Freqtrade, avoid the mistakes that fake good results, then paper trade first.

How to Backtest a Crypto Trading Strategy for Free
Photo: Jccsvq, CC0, via Wikimedia Commons

To backtest a crypto trading strategy, write its rules so precisely that a computer could follow them, run them over past price data, subtract realistic fees and slippage, and judge the result on at least about 100 trades. You can do this free with TradingView's strategy tester, a spreadsheet or open-source tools such as Freqtrade. Then paper trade the same rules on live prices, because backtests nearly always look better than real trading.

Key takeaways

  • A backtest can cheaply reject a bad idea. It cannot prove that a strategy will make money in future.
  • TradingView's free Basic plan includes the strategy tester with 5,000 bars of history; paid plans add more bars and deeper reports.
  • The biggest traps are look-ahead bias, overfitting, ignoring costs, survivorship bias and too few trades.
  • About 100 trades is a sensible minimum sample. Over 20 trades, luck alone makes a coin flip look like a 65% strategy about one time in eight.
  • After the backtest, paper trade or use a testnet, then go live with tiny size. Most retail strategies lose money after costs.

What backtesting tells you, and what it cannot

Backtesting replays history and asks one question: if I had followed these exact rules, what would have happened? A useful report shows the number of trades, win rate, average win and average loss, net result after costs, expectancy (the average result per trade) and maximum drawdown (the deepest fall from a peak in your account).

If a strategy loses money even in a backtest, where nothing is at stake and no emotion gets in the way, it will almost certainly lose live. The reverse is not true. A profitable backtest is only a starting point, because markets change and because backtests overstate results for the reasons set out below. For rule sets worth testing, see our list of free crypto algo trading strategies.

Step 1: write rules a computer could follow

"Buy when it looks strong" cannot be tested. Every rule needs a number. Here is an example for a simple trend rule on Bitcoin; it shows the format and is not a recommendation:

RuleExample
Market and timeframeBTC perpetual futures, four-hour candles
EntryGo long when the 20-period moving average closes above the 50-period average
ExitClose when the 20 closes back below the 50, or at the take-profit
Stop-loss2% below entry, placed at the moment of entry
Take-profit4% above entry, twice the risk
Position sizeRisk ₹200 per trade, so a 2% stop gives a ₹10,000 position
CostsFees on entry and exit, 18% GST on those fees, slippage and funding
When not to tradeNo new trade while a position is open

If you cannot write a rule as a number, you will end up picking trades by feel while testing, and the result will mean nothing.

Free way 1: TradingView's strategy tester

On TradingView, a "strategy" is a Pine Script program that places simulated orders on the bars of your chart. The strategy report below the chart shows net profit, total closed trades, percent profitable, profit factor, maximum drawdown and average trade. Many built-in and community strategies are available from the indicators menu.

  1. Open a chart of the exact market you plan to trade, on the timeframe your rules use.
  2. Add a strategy from the indicators menu, or write your own in Pine Script.
  3. Open the strategy's settings and, under properties, set the initial capital, order size, commission (for example a percentage per order, applied to entries and exits) and slippage (ticks added to the fill price of market and stop orders).
  4. Read the report, then change the date range or symbol and see whether the result holds.

Menus change from time to time, so the labels in your version may differ slightly. Your plan decides how much history you get:

TradingView planHistorical barsStrategy report
Basic (free)5,000Basic report metrics
Essential10,000Advanced metrics and CSV export of trades
Plus10,000Advanced metrics and CSV export of trades
Premium20,000Adds Deep Backtesting
Ultimate40,000Adds Deep Backtesting

On the free plan, 5,000 bars cover about 208 days of one-hour candles, about 2.3 years of four-hour candles, but only about 52 days of 15-minute candles. That is plenty for a slow strategy and thin for a fast one. Deep Backtesting, on Premium and higher, runs the strategy over all available history for a symbol within a date range you choose. Also check that the chart's data comes from the exchange and market you will trade, because prices differ slightly between exchanges and between spot and futures.

Two cautions. Community scripts can repaint, which means their past signals were drawn with information that was not available at the time, so read the code or forward test before trusting a smooth equity curve. And if the commission field is left at zero, a strategy that trades often will look far better than it really is.

Free way 2: the spreadsheet method

A spreadsheet is slower, but it needs no subscription or code, and it teaches you exactly what a backtest does.

  1. Get candle data (date, open, high, low, close) for your market and timeframe, for example by exporting it from a charting tool or downloading an exchange's public price history. Put one candle per row, oldest first. Our guide to reading candlestick charts explains the four prices.
  2. Add a column for each indicator, such as a 20-row and a 50-row average of the close.
  3. Add a signal column that uses only the current row and rows above it. Never refer to a row below.
  4. Enter at the next candle's open, not the signal candle's close, because in real life you only know the close once the candle has finished.
  5. For each open trade, compare every later candle's low with the stop and its high with the target. If both are hit in the same candle, assume the stop was hit first.
  6. Record every trade: entry, exit and result in rupees after costs.
  7. Summarise: number of trades, win rate, average win, average loss, expectancy and maximum drawdown.

Here is a worked summary with made-up numbers to show the maths. You have 100 trades: 40 winners averaging ₹400 and 60 losers averaging ₹200. The gross result is ₹16,000 minus ₹12,000, which is ₹4,000. Now assume costs of ₹25 a trade for fees, GST and slippage (check your own exchange's fee screen): that is ₹2,500. The net result is ₹1,500, an expectancy of just ₹15 a trade. Double the costs and the edge is gone. This is why so many strategies that look fine before costs lose money after them.

On Indian spot exchanges, 1% TDS is also deducted on each qualifying sale. It is not a cost, because it counts towards your tax, but it ties up cash: 100 sells of ₹10,000 each move ₹10,000 into your tax account, which you only get back through your return. Our crypto tax calculator shows the effect.

Free way 3: open-source backtesting tools

ToolLicenceWhat it offersThings to know
FreqtradeFree, GPL-3.0A Python bot with backtesting, parameter optimisation (hyperopt), a look-ahead analysis command and a dry-run mode for paper tradingNeeds Python 3.11 or newer. Its README says to always start in dry-run. No Indian exchange is officially supported.
BacktraderFree, GPL-3.0A Python library for backtesting with a simulated brokerIts built-in live connections are to brokers such as Interactive Brokers and Oanda, so for crypto it is mainly a research tool.
JesseOpen source, MITA crypto framework for backtesting and researchThe free version trades live only on exchange testnets; live trading on real exchanges needs a paid licence.

These tools need some coding. Several exchanges they support are offshore platforms; OKX, for example, no longer serves Indian users, and FIU-IND has issued notices to others for serving Indians without registration. Testing on their price history is harmless, but trade live only on exchanges registered with FIU-IND. Our guide to free crypto trading bots in India compares these and other options.

The mistakes that make backtests lie

MistakeWhat goes wrongHow to avoid it
Look-ahead biasThe test uses data that did not exist yet, such as a candle's close to enter at its openSignal on closed candles and enter on the next one; Freqtrade has a look-ahead analysis command
OverfittingYou tweak settings until the past looks perfect, and the "edge" is only noiseKeep rules few. Build on the first 70% of the history and test once on the untouched last 30%
Ignoring costsFees, GST on fees, slippage and funding are left outAdd all of them, then add a margin for error
Survivorship biasYou test only coins that are popular today and ignore those that collapsed or were delistedPick the coin list as it stood at the start of the test period
Too few tradesTwenty lucky trades look brilliantAim for at least 100 trades across different market phases
One market phaseThe test covers only a bull run, when almost any long strategy winsInclude a falling market and a sideways period
Unrealistic fillsLimit orders count as filled the moment price touches themCount a fill only when price trades through your level, and add slippage to market and stop orders

How many trades do you need?

There is no magic number, but about 100 trades is a sensible minimum before taking a result seriously. The reason is luck. Imagine a strategy with no edge at all, where every trade is a coin flip that wins or loses the same amount. Over 20 trades, it shows a win rate of 65% or better about 13% of the time, roughly one run in eight. Over 100 trades, the chance of 65% or better falls below 0.2%.

Put another way, after 100 trades your measured win rate can still be about 10 percentage points away from the true figure in either direction; after 20 trades the band is more than twice as wide. Even 100 trades gives no statistical guarantee. More is better, and the trades should come from different conditions rather than one hot month. Our article on telling edge from luck goes deeper.

Step 2: paper trading and testnets

A backtest shows how the rules did in the past. Paper trading tests them on prices nobody has seen yet, and it tests your execution too: slow alerts, bugs and missed signals. These options cost nothing:

OptionWhat it isWhat to watch
TradingView paper tradingSimulated orders on live charts, on every plan including the free oneFills are idealised; good for practising rules by hand
Freqtrade dry-runThe bot runs on live data but places no real ordersClose to real behaviour, but still no real fills
Binance testnet and demo modeA spot testnet at testnet.binance.vision with test keys, and a demo mode that includes futures demo tradingTestnet order books are not the real market, so fills can look better or worse than live
Delta Exchange India demoA demo account at demo.delta.exchange; demo API keys work only on the testnetUseful for testing a bot's orders, stops and error handling end to end

Run the paper version until it has produced a meaningful number of trades, then compare it with the backtest. If the paper results are much worse, the backtest probably contained one of the biases above. Automating a strategy does not improve it: a bot repeats the rules, mistakes included, faster than you could by hand. For bot builders, a testnet is where you check the whole chain from signal to signed order to an exchange-side stop; our guide on how crypto trading bots place trades walks through that chain.

Step 3: go live small and keep an honest score

  1. Use an exchange registered with FIU-IND; our list of FIU-registered exchanges helps you check.
  2. Start with the smallest size the exchange allows, for example risking ₹50 to ₹100 a trade instead of the planned ₹200.
  3. Place the stop-loss on the exchange at the moment of entry.
  4. If a bot trades for you, give its API key trading permission only and never withdrawal permission, bind it to your server's IP address where the exchange allows it, store the secret like a password and delete unused keys. Never paste a secret into Telegram, WhatsApp, a Google Form or a website you do not trust, and treat anyone who promises guaranteed returns from a bot in exchange for your key as a scammer.
  5. Log every trade, and compare win rate, net result and expectancy with the backtest and the paper run.
  6. Set a stop rule in advance: if the live drawdown goes beyond the backtest's worst drawdown, stop and review.

If you want a ready-made honest record while you practise, our free 100-Day Trade Challenge keeps a scorecard of win rate, net result and expectancy for rules-based trade ideas that you choose to place yourself on your own exchange. It does not guarantee any profit. Whatever you use, remember that crypto gains are taxed at a flat 30% plus 4% cess and losses cannot be set off against other income or carried forward, so losing trades during live testing bring no tax relief. For the full path from idea to automation, read our crypto algo trading guide for beginners.

FAQ

How can I backtest a crypto strategy for free?

Use TradingView's strategy tester on the free Basic plan, a spreadsheet with downloaded candle data, or a free open-source tool such as Freqtrade or Backtrader. Always include fees and slippage in the test.

Can I backtest on TradingView's free plan?

Yes. The free Basic plan includes the strategy tester with basic report metrics and 5,000 historical bars; advanced metrics, trade export and Deep Backtesting need paid plans.

How many trades are enough for a backtest?

Aim for at least about 100 trades spread across different market conditions. With 20 or 30 trades, luck can easily make a strategy with no edge look good.

What is the difference between backtesting and paper trading?

Backtesting runs your rules on past data, while paper trading runs them on live prices with simulated money. Paper trading catches problems a backtest hides, such as look-ahead bias and execution delays.

Can I paper trade crypto in India?

Yes. TradingView offers paper trading on every plan, Delta Exchange India has a demo account, and Binance has a spot testnet and a demo mode, though none of them fills orders exactly like the real market.

Why do strategies that backtest well fail in live trading?

Usually because of overfitting, look-ahead bias, underestimated costs or too few trades in the test. Markets also change, so an edge from one period can vanish in the next.


This article is AI-assisted, educational and general in nature. It is not financial advice and never a guarantee of profit. Every trade is at your own risk on your own exchange. See our risk disclosure and editorial policy.

Put it into practice

Run the 100-trade challenge: cap every loss, log every trade, and find out honestly whether you have an edge.