{"id":"708d143d-64c6-49a6-920f-e9b920bddf9b","shortId":"eQgUqX","kind":"skill","title":"pinescript","tagline":">-","description":"# Pine Script Development\n\n**Verify before implementing**: For Pine Script version-specific syntax or new built-in functions, search current docs via `search_docs` before writing code. TradingView updates Pine Script frequently and training data may be stale.\n\n## Critical Syntax Rules\n\n- **Ternary operators MUST stay on one line** -- splitting across lines causes \"end of line without line continuation\" error. For complex ternaries, use intermediate variables:\n  ```\n  isBull = close > open\n  barColor = isBull ? color.green : color.red\n  ```\n- **Continuation lines MUST be indented MORE than the starting line** -- same indentation = error\n- **NEVER use plot() inside local scopes** (if/for/functions) -- use conditional value instead: `plot(condition ? value : na)`\n- **barstate.isconfirmed** -- use to prevent repainting on real-time bars\n\n## Platform Limits\n\n500 bars history for `request.security()` | 500 plot calls | 64 drawing objects | 40 `request.security()` calls | 100KB compiled size\n\n## Performance\n\n- **Tuple security calls** -- one `request.security()` returning `[close, high, low]` instead of 3 separate calls\n- Pre-allocate arrays with `array.new<type>(size)` instead of push-and-resize\n- Short-circuit signals: build conditions incrementally, exit early when first condition fails\n- Cache repeated calculations in variables -- Pine recalculates every bar\n\n## Debugging\n\nTradingView has no console or debugger. Use these patterns:\n\n- **Label debugging**: `label.new(bar_index, high, str.tostring(myVar))` to inspect values\n- **Table monitor**: `table.new()` with `barstate.islast` for real-time variable dashboard\n- **Debug mode toggle**: wrap all debug code in `if input.bool(\"Debug\", false)` -- remove before publishing\n- **Repainting detector**: track `previousValue = value[1]`, flag when historical values change\n\n## Strategy & Backtesting\n\n- Use `strategy.*` functions: `strategy.wintrades`, `strategy.losstrades`, `strategy.grossprofit`\n- Drawdown tracking: `maxEquity = math.max(strategy.equity, nz(maxEquity[1]))`, then `dd = (maxEquity - strategy.equity) / maxEquity * 100`\n- Sharpe: `dailyReturn * 252 / (stdDev * math.sqrt(252))`\n- **Walk-forward validation** -- optimize on period 1, test on period 2, re-optimize on period 2, test on period 3. If metrics degrade > 30%, parameters are overfit.\n- **Indicator accuracy testing** -- use forward-looking `close[lookforward]` to measure prediction accuracy, track true/false positive rates\n\n## Visualization\n\n- `color.from_gradient()` for trend strength coloring\n- Adaptive text sizing: `size.small` for intraday, `size.normal` for daily+\n- Dynamic table rows -- resize based on enabled features via input toggles\n- Professional color constants: define BULL_COLOR, BEAR_COLOR, NEUTRAL_COLOR once with transparency\n\n## Publishing\n\n- Documentation goes at TOP of .pine file as comments before `indicator()`/`strategy()`\n- Use `@version`, `@description`, `@param` tags\n- Multi-line tooltips: `tooltip=\"Line 1\" + \"\\n\" + \"Line 2\"`\n- **TradingView House Rules**: no financial advice, no performance guarantees, no external links, no obfuscated code, no donation requests\n\n## Common Coding Mistakes\n\n- Indicator stacking (RSI + Stochastics + CCI) -- all measure the same thing (momentum). Use indicators from different categories instead.\n- Overfitting parameters: if optimal values are oddly specific (RSI 23 instead of 20), the backtest is curve-fitted. Use round numbers and `input()` with sensible defaults.\n- Missing `barstate.isconfirmed` guard -- calculations on unconfirmed bars cause repainting. Always guard entry signals.\n- Hardcoded thresholds without `input()` -- makes the script untestable across instruments.\n\n## Workflow\n\n1. Write indicator/strategy in Pine Editor\n2. Test with bar replay and strategy tester on multiple timeframes\n3. Walk-forward validate before trusting backtest results (see Strategy & Backtesting above)\n4. Verify: run on 3+ symbols and 2+ timeframes\n\n## Verify\n\n- Indicator compiles without errors on TradingView\n- No repainting: `barstate.isconfirmed` guard present where needed\n- Walk-forward tested on 3+ symbols across different timeframes","tags":["pinescript","skills","iliaal","agent-skills","ai-coding-assistant","ai-tools","claude-code"],"capabilities":["skill","source-iliaal","skill-pinescript","topic-agent-skills","topic-ai-coding-assistant","topic-ai-tools","topic-claude-code","topic-skills"],"categories":["ai-skills"],"synonyms":[],"warnings":[],"endpointUrl":"https://skills.sh/iliaal/ai-skills/pinescript","protocol":"skill","transport":"skills-sh","auth":{"type":"none","details":{"cli":"npx skills add iliaal/ai-skills","source_repo":"https://github.com/iliaal/ai-skills","install_from":"skills.sh"}},"qualityScore":"0.456","qualityRationale":"deterministic score 0.46 from registry signals: · indexed on github topic:agent-skills · 13 github stars · SKILL.md body (4,156 chars)","verified":false,"liveness":"unknown","lastLivenessCheck":null,"agentReviews":{"count":0,"score_avg":null,"cost_usd_avg":null,"success_rate":null,"latency_p50_ms":null,"narrative_summary":null,"summary_updated_at":null},"enrichmentModel":"deterministic:skill-github:v1","enrichmentVersion":1,"enrichedAt":"2026-05-18T19:07:03.027Z","embedding":null,"createdAt":"2026-05-09T01:05:36.028Z","updatedAt":"2026-05-18T19:07:03.027Z","lastSeenAt":"2026-05-18T19:07:03.027Z","tsv":"'1':234,255,275,378,471 '100':261 '100kb':129 '2':279,285,381,477,508 '20':432 '23':429 '252':264,267 '3':144,289,488,505,529 '30':293 '4':501 '40':126 '500':115,120 '64':123 'accuraci':298,309 'across':52,468,531 'adapt':321 'advic':387 'alloc':149 'alway':456 'array':150 'array.new':152 'backtest':241,434,495,499 'bar':112,116,181,195,453,480 'barcolor':71 'barstate.isconfirmed':103,448,519 'barstate.islast':207 'base':334 'bear':347 'build':164 'built':18 'built-in':17 'bull':345 'cach':173 'calcul':175,450 'call':122,128,135,146 'categori':418 'caus':54,454 'cci':407 'chang':239 'circuit':162 'close':69,139,304 'code':29,220,396,401 'color':320,342,346,348,350 'color.from':315 'color.green':73 'color.red':74 'comment':363 'common':400 'compil':130,512 'complex':63 'condit':96,100,165,171 'consol':186 'constant':343 'continu':60,75 'critic':41 'current':22 'curv':437 'curve-fit':436 'daili':329 'dailyreturn':263 'dashboard':213 'data':37 'dd':257 'debug':182,193,214,219,224 'debugg':188 'default':446 'defin':344 'degrad':292 'descript':369 'detector':230 'develop':4 'differ':417,532 'doc':23,26 'document':355 'donat':398 'draw':124 'drawdown':248 'dynam':330 'earli':168 'editor':476 'enabl':336 'end':55 'entri':458 'error':61,87,514 'everi':180 'exit':167 'extern':392 'fail':172 'fals':225 'featur':337 'file':361 'financi':386 'first':170 'fit':438 'flag':235 'forward':270,302,491,526 'forward-look':301 'frequent':34 'function':20,244 'goe':356 'gradient':316 'guarante':390 'guard':449,457,520 'hardcod':460 'high':140,197 'histor':237 'histori':117 'hous':383 'if/for/functions':94 'implement':7 'increment':166 'indent':79,86 'index':196 'indic':297,365,403,415,511 'indicator/strategy':473 'input':339,443,463 'input.bool':223 'insid':91 'inspect':201 'instead':98,142,154,419,430 'instrument':469 'intermedi':66 'intraday':326 'isbul':68,72 'label':192 'label.new':194 'limit':114 'line':50,53,57,59,76,84,374,377,380 'link':393 'local':92 'look':303 'lookforward':305 'low':141 'make':464 'math.max':251 'math.sqrt':266 'maxequ':250,254,258,260 'may':38 'measur':307,409 'metric':291 'miss':447 'mistak':402 'mode':215 'momentum':413 'monitor':204 'multi':373 'multi-lin':372 'multipl':486 'must':46,77 'myvar':199 'n':379 'na':102 'need':523 'neutral':349 'never':88 'new':16 'number':441 'nz':253 'obfusc':395 'object':125 'odd':426 'one':49,136 'open':70 'oper':45 'optim':272,282,423 'overfit':296,420 'param':370 'paramet':294,421 'pattern':191 'perform':132,389 'period':274,278,284,288 'pine':2,9,32,178,360,475 'pinescript':1 'platform':113 'plot':90,99,121 'posit':312 'pre':148 'pre-alloc':147 'predict':308 'present':521 'prevent':106 'previousvalu':232 'profession':341 'publish':228,354 'push':157 'push-and-res':156 'rate':313 're':281 're-optim':280 'real':110,210 'real-tim':109,209 'recalcul':179 'remov':226 'repaint':107,229,455,518 'repeat':174 'replay':481 'request':399 'request.security':119,127,137 'resiz':159,333 'result':496 'return':138 'round':440 'row':332 'rsi':405,428 'rule':43,384 'run':503 'scope':93 'script':3,10,33,466 'search':21,25 'secur':134 'see':497 'sensibl':445 'separ':145 'sharp':262 'short':161 'short-circuit':160 'signal':163,459 'size':131,153,323 'size.normal':327 'size.small':324 'skill' 'skill-pinescript' 'source-iliaal' 'specif':13,427 'split':51 'stack':404 'stale':40 'start':83 'stay':47 'stddev':265 'stochast':406 'str.tostring':198 'strategi':240,243,366,483,498 'strategy.equity':252,259 'strategy.grossprofit':247 'strategy.losstrades':246 'strategy.wintrades':245 'strength':319 'symbol':506,530 'syntax':14,42 'tabl':203,331 'table.new':205 'tag':371 'ternari':44,64 'test':276,286,299,478,527 'tester':484 'text':322 'thing':412 'threshold':461 'time':111,211 'timefram':487,509,533 'toggl':216,340 'tooltip':375,376 'top':358 'topic-agent-skills' 'topic-ai-coding-assistant' 'topic-ai-tools' 'topic-claude-code' 'topic-skills' 'track':231,249,310 'tradingview':30,183,382,516 'train':36 'transpar':353 'trend':318 'true/false':311 'trust':494 'tupl':133 'unconfirm':452 'untest':467 'updat':31 'use':65,89,95,104,189,242,300,367,414,439 'valid':271,492 'valu':97,101,202,233,238,424 'variabl':67,177,212 'verifi':5,502,510 'version':12,368 'version-specif':11 'via':24,338 'visual':314 'walk':269,490,525 'walk-forward':268,489,524 'without':58,462,513 'workflow':470 'wrap':217 'write':28,472","prices":[{"id":"aecbda41-b3c7-448f-909e-0d77d4c75c0b","listingId":"708d143d-64c6-49a6-920f-e9b920bddf9b","amountUsd":"0","unit":"free","nativeCurrency":null,"nativeAmount":null,"chain":null,"payTo":null,"paymentMethod":"skill-free","isPrimary":true,"details":{"org":"iliaal","category":"ai-skills","install_from":"skills.sh"},"createdAt":"2026-05-09T01:05:36.028Z"}],"sources":[{"listingId":"708d143d-64c6-49a6-920f-e9b920bddf9b","source":"github","sourceId":"iliaal/ai-skills/pinescript","sourceUrl":"https://github.com/iliaal/ai-skills/tree/master/skills/pinescript","isPrimary":false,"firstSeenAt":"2026-05-09T01:05:36.028Z","lastSeenAt":"2026-05-18T19:07:03.027Z"}],"details":{"listingId":"708d143d-64c6-49a6-920f-e9b920bddf9b","quickStartSnippet":null,"exampleRequest":null,"exampleResponse":null,"schema":null,"openapiUrl":null,"agentsTxtUrl":null,"citations":[],"useCases":[],"bestFor":[],"notFor":[],"kindDetails":{"org":"iliaal","slug":"pinescript","github":{"repo":"iliaal/ai-skills","stars":13,"topics":["agent-skills","ai-coding-assistant","ai-tools","claude-code","skills"],"license":"mit","html_url":"https://github.com/iliaal/ai-skills","pushed_at":"2026-05-16T13:15:17Z","description":"Curated collection of agent skills for AI coding assistants.","skill_md_sha":"bd75ca073fc9a98f70e6eed53ae9a4688b992e85","skill_md_path":"skills/pinescript/SKILL.md","default_branch":"master","skill_tree_url":"https://github.com/iliaal/ai-skills/tree/master/skills/pinescript"},"layout":"multi","source":"github","category":"ai-skills","frontmatter":{"name":"pinescript","description":">-"},"skills_sh_url":"https://skills.sh/iliaal/ai-skills/pinescript"},"updatedAt":"2026-05-18T19:07:03.027Z"}}