Skip to main content

Pine Script Documentation Standards

Overview

This document establishes comprehensive documentation standards for Pine Script indicators and strategies, ensuring consistency across TradingView publications and internal documentation. Our standards are based on PineCoders formatting guidelines and optimized for both TradingView publication and internal development workflows.

Table of Contents

  1. Publication Documentation Standards
  2. Internal Documentation Structure
  3. Documentation Synchronization Workflow
  4. TradingView-Specific Formatting
  5. File Organization and Naming
  6. Version Control and Change Management
  7. Quality Assurance Procedures

Publication Documentation Standards

Script Description Structure

All TradingView script descriptions must follow this exact structure:

1. Overview Section

█ [b]OVERVIEW[/b]

[First 1-2 sentences that will appear in the script widget - make them count!]

[Additional overview content explaining the core purpose and value proposition]

Guidelines:

  • First sentences appear in the TradingView widget preview
  • Focus on the primary value proposition
  • Keep technical jargon minimal in opening lines
  • Use italics for UI elements: widget, page, inputs

2. Features Section

█ [b]FEATURES[/b]

[b]Core Functionality[/b]
• Feature 1 description
• Feature 2 description
• Feature 3 description

[b]Display Options[/b]
• Display feature 1
• Display feature 2

[b]Alert System[/b]
• Alert feature 1
• Alert feature 2

3. How to Use Section

█ [b]HOW TO USE[/b]

[b]Setup Instructions[/b]
1 — Step one with Em dash formatting
2 — Step two with proper line breaks
Additional details indented with two Em spaces
3 — Final step

[b]Configuration Guidelines[/b]
• Configuration point 1
• Configuration point 2
Additional details with two Em space indentation

4. Technical Details Section

█ [b]TECHNICAL DETAILS[/b]

[b]Calculation Methods[/b]
[Explain the mathematical foundations]

[b]Parameters and Inputs[/b]
[List and explain key parameters in order they appear in inputs]

[b]Visual Elements[/b]
[Describe plots, colors, and visual indicators]

5. Limitations Section

█ [b]LIMITATIONS[/b]

• Known limitation 1
• Known limitation 2
• Market condition dependencies

6. Notes and Credits Section

█ [b]NOTES[/b]

[Important usage notes, performance considerations, etc.]


█ [b]CREDITS[/b]

