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

pine-developer

Skill0 starsChanged 41 days agoMITView on GitHub

Writes production-quality Pine Script v6 code following TradingView guidelines and modern best practices. Use when implementing indicators, strategies, or any Pine Script code. Triggers on requests to create, write, implement, or code Pine Script functionality.

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

5 rules. About 0 are common, 2 are distinctive, and 3 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    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. Very specific:

    NEVER: use plot(), plotcandle(), plotbar(), or plotshape() inside local scopes (if/for/methods):

    line 43
  2. Very specific:

    PREFERRED: Use for...in loops for collections:

    line 55
  3. Very specific:

    If traditional for is required, cache the boundary:

    line 69
  4. Distinctive:

    All input functions support dynamic conditional activation:

    line 77
  5. Distinctive:

    Always include realistic commissions (e.g.

    line 193

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

Specialized in writing production-quality Pine Script v6 code for TradingView indicators, strategies, and libraries.

⚠️ CRITICAL: Pine Script v6 Modern Updates

1. Updated Line Wrapping Rules (Dec 2025)

Expressions inside parentheses support flexible indentation:

// ✅ VALID: Any indentation inside parentheses
plot(series,
    title="My Plot",
    color=color.blue)

// ✅ Also valid for complex boolean conditions inside parentheses
longCondition = (ta.crossover(ema50, ema200) and
    rsi < 30 and
    volume > ta.sma(volume, 20))

// ⚠️ STRICT outside parentheses - non-multiple-of-4 indentation (e.g. 5 spaces)
longCondition = ta.crossover(ema50, ema200) and
     rsi < 30

2. Line Continuation & Ternary Operators

NEVER split ternary operators (? :) across lines:

// ❌ WRONG: Syntax error
text = condition ?
    "val1" :
    "val2"

// ✅ CORRECT: Keep ternary on a single line
text = condition ? "val1" : "val2"

3. Plot Scope Restriction

NEVER use plot(), plotcandle(), plotbar(), or plotshape() inside local scopes (if/for/methods):

// ❌ WRONG
if condition
    plot(value)

// ✅ CORRECT: Global conditional plot
plot(condition ? value : na)

4. For Loop Dynamic Boundaries (March 2025 Breaking Change)

for loops evaluate to_num before every iteration.

  • PREFERRED: Use for...in loops for collections:
    // ✅ Arrays
    for element in myArray
        // Process element safely
    
    // ✅ Arrays with index
    for [index, element] in myArray
        // Both index and value
    
    // ✅ Maps & Matrices
    for [key, value] in myMap
        // Iterate key-value pairs
  • If traditional for is required, cache the boundary:
    arrSize = array.size(arr)
    for i = 0 to arrSize - 1
        // Safe iteration

5. Input active Parameter (July 2025)

All input functions support dynamic conditional activation:

useCustomMA = input.bool(false, "Use Custom MA", group="MA Settings")
customMALength = input.int(20, "Custom MA Length",
    group="MA Settings",
    active=useCustomMA,
    tooltip="Only editable when 'Use Custom MA' is enabled")

6. Plot Line Styles (September 2025)

plot(fastMA, "Fast MA", color=color.blue, linestyle=plot.linestyle_solid)
plot(slowMA, "Slow MA", color=color.orange, linestyle=plot.linestyle_dashed)
plot(level, "Level", color=color.gray, linestyle=plot.linestyle_dotted)

7. Unlimited Scopes & Increased String Limits

  • Scopes: Unlimited across functions, methods, conditionals, and UDTs.
  • Strings: Max 40,960 characters.

⚠️ UDT-First Architecture

For complex multi-attribute structures (swing points, order blocks, trailing levels, regression channels), define User-Defined Types (type) before calculations:

type OrderBlock
    int startTime
    int startBarIndex
    float topPrice
    float bottomPrice
    bool isMitigated = false
    box visualBox = na

method delete(OrderBlock this) =>
    if not na(this.visualBox)
        box.delete(this.visualBox)
    this.visualBox := na

method draw(OrderBlock this, color boxColor) =>
    this.delete()
    // ✅ CRITICAL: Use xloc.bar_time to avoid 5000-bar index limit
    this.visualBox := box.new(
         left=this.startTime,
         top=this.topPrice,
         right=time,
         bottom=this.bottomPrice,
         xloc=xloc.bar_time,
         bgcolor=color.new(boxColor, 80),
         border_color=boxColor)

Standard Script Structure

1. Indicator

//@version=6
indicator(title="My Indicator", shorttitle="IND", overlay=true)

// Inputs
groupGeneral = "General Settings"
len = input.int(14, "Length", group=groupGeneral, tooltip="Lookback period")

// Calculations
val = ta.rsi(close, len)

// Visuals
plot(val, "RSI", color=color.purple)

2. Strategy

//@version=6
strategy(title="My Strategy", shorttitle="STRAT", overlay=true,
         initial_capital=10000, default_qty_type=strategy.percent_of_equity,
         default_qty_value=10, commission_type=strategy.commission.percent,
         commission_value=0.05, slippage=2)
//@strategy_alert_message {{strategy.order.alert_message}}

// Inputs
groupTrade = "Trade Settings"
fastLen = input.int(9, "Fast EMA", group=groupTrade)
slowLen = input.int(21, "Slow EMA", group=groupTrade)

// Calculations
fastEMA = ta.ema(close, fastLen)
slowEMA = ta.ema(close, slowLen)

// Conditions on confirmed bars
longCondition = ta.crossover(fastEMA, slowEMA)
shortCondition = ta.crossunder(fastEMA, slowEMA)

if barstate.isconfirmed
    if longCondition
        strategy.entry("Long", strategy.long, comment="Enter Long")
    if shortCondition
        strategy.entry("Short", strategy.short, comment="Enter Short")

// Visuals
plot(fastEMA, "Fast EMA", color=color.blue)
plot(slowEMA, "Slow EMA", color=color.red)

Repainting Prevention & Execution Realism

  1. request.security() Safety:
    // Always specify lookahead_off to prevent future data leakage
    htfData = request.security(syminfo.tickerid, "D", close[1], lookahead=barmerge.lookahead_off)
  2. Order Execution & Realistic Assumptions:
    • Always include realistic commissions (e.g. 0.04% - 0.1%) and slippage (1 - 3 ticks).
    • Enter trades on bar confirmation if barstate.isconfirmed to avoid intrabar order oscillation.

Documentation & Knowledge Access

Consult the offline reference or pinescript-docs MCP tool:

  • Offline manual: docs/manual/pinescriptv6_complete_reference.md
  • Compilation gotchas: docs/pine-error-log.md
  • MCP tools: search_docs, get_doc, validate_function

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.