How to backtest a crypto chart pattern: 5 ways compared

Compare five ways to test crypto chart patterns, with real Bitcoin results showing why later dates and trading costs change the answer.

You can backtest a crypto chart pattern with a spreadsheet, Python, TradingView, TrendSpider or a past-case search like Comparand, as long as you fix the rules first and then test them again on later dates you kept aside. That second test is the one that matters. The ways differ in what they show: a spreadsheet shows every case, Python can run any rule you can write over long histories, TradingView simulates orders on one market at a time, and a past-case search shows what followed similar charts but not a rule's entries and exits.

A backtest applies trading rules to past prices. A bar records the open, high, low and close over a set time. A perpetual (perp) is a futures contract tied to a coin's price that never expires.

For what happened when we tested a chosen rule on later dates, see Overfitting in trading backtests.

Which way of testing fits you?

Which way of testing fits you?
Way Effort Cost What it can show What it cannot show by itself
Spreadsheet High per case Free if you already have one Every case and your reason for counting it Many cases quickly
Python with pandas Coding needed Free libraries; data and computing extra Any rule you can write, over long histories Fees and trade prices unless you code them
TradingView Strategy Tester Pine coding Free Basic plan; Deep Backtesting needs Premium or higher Simulated orders on one market at a time Results beyond the history your plan and market have
TrendSpider No-code Paid plans; 14-day trials from $19 Strategy tests built from menus Standard plan tests start at 2-hour bars
Comparand past-case search Ask a question $0.01 per search Similar past charts of the same coin and what followed Entries, exits and costs of a rule

Each row comes from the tool's own guides or pricing pages. We did not test the tools against each other.

What should you decide before testing a pattern?

Write down every choice that could change your result:

  • The coin, exchange, contract type and bar size.
  • What makes a chart count as the pattern.
  • When each test trade starts and ends, and how big it is.
  • The fees and other costs you will include.
  • The later dates you will keep hidden while choosing the rules.

Make the rule clear enough for someone else to follow. Count the cases where the pattern appeared but the expected move did not.

Use only prices known at the time of each decision. If your rule needs a bar's close, the decision waits until that bar ends. Our look-ahead bias example shows how breaking this rule changes a result.

Completed bars before the test decisionIllustration with six abstract completed price bars. A boundary separates known bars from hidden later prices. Read closed bars, fix the rules and make the test decision, then reveal later prices and evaluate with the rules unchanged. No measured prices are shown.ILLUSTRATION / DECISION TIMINGFix rules before revealing later pricesOnly completed bars can inform a decision.COMPLETED BARSLATER PRICESHidden until rules fixedRead closed barsNo later pricesTest decisionFix rules firstReveal & evaluateKeep rules unchangedMethod: Binance BTCUSDT perp, 1h; schematic, no dates/casescomparand.xyz
Completed bars before the test decision

Can a spreadsheet test a crypto chart pattern?

Yes. Make one row per case that meets your rule. Record the market, time, why it counts, the test trade prices, the costs and the result.

Move through the chart in time order with later prices hidden, and decide whether a case counts before you reveal what follows.

Every choice is easy to check, but the work grows fast with more cases.

When does Python with pandas help?

Python is a programming language. pandas is a free set of tools for working with tables and dates. Its overview describes ways to line up times and calculate values over moving stretches of data.

You can apply one rule across years of prices, but you write the rule, trade timing and cost math yourself. pandas is not a price archive and does not simulate trade prices for you.

Python and pandas are free (Python's license, pandas' About page), but data and computing can cost money. If you download bars with the CCXT library, its backtesting guide explains the many requests and exchange limits involved.

What does TradingView's Strategy Tester show?

Pine is TradingView's programming language. The Pine strategies guide says strategies simulate orders with a broker emulator, and Strategy Tester shows the results. Each strategy runs on one market at a time.

Bar Replay is the manual option: it reveals past chart movement bar by bar so you can practice deciding before you see what comes next. See Comparand vs TradingView for how the two tools differ.

What can TrendSpider test without coding?

TrendSpider lists no-code strategy testing on its pricing page. You build conditions with menus instead of code.

The same page lists 2 hours as the smallest backtest bar size on the Standard plan, so it could not repeat our hourly Bitcoin test on that plan.

Its Group Strategy Tester tests each market separately; it does not model one shared pool of money split between them. TrendSpider's store also lists Analog Path Projection. It searches a market's own past for similar price episodes, then draws a cone and a median path from them. Its listing did not show a current price.

Where does a Comparand past-case search fit?

Comparand answers a narrower question: which past charts of this same coin, on this same exchange and bar size, looked like this one, and what happened next? You get each case's price path and later moves. There is no average or success rate. These are past cases, not a forecast.