Special thanks to [url=https://www.tradingview.com/u/USERNAME/#published-scripts]Author Name[/url] for inspiration/code contributions.

═════════════════════════════════════════════════════════════════════════

[i]For support and updates, visit our [url=https://pinescriptstrategy.com]website[/url].[/i]

Formatting Rules

Typography

  • Section Headers: █ [b]SECTION NAME[/b] (Full block + Em space + bold + all caps)
  • Sub-headers: [b]Sub-header Name[/b] (Bold, title case)
  • Emphasis: Use [b]bold[/b] sparingly for key terms
  • UI References: Use [i]italics[/i] for interface elements

Lists and Spacing

  • Bulleted Lists: (Em space + bullet + space)
  • Numbered Lists: 1 — (Number + space + Em dash + space)
  • Indentation: Two Em spaces for continuation lines
  • Section Separation: Two empty lines between sections
  • Sub-section Separation: One empty line before sub-headers

Special Characters

  • Em space: (U+2003)
  • Em dash: (U+2014)
  • Bullet: (U+2022)
  • Full block: (U+2588)
  • Zero-width space: (U+200B) - for breaking auto-links
  • Double-line separator: (U+2550)

Code and Symbols

[pine]
//@version=6
indicator("Example Code")
plot(close)
[/pine]
  • Use backticks for inline code: bar_index
  • Link to symbols: [symbol="NASDAQ:AAPL"]NASDAQ:AAPL[/symbol]
  • Chart links render automatically: https://www.tradingview.com/script/ID/

Internal Documentation Structure

README.md Template

Each indicator/strategy must have a comprehensive README.md:

# [Indicator Name]

**[Brief tagline/description]**

![Version](https://img.shields.io/badge/version-X.X.X-blue.svg)
![Category](https://img.shields.io/badge/category-[Category]-green.svg)
![Pine Script](https://img.shields.io/badge/Pine_Script-v6-orange.svg)

## Overview
[Detailed technical overview for developers]

## Key Features
[Technical feature breakdown]

## Installation
[Setup instructions]

## Configuration
[Parameter explanations with technical details]

## Usage Examples
[Code examples and use cases]

## Technical Implementation
[Algorithm explanations, calculation methods]

## Performance Notes
[Optimization details, limitations]

## Testing
[Testing procedures and validation]

## Changelog
[Version history]

## License
[License information]

## Support
[Contact and support information]

Pine Script File Documentation

Every .pine file must include:

// =====================================================
// [Indicator Name] [Author]
// =====================================================
// Copyright YYYY Author Name. All rights reserved.
// License: [License Type]
// Contact: [Email]
// Website: [Website]
// =====================================================

// DESCRIPTION:
// [Concise technical description of the indicator's purpose and functionality]

// FEATURES:
// • Feature 1
// • Feature 2
// • Feature 3

// USAGE:
// [Brief usage instructions]

// PARAMETERS:
// [Key parameters explanation]

// CHANGELOG:
// [Embedded changelog - see Version Control section]

//@version=6
indicator("[Display Name]", "[Short Name]", overlay=true/false)

Documentation Synchronization Workflow

Pre-Publication Checklist

  1. Internal Documentation Update

    • Update README.md with latest features
    • Update changelog in Pine script file
    • Verify all examples and screenshots
    • Test all documented features
  2. TradingView Description Preparation

    • Convert internal docs to TradingView format
    • Apply PineCoders formatting standards
    • Optimize first sentences for widget display
    • Validate all markup tags
  3. Cross-Reference Validation

    • Ensure version numbers match across all files
    • Verify feature lists are consistent
    • Check that limitations are documented in both places
    • Confirm contact information is current

Publication Process

  1. Draft Preparation

    # Create TradingView-formatted description
    cp docs/tradingview-template.txt scripts/[indicator-name]/tv-description.txt
    # Edit with indicator-specific content
  2. Preview Testing

    • Test description in private TradingView script
    • Verify all links work correctly
    • Check character formatting renders properly
    • Validate code blocks compile correctly
  3. Publication

    • Publish on TradingView with prepared description
    • Update internal documentation with publication URL
    • Tag repository with publication version
  4. Post-Publication

    • Archive TradingView description text
    • Update master documentation index
    • Notify team of new publication

Maintenance Workflow

Since TradingView descriptions cannot be edited after 15 minutes:

  1. Description Updates

    • Create new "update" or "improvement" publication
    • Reference original in new description
    • Maintain internal documentation for both versions
  2. Version Management

    • Keep internal docs as single source of truth
    • Archive all TradingView descriptions used
    • Maintain mapping between versions and publications

TradingView-Specific Formatting

Markup Reference

ElementTradingView FormatInternal Format
Bold[b]text[/b]**text**
Italic[i]text[/i]*text*
URL[url=link]text[/url][text](link)
Code Block[pine]code[/pine]````pine`
Symbol[symbol="TICKER"]TICKER[/symbol]TICKER
List Item[*]item- item

Conversion Tools

Create conversion scripts for automated formatting:

# Example conversion script structure
scripts/convert-to-tv.sh
scripts/convert-from-tv.sh
scripts/validate-tv-format.sh

Common Formatting Issues

  1. Link Breaking: Use Unicode double figure spaces for problematic names
  2. History References: bar_index[1] gets stripped outside code blocks
  3. Auto-linking: Use zero-width space to break unwanted auto-links
  4. Character Limits: TradingView has description length limits

File Organization and Naming

Directory Structure

indicators/
├── [category]/
│ ├── [indicator-name]/
│ │ ├── README.md
│ │ ├── [indicator-name].pine
│ │ ├── changelog.md
│ │ ├── examples/
│ │ ├── docs/
│ │ │ ├── tv-description.txt
│ │ │ ├── tv-description-archive/
│ │ │ └── technical-specs.md
│ │ └── assets/
│ │ ├── screenshots/
│ │ └── examples/

Naming Conventions

  • Directories: kebab-case
  • Files: kebab-case.extension
  • Pine Scripts: Match directory name
  • Documentation: Descriptive, consistent naming

Version Management

  • Semantic Versioning: MAJOR.MINOR.PATCH
  • Git Tags: v1.2.3
  • Documentation Versions: Match code versions
  • Archive Naming: tv-description-v1.2.3.txt

Version Control and Change Management

Changelog Standards

Pine Script Embedded Changelog

// CHANGELOG:
// v2.1.0 (2025-07-04) - Feature enhancement
// • Added new calculation method
// • Improved performance by 15%
// • Fixed edge case in alert conditions
// • Updated documentation structure
//
// v2.0.0 (2025-06-28) - Major refactoring
// • Complete code restructure
// • Breaking changes to input parameters
// • New color theme system
// • Enhanced error handling

External Changelog Format

# Changelog

## [2.1.0] - 2025-07-04

### Added
- New calculation method for improved accuracy
- Performance monitoring and optimization

### Changed
- Alert system behavior for better reliability
- Documentation structure for clarity

### Fixed
- Edge case in divergence detection
- Memory usage optimization

## [2.0.0] - 2025-06-28
[Previous version details]

Documentation Versioning

  1. Major Versions: Complete documentation rewrite
  2. Minor Versions: Feature additions, significant changes
  3. Patch Versions: Bug fixes, minor clarifications

Git Workflow

# Documentation update workflow
git checkout -b docs/update-indicator-name
# Make documentation changes
git add docs/ indicators/[name]/
git commit -m "docs: update [indicator] documentation v2.1.0"
git push origin docs/update-indicator-name
# Create pull request

Quality Assurance Procedures

Documentation Review Checklist

Content Review

  • Technical accuracy verified
  • All features documented
  • Examples tested and working
  • Screenshots current and clear
  • Links functional

Format Review

  • TradingView markup validated
  • Markdown rendering tested
  • Typography consistent
  • Spacing and indentation correct
  • Special characters proper

Consistency Review

  • Version numbers aligned
  • Feature descriptions match across docs
  • Naming conventions followed
  • Style guide compliance

Testing Procedures

  1. Documentation Testing

    # Validate markdown
    markdownlint docs/*.md

    # Test TradingView formatting
    scripts/validate-tv-format.sh

    # Check links
    scripts/check-links.sh
  2. Cross-Platform Testing

    • Test TradingView description rendering
    • Verify GitHub README.md display
    • Check internal documentation system
  3. User Testing

    • Internal team review
    • Documentation walkthrough
    • Feedback incorporation

Automated Validation

Create validation scripts for:

  • Markdown linting
  • TradingView format validation
  • Link checking
  • Version consistency
  • Image optimization
  • File structure validation

Implementation Roadmap

Phase 1: Foundation (Week 1-2)

  • Create documentation templates
  • Establish file structure standards
  • Develop conversion tools
  • Set up validation scripts

Phase 2: Migration (Week 3-4)

  • Audit existing documentation
  • Convert current docs to new standards
  • Update all Pine script files
  • Create missing documentation

Phase 3: Automation (Week 5-6)

  • Implement automated validation
  • Create CI/CD integration
  • Develop publishing workflow
  • Test complete process

Phase 4: Optimization (Week 7-8)

  • Gather feedback and iterate
  • Optimize workflow efficiency
  • Create training materials
  • Document lessons learned

Support and Resources

Internal Resources

  • Style guide: docs/PineScript_Formatting_Guidelines.md
  • Templates: templates/
  • Scripts: tools/documentation/
  • Examples: docs/examples/

External Resources

Team Contacts

  • Documentation Lead: [Contact Info]
  • Technical Review: [Contact Info]
  • Publication Manager: [Contact Info]

This document is version-controlled and should be updated as standards evolve. Last updated: July 4, 2025