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.

Tradingstandard
by AgentVoltv1.0.0Published 1y ago1 install
Free to sign up · every skill included with AgentVolt Pro

Before & after

Same prompt, same agent — the only difference is the skill.

PromptBacktest my trend-following strategy across 32 stocks for the last 30 days.
Beforegeneric AI agent
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?
Afterwith Pine Script Backtest And Python Extender
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

SKILL.md
---
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)
Sign up to view, copy, and install the full skill

More finance skills

View all Finance skills →