pine-backtester
Implements comprehensive backtesting and performance metrics. Use when adding trade analysis, equity curves, or statistical…
Writes production-quality Pine Script v6 code following TradingView guidelines. Use when implementing indicators, strategies, or any Pine Script code.
$ npx -y skills add traderspost/pinescript-agents --skill pine-developer --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/pine-developerContext preview
The summary Claude sees to decide when to auto-load this skill.
Writes production-quality Pine Script v6 code following TradingView guidelines. Use when implementing indicators, strategies, or any Pine Script code.
name: pine-developer description: Writes production-quality Pine Script v6 code following TradingView guidelines. Use when implementing indicators, strategies, or any Pine Script code. allowed-tools: Read, Write, Edit, Glob, Grep, Bash
Specialized in writing production-quality Pine Script v6 code for TradingView.
**These updates are essential for writing correct, modern Pine Script code:**
Expressions in parentheses now support flexible indentation:
// ✅ NOW VALID - Any indentation inside parentheses
plot(series,
title="My Plot", // Can use any indentation
color=color.blue)
// ✅ Also valid
longCondition = (ta.crossover(ema50, ema200) and
rsi < 30 and
volume > ta.sma(volume, 20))
// ⚠️ STILL REQUIRED outside parentheses - non-multiple-of-4 indentation
longCondition = ta.crossover(ema50, ema200) and
rsi < 30 // Must NOT be multiple of 4 spaces`for` loops now evaluate `to_num` **before every iteration**, not just once.
**PREFERRED: Use `for...in` loops for collections:**
// ✅ BEST: Use for...in for arrays (safe, clean, preferred)
for element in myArray
// Process element directly
// ✅ BEST: Use for...in with index when needed
for [index, element] in myArray
// Have both index and value
// ✅ for...in works with arrays, matrices, and maps
for [key, value] in myMap
// Iterate key-value pairs**If you must use traditional `for` loop:**
// ⚠️ BREAKING: This creates infinite loop!
var arr = array.new<int>()
for i = 0 to array.size(arr) // Re-evaluated each iteration
array.push(arr, i) // Array grows, loop never ends!
// ✅ FALLBACK: Cache the boundary if using traditional for
size = array.size(arr)
for i = 0 to size
array.push(arr, i)**Note:** `for...in` allows modifying array/matrix sizes during iteration. Maps cannot be resized during `for...in` - use `map.keys()` array instead.
// Only available on 1T (tick) timeframe bidPrice = bid // Highest buyer price (na on other timeframes) askPrice = ask // Lowest seller price (na on other timeframes)
All input functions now support conditional activation:
useCustomMA = input.bool(false, "Use Custom MA")
customMALength = input.int(20, "Custom MA Length",
active=useCustomMA, // Grayed out when useCustomMA is false
tooltip="Only available when 'Use Custom MA' is enabled")// For continuous futures - returns underlying contract ticker currentContract = syminfo.current_contract // Returns na for non-continuous
// International Securities Identification Number (12 chars) isinCode = syminfo.isin // Empty string if unavailable
plot(series, linestyle=plot.linestyle_solid) // Default plot(series, linestyle=plot.linestyle_dashed) // Dashed line plot(series, linestyle=plot.linestyle_dotted) // Dotted line
New `timeframe_bars_back` parameter:
// Get time from 5 bars back on the DAILY timeframe (not current chart)
dailyTimeBack = time("D", timeframe_bars_back=5)
// Positive = past bars, Negative = future (expected) timestamps
futureTime = time("D", timeframe_bars_back=-1) // Expected next bar// In library:
//@version=6
library("MyLib")
export const float PI = 3.14159265359
export const int MAX_BARS = 500
export const string VERSION = "1.0.0"For Renko, Line Break, Kagi, Point & Figure, Range charts:
// New "PercentageLTP" style for percentage box sizing renkoTicker = ticker.renko(syminfo.tickerid, "PercentageLTP", 1.0) kagiTicker = ticker.kagi(syminfo.tickerid, "PercentageLTP", 0.5) pnfTicker = ticker.pointfigure(syminfo.tickerid, "PercentageLTP", 1.0)
// Modify box x-coordinates after creation box.set_xloc(myBox, left, right, xloc.bar_index) box.set_xloc(myBox, leftTime, rightTime, xloc.bar_time)
// ✅ Any indentation works inside ()
plot(series,
title="Plot",
color=color.blue, // Different indentation OK
linewidth=2)
indicator("Title",
overlay=true,
max_bars_back=500)// ✅ CORRECT - Non-multiple-of-4 indentation
longCondition = ta.crossover(ema50, ema200) and
rsi < 30 and
volume > ta.sma(volume, 20)
// ❌ WRONG - Multiple of 4 (or same level)
longCondition = ta.crossover(ema50, ema200) and
rsi < 30 // Error: 4 spaces
longCondition = ta.crossover(ema50, ema200) and
rsi < 30 // Error: same indentation// ❌ NEVER split ternary across lines
text = condition ?
"value1" :
"value2" // ERROR!
// ✅ ALWAYS keep on one line
text = condition ? "value1" : "value2"
// ✅ For long ternaries, use intermediate variables
trueText = str.format("Long value {0}", param1)
falseText = str.format("Other vaA comprehensive Pine Script development environment powered by Claude Code's Skills system. This tool helps you create professional TradingView indicators and strategies with AI assistance. Just type start to begin!
Implements comprehensive backtesting and performance metrics. Use when adding trade analysis, equity curves, or statistical…
Troubleshoots Pine Script issues and adds debugging capabilities. Use when scripts have errors or unexpected behavior.
Orchestrates complex Pine Script projects by coordinating multiple development phases. Use for complete trading systems.
Optimizes Pine Script for performance and user experience. Use when improving speed, UI organization, or visual appeal.
Prepares Pine Scripts for TradingView publication with documentation and compliance checks. Use when finalizing scripts for…
Analyzes trading concepts and YouTube videos to extract Pine Script specifications. Use when planning indicators or analyzing…