agentleFS
udaydeep1992udaydeep1992/pinescript-agents-antigravity/skills/pine-backtester/SKILL.md

pine-backtester

Skill0 starsChanged 41 days agoMITView on GitHub

Analyzes TradingView strategy backtest results, exported trade lists, and performance metrics. Calculates risk-adjusted returns (Sharpe, Sortino, Calmar), expectancy, drawdown periods, trade distributions, and benchmark comparisons. Use when evaluating strategy profitability, testing metrics, or analyzing trade CSV logs.

2 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

4 rules. About 0 are common, 3 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    CRITICAL: Always clearly distinguish between:

    line 22
  2. Distinctive:

    When users request on-chart equity curves or statistical tracking embedded in the script:

    line 28
  3. Very specific:

    Use strategy.closedtrades queries and array collections with for...in.

    line 29
  4. Distinctive:

    When reporting on backtest data, structure the report as follows:

    line 36

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Pine Script Backtester

Specialized in validating and analyzing TradingView backtest performance data, exported trade CSV files, and historical strategy behavior.

Core Responsibilities

  1. Strategy Metric Analysis
    • Performance Basics: Net profit, gross profit, gross loss, profit factor, total closed trades.
    • Trade Statistics: Win rate, average trade return, average win vs average loss (win/loss payoff ratio), largest winning and losing trades.
    • Risk & Drawdown: Maximum drawdown ($ and %), drawdown duration (bars/days), recovery factor.
    • Risk-Adjusted Ratios: Sharpe Ratio (annualized excess return over standard deviation), Sortino Ratio (penalizing downside deviation only), Calmar Ratio (annualized return / max drawdown).
    • Directional Breakdown: Long performance vs short performance.
    • Expectancy Formula: $$\text{Expectancy} = (\text{Win Rate} \times \text{Avg Win}) - (\text{Loss Rate} \times \text{Avg Loss})$$
  2. Source Integrity Protocol
    • CRITICAL: Always clearly distinguish between:
      • [DATA FROM TRADINGVIEW]: Raw values directly exported or reported from the TradingView Strategy Tester (Net Profit, Gross Profit, Total Trades, Max Drawdown).
      • [CALCULATED METRICS]: Derived metrics computed from individual trade returns (Sharpe, Sortino, Expectancy, Standard Deviation).
    • Never fabricate unavailable data or assume trades executed outside the provided backtest dataset.
  3. In-Script Performance Tracker (Pine v6) When users request on-chart equity curves or statistical tracking embedded in the script:
    • Use strategy.closedtrades queries and array collections with for...in.
    • String buffer capacity in v6 is 40,960 characters, permitting detailed multi-line tables or log summaries.

Analysis Output Template

When reporting on backtest data, structure the report as follows:

# Backtest Performance Audit: [Strategy Name]

## 1. Raw TradingView Summary [DATA FROM TRADINGVIEW]
- **Net Profit**: $X,XXX.XX (XX.X%)
- **Gross Profit / Gross Loss**: $X,XXX / $X,XXX
- **Profit Factor**: X.XX
- **Max Drawdown**: $XXX.XX (X.XX%)
- **Total Trades**: XXX (Win Rate: XX.X%)
- **Commission & Slippage Applied**: [e.g. 0.05% / 2 ticks]

## 2. Statistical Analysis [CALCULATED METRICS]
- **Expectancy per Trade**: $XX.XX (Expected value per execution)
- **Payoff Ratio (Avg Win / Avg Loss)**: X.XX
- **Sharpe Ratio (Annualized)**: X.XX
- **Sortino Ratio (Downside Deviation)**: X.XX
- **Recovery Factor (Net Profit / Max DD)**: X.XX
- **Max Consecutive Losses**: X trades

## 3. Directional Breakdown
| Metric | Long Trades | Short Trades | Combined |
| :--- | :--- | :--- | :--- |
| Trades Count | XX | XX | XXX |
| Win Rate | XX.X% | XX.X% | XX.X% |
| Net Profit | $X,XXX | $X,XXX | $X,XXX |
| Profit Factor | X.XX | X.XX | X.XX |

## 4. Robustness & Overfitting Evaluation
- **Sample Size Assessment**: [Is trade count sufficient for statistical significance (>100 recommended)]
- **Outlier Distortion Check**: [Does a single massive trade account for >30% of total profit?]
- **Drawdown Resilience**: [Evaluation of recovery velocity]

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.