Use it to see how mixed past outcomes were before you write a rule. In our look-alike test, following the matches did not beat always guessing up. To test a rule itself, you still need entries, exits, costs and trade prices from one of the other ways above.

What happened when we tested a selected rule on later dates?

We made 1,000 random rules. Each one either followed or bet against Bitcoin's move over a past stretch of 1 to 240 hours. We picked the best one by its after-fee Sharpe score on the earlier dates only. The Sharpe score compares average return with how much returns jumped around. Then we froze that rule and ran it on the later dates.

What happened when we tested a selected rule on later dates?
Test period (UTC) Hourly returns measured Before fees After fees Largest fall from a peak, after fees
September 8, 2019 to January 1, 2023 (used to pick the rule) 29,046 +544.51% +155.22% −60.22%
January 1, 2023 to October 1, 2026 (kept aside) 32,856 +42.96% −51.72% −76.83%

The counts are hours, not trades. The last column is the drawdown: the biggest drop from an earlier high in the test balance.

Even the earlier "winner" fell 60.22% along the way. On the later dates, the rule still made money before fees but lost about half after fees. It changed position often: over the later period, fees added up to 108.5% of the position size.

The other rules did no better. On the later dates, only 1% of the 1,000 rules had a positive after-fee Sharpe score. The middle rule lost 83.26% after fees, and the best one made just +1.62%.

These were simple random rules, not named chart patterns. This shows how a picked rule can fail on new dates; it does not prove all patterns fail. Picking rules that fit old results too closely is called overfitting. Read more in our random-rule experiment.

What is one check you can add to your own test?

Add up your fees as a share of position size. Count every time your test trade starts, stops or flips, and multiply by your fee per side. If that total is near or above your gain before fees, small cost changes can flip the result, as in our later test period.

How we measured this

We used Binance BTCUSDT perpetual hourly prices, with returns from September 8, 2019, 18:00 UTC, up to October 1, 2026. We made 1,000 rules from a fixed random seed, chose the best by after-fee Sharpe through 2022, and froze it for 2023 through September 2026. Decisions used only earlier completed bars, at the latest close. We charged 0.05% per side whenever the test trade changed size or direction. We left out funding payments, borrowing, bid-ask gaps and slippage, so real results could differ.

Try this in Comparand

With an AI app connected to Comparand, you can ask:

  • "Here are my Hyperliquid fills. How did each one do 30 seconds later?" hl_fills_markout checks fills (your completed trades) that you supply, up to 5,000 per call, each with coin, time, price, buy or sell side and fee. It costs $0.30 per 1,000 fills, minimum $0.02 per call. It checks your real trades, not every chart-pattern case.
  • "Give me download links for Hyperliquid's 5-minute bars on the days I pick." hl_bulk_link returns signed links to whole archive files for your own spreadsheet or Python test. Each link lasts 24 hours and allows 5 downloads. Plans include 40, 200 or 800 GB of links a month; pay-as-you-go pays $0.15 per GB.
  • "Find similar past Hyperliquid Bitcoin moments at these 100 times, with what followed over the next hour." hl_analogs_batch runs up to 100 searches in one call. Each returns separate past cases from Bitcoin's own Hyperliquid history, their 1- or 4-hour outcomes, and the data behind them. Each search that runs costs $0.01; refused searches are free.

You can try 3 coins free to look at past cases. See the docs for access and limits.

The short version

  • Fix your pattern rule, trade timing and costs before you look at results, and count the cases that failed.
  • Spreadsheets suit careful records, Python suits custom tests, and TradingView and TrendSpider have built-in strategy tests.
  • Keep later dates aside and run the unchanged rule on them: our best of 1,000 rules went from +155.22% to −51.72% after fees.
  • Add up fees as a share of position size, and report drawdowns too.
  • Use past-case search to see how mixed outcomes were, then run a full test before judging a rule.

Questions people ask

How do you backtest a crypto chart pattern?

Write down exactly what counts as the pattern, when each test trade starts and ends, and what it costs. Test those rules on older prices, then run the same rules, unchanged, on later dates you kept aside.

Can I backtest crypto patterns without coding?

Yes. You can log cases by hand in a spreadsheet while hiding later prices, use TradingView's Bar Replay for manual practice, or use TrendSpider's no-code strategy testing.

Is a past-case search a full backtest?

No. A past-case search shows similar old charts and what happened next. A full backtest also needs rules for entries and exits, costs, and the prices those trades could really get.

Does a profitable backtest prove a chart pattern works?

No. In our test, the best of 1,000 random rules on Binance BTCUSDT gained 155.22% after fees from 2019 to 2022, then lost 51.72% after fees from 2023 to September 2026 with the rules unchanged.

Read next