Why Backtest Pine Script Outside TradingView?
TradingView's built-in Strategy Tester is a powerful tool, but it has limitations that frustrate serious traders. The free and Pro tiers restrict the number of bars available for backtesting, which means strategies tested on shorter data windows may produce misleading results. Premium tiers that unlock longer history cost $60–$155 per month.
StratReplay solves this by running your Pine Script strategy against Yahoo Finance data, which provides decades of daily OHLCV history for most tickers — completely free. You can backtest a moving average crossover strategy on Apple stock going back to 1980, or test a crypto momentum strategy on Bitcoin from its earliest available data.
Additionally, StratReplay lets you test your Pine Script strategies on tickers that TradingView may not have on your plan, and it gives you a clean, exportable performance report that you can share or reference later.
How to Backtest Pine Script on StratReplay
EXPORT YOUR PINE SCRIPT
In TradingView's Pine Editor, copy your strategy code and save it as a .pine file on your computer. Make sure it uses strategy() rather than indicator() at the top.
UPLOAD TO STRATREPLAY
Click the Pine Script upload area on the StratReplay homepage and drop your .pine file. The parser will extract your strategy's signals, inputs, and parameters automatically.
REVIEW PARSED INPUTS
StratReplay displays all configurable inputs from your strategy (moving average lengths, RSI thresholds, etc.) so you can adjust them without editing the source code.
SET TICKER AND PARAMETERS
Enter the ticker symbol you want to test (e.g., AAPL, BTC-USD, SPY), set your initial capital, commission rate, and stop-loss percentage.
RUN AND ANALYSE
Click Run Backtest. Within seconds you'll see an equity curve, drawdown chart, Sharpe ratio, win rate, and a full trade-by-trade log.
What Pine Script Features Are Supported?
StratReplay's Pine Script parser supports the most common strategy patterns used in TradingView scripts. Here is what is currently supported:
Supported: strategy.entry() and strategy.close()
StratReplay detects strategy.entry() calls for both long and short entries, and strategy.close() calls for exits. It correctly handles directional entries (long/short) and maps them to buy/sell signals on the daily bar.
Supported: Input Variables
All input.int(), input.float(), input.bool(), and input.string() declarations are parsed and exposed as editable fields in the StratReplay UI. You can change these values before running the backtest without touching the .pine file.
Supported: Common Built-in Indicators
The parser recognises common Pine Script built-in functions including ta.sma(), ta.ema(), ta.rsi(), ta.macd(), ta.bbands(), ta.crossover(), and ta.crossunder(). These are translated into equivalent signal logic for the backtest engine.
Limitations
StratReplay does not support Pine Script strategies that rely on external data feeds, custom security() calls, or real-time tick data. Strategies that use request.security() to pull data from other symbols will display a warning. Intraday strategies (using timeframes shorter than 1 day) are not currently supported.
Example: A Simple Moving Average Crossover
Here is an example of a Pine Script strategy that StratReplay can parse and backtest. This is a classic dual moving average crossover strategy:
//@version=5
strategy("SMA Crossover", overlay=true)
fastLength = input.int(10, title="Fast MA Length", minval=1)
slowLength = input.int(50, title="Slow MA Length", minval=1)
fastMA = ta.sma(close, fastLength)
slowMA = ta.sma(close, slowLength)
if ta.crossover(fastMA, slowMA)
strategy.entry("Long", strategy.long)
if ta.crossunder(fastMA, slowMA)
strategy.close("Long")Upload this file to StratReplay, set the ticker to SPY, and you will immediately see how this strategy performed on the S&P 500 ETF over the past 20 years — including the 2008 financial crisis, the 2020 COVID crash, and the 2022 bear market.
StratReplay vs TradingView Strategy Tester
| Feature | StratReplay | TradingView (Free) |
|---|---|---|
| Price | Free | Free / $60–$155/mo |
| Historical bars | Full Yahoo Finance history | Limited on free tier |
| Ticker coverage | All Yahoo Finance tickers | TradingView coverage |
| Input editing | Yes, in-browser | Yes, in Pine Editor |
| Equity curve | Yes | Yes |
| Sharpe / Sortino | Yes | Yes (Premium) |
| Trade log export | Yes (CSV) | Yes (Premium) |
| Account required | No | Yes |
Frequently Asked Questions
Does my Pine Script need to use strategy() or indicator()?
StratReplay works best with Pine Script files that use strategy() at the top, as these contain explicit entry and exit calls. Files using indicator() may work if they contain strategy.entry() calls, but pure indicator scripts without entry/exit logic cannot be backtested.
Which version of Pine Script is supported?
StratReplay supports Pine Script v4 and v5 syntax. Most modern TradingView strategies use v5, which is the default when you create a new strategy in TradingView's Pine Editor.
Can I test on multiple tickers at once?
Currently, each backtest runs on a single ticker. You can run multiple backtests in sequence by changing the ticker symbol in the configuration panel and clicking Run Backtest again.
Test Your Pine Script Strategy Now
Upload your .pine file and get results in seconds. Free, no account required.
BACKTEST PINE SCRIPT FREE →