agentleFS
eehricheehrich/ScarabHive/skills/coding/trading-view/SKILL.md

trading-view

Skill2 starsChanged 6 days agoApache-2.0View on GitHub

TradingView Pine Script (v6) development: build, debug, convert and improve indicators and strategies. Use whenever the user wants to create a TradingView indicator or strategy, write or fix Pine Script code, turn a trading idea into a chart script, port an indicator from another platform (TradingView-style), convert Pine v5 code to v6, or add inputs/plots/alerts to an existing TradingView script — even if they never say "Pine Script" or "TradingView" explicitly (e.g. "build me an RSI oscillator", "I need a backtestable MA-cross strategy"). Also reach for it when the user asks about TradingView indicator logic, repainting, multi-timeframe requests, or strategy backtesting results.

The file

We split this skill into the rules it gives an agent

6 rules. About 0 are common, 3 are distinctive, and 3 are 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.

  • 3

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Default when nothing is said: indicator(), chart timeframe, inputs for the main parameters, overlay where natural, no alerts — and say so.

    line 25
  2. Very specific:

    No lookahead bias: Never pull future data into a decision.

    line 36
  3. Very specific:

    Plot, don't just compute: Every computed series the user cares about should be visible: plot, plotshape, fill, bgcolor, barcolor, table, or …

    line 41
  4. Very specific:

    When available, run the bundled offline validator as a pre-flight: scripts/validate_pine.sh <file> --no-hints --no-information (see "Local …

    line 60
  5. Distinctive:

    Read the one(s) you need — don't read them all:

    line 69
  6. Distinctive:

    Run it through the wrapper (auto-selects a Python >= 3.11):

    line 88

≈ “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

TradingView Pine Script Development

Build production-quality TradingView indicators and strategies in Pine Script v6.

Ask first, then write

TradingView code is only as good as the spec. If the request does not fully specify what the script should do, ask — or state your assumptions explicitly at the top of the answer:

  1. Script type — indicator() (display/analysis) or strategy() (backtest/orders)?
  2. Timeframe & symbol scope — chart timeframe only, or multi-timeframe via request.security()?
  3. Inputs — which parameters should the user be able to tune in Settings/Inputs?
  4. Visuals — overlay on price or separate pane? Which plots, colors, labels, tables?
  5. Alerts — alertcondition, alert(), or none?

Default when nothing is said: indicator(), chart timeframe, inputs for the main parameters, overlay where natural, no alerts — and say so.

Core rules

  • Pine Script v6 is the default (//@version=6). Convert old v5 code (see references/common-errors.md).
  • Never repaint. On realtime (unclosed) bars, only emit signals on confirmed data — use barstate.isconfirmed or calculate on close — so the indicator does not change after the fact. Repainting is the #1 complaint about TradingView scripts.
  • No lookahead bias. Never pull future data into a decision. When requesting other timeframes, understand barmerge.lookahead_on before using it (default is barmerge.lookahead_off).
  • Make parameters inputs. Anything the user might reasonably want to tune belongs in the Settings/Inputs tab via input.*.
  • Plot, don't just compute. Every computed series the user cares about should be visible: plot, plotshape, fill, bgcolor, barcolor, table, or label.
  • One complete script per file. Copy-paste ready, no placeholders, no pseudo-code, no .... The user pastes it into the Pine Editor and it compiles.

Workflow

  1. Clarify the request (see "Ask first"). If the user gave you a strategy idea, translate it into concrete rules: entries, exits, filters, position sizing, stop/take-profit.
  2. Pick the right reference doc (below) and follow it.
  3. Write the complete script. Comment the non-obvious parts (the why, not the what). Structure: declaration → inputs → calculations → visuals → alerts.
  4. Self-review against the Core rules and the checklist in references/common-errors.md. Watch for repainting, division by zero, unused variables, missing na handling, and invalid plot arguments. When available, run the bundled offline validator as a pre-flight: scripts/validate_pine.sh <file> --no-hints --no-information (see "Local validation" below).
  5. Deliver the code in a block the user can paste straight into the Pine Editor, plus a short "How to use" note (add to chart, what the inputs do, anything they must configure).

Reference docs

Read the one(s) you need — don't read them all:

  • references/language-basics.md — Pine Script v6 syntax, execution model, types, variables (var/varip), control flow, functions, namespaces.
  • references/indicators.md — building indicators: declaration, inputs, ta.* built-ins, plotting, overlay vs. pane, complete examples.
  • references/strategies.md — building strategies: orders, pyramiding, position sizing, backtesting realism, exits.
  • references/inputs-settings.md — all input.* functions, groups, sessions, symbol/timeframe inputs.
  • references/plots-and-visuals.md — plot*, fill, bgcolor, barcolor, colors, labels, tables, line/box/polyline drawings.
  • references/multi-timeframe.md — request.security() and friends, repainting, lookahead, HTF patterns.
  • references/alerts.md — alertcondition, alert(), message templates, alert frequencies.
  • references/common-errors.md — frequent compiler errors, debugging techniques, v5→v6 migration.
  • references/cheatsheet.md — quick lookup table of the most used functions.

Local validation (offline)

The skill bundles a pure-Python static validator for Pine Script v6 (scripts/pine-validator/, upstream Poryaei/pine-script-validator, MIT). It parses .pine files and reports syntax/semantic issues with line/column positions — no TradingView account needed.

Run it through the wrapper (auto-selects a Python >= 3.11):

scripts/validate_pine.sh path/to/script.pine --no-hints --no-information  # human text
scripts/validate_pine.sh path/to/script.pine --agent-json                 # agent-ready JSON
scripts/validate_pine.sh path/to/scripts/ --json                          # batch / directory
scripts/validate_pine.sh path/to/script.pine --sarif                      # CI / review tooling
  • Exit code 0 = no error-level diagnostics, 1 = at least one error.
  • Severity toggles: --errors/--no-errors, --warnings/--no-warnings, --information/--no-information, --hints/--no-hints.
  • The validator targets Pine v6 — old v4/v5 code (study(), bare input(), change(), max(), ...) is flagged as errors; use those diagnostics to drive a v5→v6 port.
  • It is a static checker, not the TradingView compiler: it can miss semantic rules (e.g. CE10163 — ternaries cannot return tuples) and will never catch repainting, lookahead, or runtime object-limit issues — the human checklist in references/common-errors.md still applies.
  • Audit mode (large corpora): PYTHONPATH=scripts/pine-validator/src python -m pinescript_validator.audit <paths>

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.