Pine Script Backtest And Python Extender
Ask Claude to write your strategy into TradingView Pine Script for a first backtest, then rewrite it in Python to backtest across your full watchlist.
Before & after
Same prompt, same agent — the only difference is the skill.
I can help you backtest your trend-following strategy. TradingView's Pine Script is a good starting point for initial testing, but if you want to test across a large watchlist, Python might be a better option. You'd need to provide me with your strategy rules, the list of stocks you want to test, and details like your starting capital and risk per trade. I could write some code to pull historical data and run the backtest, though the exact approach would depend on what data sources you have available. What are your specific strategy rules?
PINE SCRIPT PHASE: Single-Ticker TradingView Backtest Strategy: 20-period SMA crossover, long-only Ticker: MU (Micron) Period: 30 days Capital: 10,000 dollars Results: - Trades: 3 - Win rate: 66% - Total P&L: 450 dollars - Max drawdown: 8% - Profit factor: 2.1 PYTHON PHASE: Multi-Ticker Backtest (32 stocks) Watchlist: MU, NVDA, TSLA, AAPL... (32 tickers) Data source: yfinance (OHLCV, last 30 days) Capital allocation: 313 dollars per stock (10,000 / 32) Risk per trade: 1% per position RESULTS SUMMARY Total trades: 48 across all stocks Win rate: 54% Total P&L: 892 dollars Top 5 winners: NVDA +245, TSLA +198, AAPL +167, AMZN +142, MSFT +108 Bottom 3 losers: INTC -67, AMD -54, QCOM -31 Max drawdown (portfolio): 12% Profit factor: 1.8 CSV export: backtest_results_2026_07_31.csv (ready for further analysis)
About this skill
name: pinescript-backtest-python-extender description: Ask Claude to write your strategy into TradingView Pine Script for a first backtest, then rewrite it in Python to backtest across your full watchlist.
Pine Script Backtest And Python Extender
What This Does
The creator backtests his trend-join-long rules on MU and the Mag 7 in TradingView Pine, then hits the Pine limits and tells Claude to switch to Python to backtest across a 32-ticker watchlist over the last 30 days. Portfolio result: 54 percent win rate and a positive total P&L that Pine couldn't produce.
What You Get
- Pine Script strategy from natural language
- TradingView backtest metrics (P&L, drawdown, profit factor)
- Python fallback for large watchlists
- per-ticker P&L breakdown
- top-10 winners table
Customize
- watchlist: list of tickers
- period: how many days back to test
- timeframe: 5m, 15m, 1d
- capital: starting equity
- per_trade_risk: percent risked per trade
Sample Output
Backtest returns 14 trades on MU with total P&L of 1,200 dollars, profit factor 2.48, then Python rerun on 32 tickers returns 54 percent win rate over 30 days.
Target Audience
Systematic traders needing repeatable multi-ticker backtests
SKILL.md preview
---
name: pinescript-backtest-python-extender
description: Use when a trading strategy needs a first backtest in TradingView Pine Script, then a rewrite in Python to backtest across a full multi-ticker watchlist.
version: 1.0.0
category: Trading
author: AgentVolt
license: proprietary
tags:
- trading
- standard
---
# Pine Script Backtest And Python Extender
Writes a strategy into Pine Script for an initial backtest, then rewrites the same logic in Python to backtest across a full watchlist once Pine's per-script limits are hit.
## When to use
… (sign up to view the full skill)More finance skills
View all Finance skills →Indian Stock Fundamental Analyzer
Give Claude a stock ticker and horizon and get a full clickable fundamental report tuned to the Indian market.
Trend Join Long Strategy Filter
Take the morning gapper list and filter it against a strict five-condition trend-continuation entry template on TradingView through Claude.
Telegram Trade Alert Router
Wire your scanner outputs into a personal Telegram bot so pre-market gappers and strategy hits arrive on your phone all day.
TradingView MCP Live Chart Reader
Connect Claude Code to TradingView desktop via the Trading View MCP so Claude reads live chart code, switches timeframes, and adds indicators on command.