pine-developer
Writes production-quality Pine Script v6 code following TradingView guidelines. Use when implementing indicators, strategies, or any Pine Script code.
By traderspost · 756 installs
npx skills add traderspost/pinescript-agents --skill pine-developer
Source repository · Upstream listing
Pine Script Developer
Specialized in writing production quality Pine Script v6 code for TradingView.
⚠️ CRITICAL: Pine Script v6 2025 Updates
These updates are essential for writing correct, modern Pine Script code:
December 2025: Updated Line Wrapping Rules
Expressions in parentheses now support flexible indentation:
March 2025: BREAKING CHANGE For Loop Dynamic Boundaries
for loops now evaluate to num before every iteration , not just once.
PREFERRED: Use for...in loops for collections:
If you must use traditional for loop:
Note: for...in allows modifying array/matrix sizes during iteration. Maps cannot be resized during for...in use map.keys() array instead.
February 2025: Scope Limit Removed
Previously limited to 550 total scopes
Now unlimited scopes across functions, methods, loops, conditionals, types, and enums
February 2025: Bid/Ask Variables
Pine Script v6 2025 New Features
July 2025: Input active Parameter
All input functions now support conditional activation:
July 2025: syminfo.current contract
November 2025: syminfo.isin
September 2025: Plot Line Styles
October 2025: Enhanced time() and time close()
New timeframe bars back parameter:
August 2025: Increased String Length
Maximum string length: 40,960 characters (was 4,096)
June 2025: Library Constant Exports
May 2025: time close on Non Time Based Charts
For Renko, Line Break, Kagi, Point & Figure, Range charts:
time close of open realtime bar now returns na
time close[1] now works immediately after bar closes
April 2025: Percentage Based Ticker Styles
March 2025: box.set xloc()
CRITICAL: Line Wrapping Rules (Updated December 2025)
Inside Parentheses (FLEXIBLE)
Outside Parentheses (STRICT)
CRITICAL: Ternary Operators Keep on ONE Line
CRITICAL: Plot Scope Restriction
NEVER use plot() inside local scopes:
⚠️ CRITICAL: UDT First Architecture
For any complex data structure, ALWAYS define User Defined Types (UDTs) FIRST before writing any other code.
Why UDT First?
1. Encapsulation : Bundle related data and drawing objects together
2. Methods : Add behavior directly to types with method syntax
3. Unlimited Lookback : Use xloc.bar time instead of xloc.bar index (5000 bar limit!)
4. Clean Arrays : One array<MyType instead of 6+ parallel arrays
5. Self Managing Drawings : Types can create/delete their own visual objects
UDT Definition Pattern
UDT Methods Pattern
⚠️ CRITICAL: xloc.bar time vs xloc.bar index
ALWAYS use xloc.bar time for drawing objects that may need historical display:
UDT Storage Pattern
Creating and Storing UDTs
Iterating UDT Arrays with for...in
Time Capture Pattern
UDT Architecture Checklist
[ ] Define UDT type BEFORE any calculations
[ ] Store time values for drawing coordinates
[ ] Store bar index values for Y calculations
[ ] Include drawing objects ( line , box , label ) as UDT fields
[ ] Add delete() method to clean up drawings
[ ] Add draw() method using xloc.bar time
[ ] Use single array<MyType instead of parallel arrays
[ ] Use for...in to iterate UDT arrays
Documentation Access
Primary documentation references:
/docs/pinescript v6/quick reference/syntax basics.md Core syntax
/docs/pinescript v6/reference tables/function index.md Function reference
/docs/pinescript v6/core concepts/execution model.md Execution model
/docs/pinescript v6/core concepts/repainting.md Repainting issues
/docs/pinescript v6/quick reference/limitations.md Platform limits
Project File Management
Save work to /projects/[project name].pine
Update file header with accurate project information
Never create unnecessary files
Script Structure Templates
Indicator Template
Strategy Template (IMPORTANT: Include alert annotation)
TradingView Constraints (2025 Updated)
Limits
Maximum 500 bars historical reference
Maximum 500 plot/hline/fill outputs
Maximum 64 drawing objects (label/line/box/table)
Maximum 40 security() calls
Maximum 100KB compiled script size
Tables: max 100 cells
Arrays: max 100,000 elements
Strings: max 40,960 characters (increased August 2025)
Scopes: Unlimited (removed February 2025)
Platform Quirks
bar index starts at 0
na propagation in calculations
Historical vs real time calculation differences
Strategy calculations on bar close (unless calc on every tick)
bid / ask only available on 1T timeframe
Best Practices
Avoid Repainting
Performance Optimization
User Experience (Use 2025 Features)
Error Handling
Code Review Checklist
Architecture (Check First!)
[ ] Complex data uses UDT first pattern
[ ] Drawing objects use xloc.bar time (not bar index)
[ ] Time values captured for historical drawing
[ ] Single UDT array instead of parallel arrays
Script Basics
[ ] //@version=6 declaration
[ ] //@strategy alert message {{strategy.order.alert message}} for strategies (placed after the strategy() call)
[ ] Proper title and overlay setting
Inputs & UX
[ ] Inputs have tooltips and groups
[ ] Inputs use active parameter where appropriate
[ ] Using new plot linestyles where appropriate
[ ] Proper plot styling
Code Quality
[ ] No repainting issues
[ ] na values handled
[ ] Loop boundaries cached (March 2025 fix)
[ ] Efficient calculations
[ ] Clear variable names
[ ] Alert conditions if needed
Write code that is production ready, efficient, and uses UDT first architecture with the latest Pine Script v6 features.