Portfolio backtesting beyond TradingView
TradingView is well suited to charting and prototyping an idea on a single ticker. When you want to test rules across a whole portfolio of stocks, ETFs, coins, futures or forex, you hit limits that TradingView’s own Pine Script documentation states plainly:
- One chart at a time. TradingView’s strategies FAQ says: “Each Pine Script strategy runs on one dataset at a time.” You can’t naturally rank 500 stocks each evening, allocate one shared pool of cash to the top 10, enforce sector or position limits, or rebalance a multi-strategy portfolio.
- Cross-symbol call limits. Pine Script’s limitations page states that a script can make “up to 40 unique calls” to
request.*()functions (or 64 on the Ultimate plan), which rules out testing a 500-stock index universe on one chart. - Repainting and look-ahead hazards. TradingView’s page on repainting notes that repainting “invalidates backtesting results”, and that one common way of requesting higher-timeframe data “will return data from the future on historical bars”.
Rearview is a native Mac app built specifically for whole-portfolio backtesting, where ranking hundreds or thousands of securities, sharing one pool of cash, handling delisted stocks and checking for luck are the core design rather than workarounds.
Moving a strategy from Pine Script to Rearview
A Rearview strategy states its universe, indicators, entry and exit rules, ranking and sizing in one short plain-text file evaluated across every security in the universe at each close:
| TradingView (Pine Script) | Rearview |
|---|---|
| One chart symbol | universe members("SP500") (point-in-time index constituents, or any list of tickers) |
request.security("SPY", "1D", close) | close("SPY") |
ta.sma(close, 200), ta.rsi(close, 2) | sma(close, 200), rsi(close, 2) |
ta.highest(high, 30), ta.lowest(low, 20) | highest(high, 30), lowest(low, 20) |
close[1] | close[1] |
strategy.entry("Long", strategy.long) when condition holds | enter long when <condition> |
strategy.close("Long") when condition holds | exit long when <condition> (or exit when <condition>) |
| No native cross-sectional portfolio ranking | rank by -rsi(close, 2) (highest score gets free slots first) |
| Fixed order qty / % of single-symbol equity | size 10% of equity, max 10 positions (shared cash across the whole portfolio) |
strategy.exit(..., stop=..., trail_points=..., trail_offset=...) | stop 8%, stop 3 x atr(20), trail 10% |
Tracking bar_index with strategy.close(...) | max bars 10 |
input.int(10, minval=5, maxval=20, step=5) | param rsi_entry = 10 in 5..20 step 5 |
| Separate chart per strategy | a portfolio file: two to eight strategies in fixed sleeves or one shared pool of cash |
This table is written from TradingView’s public documentation and hasn’t yet been checked by running the same strategies side by side in both tools. If a line is wrong, tell us.
See the one-page language reference and 42 complete example scripts.
What works differently
- No repainting and no look-ahead. Every rule sees only what was known at that bar’s close and fills at the next session’s open by default (
fill next_open). Before every release, Rearview replays its entire pipeline across 10,924 cut-date runs (including splits, dividends, delistings, index changes and intraday sessions) and verifies every decision before each cut comes out identical. See How Rearview is checked. - Your own data, survivorship-free when you’re ready. TradingView includes bundled chart data inside its subscription. Rearview doesn’t resell data: you pay for the software once with no subscription (see Pricing) and bring your own CSV data. Start with the included 10-year synthetic sample data or free per-symbol CSVs, then use a survivorship-free source with delisted stocks and historical index membership (such as Sharadar or Norgate Data) before trading real money.
- Checking whether a result is luck. Every search counts all variations tried (including earlier manual runs, previews and CLI runs) and reports the Deflated Sharpe Ratio and Probability of Backtest Overfitting with a plain verdict: probably not luck, can’t tell, or probably luck. You can also test a single run against 500 random-entry baselines, run stress tests (costs doubled, signals a day late, 20% missed entries), and hold back recent years in a sealed lockbox. See Is this result luck? or try the Deflated Sharpe calculator.
- Local and private. Everything runs natively on your Mac (Apple silicon, macOS 26 or later) with no cloud account, no telemetry and plain-text scripts that live in your own git folder.
Try it free for 30 days
The 30-day trial includes every feature, starts at your first backtest, scan or check, and needs no card. Download Rearview or see How Rearview compares.
Sources
Read on 23 October 2026: TradingView strategies FAQ, limitations and repainting.
Product names belong to their owners. Rearview isn’t affiliated with or endorsed by them.