Skip to main content

Contributing to Pine Script Library

Thank you for your interest in contributing to our Pine Script Library! This document provides comprehensive guidelines for contributing high-quality indicators, strategies, and improvements to our professional library.

🎯 Contribution Overview​

We welcome contributions that:

  • Add new indicators or strategies
  • Improve existing code quality
  • Enhance documentation
  • Fix bugs or performance issues
  • Add utility libraries or templates

📋 Contribution Standards​

Code Quality Requirements​

All contributions must meet our professional standards:

  • ✅ Follow Formatting Guidelines: Adhere to our Pine Script Formatting Guidelines
  • ✅ Include Comprehensive Documentation: Every script needs detailed README and inline comments
  • ✅ Provide Version History: Maintain changelog with semantic versioning
  • ✅ Pass Quality Validation: Code must compile without errors and warnings
  • ✅ Include Usage Examples: Demonstrate practical implementation

File Structure Requirements​

Each contribution must include:

your-indicator/
├── README.md # Comprehensive documentation
├── changelog.md # Version history
├── your-indicator.pine # Main Pine script
├── examples/ # Usage examples (optional)
└── screenshots/ # Visual examples (optional)

🚀 Getting Started​

1. Fork and Clone​

# Fork the repository on GitHub
git clone https://github.com/yourusername/PineScript.git
cd PineScript

# Add upstream remote
git remote add upstream https://github.com/original/PineScript.git

2. Create Feature Branch​

# Create and switch to feature branch
git checkout -b feature/your-indicator-name

# Keep your branch updated
git fetch upstream
git rebase upstream/dev

3. Development Environment​

  • Use VSCode or your preferred editor
  • Enable Pine Script syntax highlighting
  • Configure 4-space indentation
  • Enable visible whitespace

📝 Contribution Types​

New Indicators​

Location: indicators/{category}/{indicator-name}/

Categories:

  • trend/ - Trend analysis indicators
  • momentum/ - Momentum and oscillators
  • volume/ - Volume-based indicators
  • volatility/ - Volatility measures
  • support-resistance/ - Key level identification

Requirements:

  • Professional-grade implementation
  • Multi-timeframe support (where applicable)
  • Comprehensive alert system
  • Configurable display options
  • Performance optimization

New Strategies​

Location: strategies/{category}/{strategy-name}/

Categories:

  • trend-following/ - Trend-based systems
  • momentum-based/ - Momentum strategies
  • breakout/ - Breakout systems

Requirements:

  • Complete entry/exit logic
  • Risk management parameters
  • Backtesting compatibility
  • Performance metrics
  • Strategy documentation

Utility Libraries​

Location: libraries/{category}/

Categories:

  • utils/ - General utilities
  • math/ - Mathematical functions
  • display/ - Visual elements
  • time/ - Time/timeframe helpers
  • alert/ - Alert systems
  • validation/ - Input validation

Requirements:

  • Reusable functions
  • Clear documentation
  • Parameter validation
  • Error handling
  • Usage examples

🎨 Code Standards​

Pine Script Requirements​

//@version=6
indicator("Your Indicator [YourInitials]",
shorttitle="YI[YI]",
overlay=false,
precision=2,
max_labels_count=500)

// Professional header with copyright and description
// =====================================================
// Your Indicator Name [Your Initials]
// =====================================================
// Copyright 2025 Your Name. All rights reserved.
// Educational use only. Private modifications allowed.
// Contact: your.email@domain.com
// =====================================================

Function Documentation​

//@function Calculate moving average with validation
//@param source Price series for calculation
//@param length Number of periods
//@param method MA type ('sma', 'ema', 'wma')
//@returns Calculated moving average or na if invalid
f_calculateMA(series float source, simple int length, simple string method) =>
// Implementation with proper validation

Constants and Configuration​

// =====================================================
// CONSTANTS AND CONFIGURATION
// =====================================================

// Indicator Configuration
INDICATOR_DEFAULT_LENGTH = 14
INDICATOR_MIN_LENGTH = 1
INDICATOR_MAX_LENGTH = 500

// Display Configuration
MAX_LABELS = 500
MAX_LINES = 500

📚 Documentation Requirements​

README.md Template​

# Your Indicator Name

**Brief description of functionality**

![Version](https://img.shields.io/badge/version-1.0.0-blue.svg)
![Category](https://img.shields.io/badge/category-Trend-green.svg)

## Overview
Detailed description of what the indicator does...

## Key Features
- Feature 1
- Feature 2
- Feature 3

## Technical Specifications
Parameter details, calculations, etc...

## Usage Guide
How to use the indicator...

## Configuration Examples
Practical setup examples...

## Version History
Link to changelog...

## License
Reference to library license...

Changelog Format​

# Your Indicator Changelog

## [1.0.0] - 2025-MM-DD

### Added
- Initial release
- Core functionality
- Basic features

### Technical Details
- Parameter specifications
- Performance characteristics

✅ Quality Checklist​

Before submitting your contribution:

Code Quality​

  • Follows Pine Script formatting guidelines
  • Uses consistent naming conventions
  • Includes comprehensive error handling
  • Implements input validation
  • Optimized for performance
  • No compilation errors or warnings

Documentation​

  • README.md with complete documentation
  • Inline code comments for complex logic
  • Function documentation with JSDoc format
  • Changelog with version history
  • Usage examples provided

Testing​

  • Tested across multiple timeframes
  • Validated with different symbols
  • Edge cases handled appropriately
  • Performance tested with historical data
  • Alert functionality verified

File Organization​

  • Proper directory structure
  • Consistent file naming
  • Required files included
  • No unnecessary files

🔄 Submission Process​

1. Pre-submission Testing​

# Test your indicator thoroughly
# Ensure it compiles without errors
# Verify all features work as expected
# Check performance with large datasets

2. Create Pull Request​

Target Branch: dev (not main)

PR Title Format: [Category] Add/Fix/Update: Indicator Name

Examples:

  • [Trend] Add: Advanced MACD Divergence Indicator
  • [Momentum] Fix: RSI calculation edge case
  • [Volume] Update: Enhanced volume profile display

3. PR Description Template​

## Description
Brief description of changes...

## Type of Change
- [ ] New indicator
- [ ] New strategy
- [ ] New utility library
- [ ] Bug fix
- [ ] Documentation update
- [ ] Performance improvement

## Category
- [ ] Trend
- [ ] Momentum
- [ ] Volume
- [ ] Volatility
- [ ] Support/Resistance

## Testing
- [ ] Tested on multiple timeframes
- [ ] Tested with different symbols
- [ ] Performance validated
- [ ] Documentation reviewed

## Checklist
- [ ] Follows formatting guidelines
- [ ] Includes comprehensive documentation
- [ ] Changelog updated
- [ ] No compilation errors
- [ ] Ready for review

🔍 Review Process​

Review Criteria​

Your contribution will be evaluated on:

  1. Code Quality (40%)

    • Adherence to formatting standards
    • Error handling and validation
    • Performance optimization
    • Code organization
  2. Documentation (30%)

    • Completeness and clarity
    • Usage examples
    • Technical specifications
    • Version tracking
  3. Functionality (20%)

    • Feature completeness
    • Reliability and accuracy
    • User experience
    • Professional appearance
  4. Testing (10%)

    • Comprehensive testing
    • Edge case handling
    • Performance validation
    • Cross-platform compatibility

Review Timeline​

  • Initial Review: 3-5 business days
  • Feedback Cycle: 2-3 days per iteration
  • Final Approval: 1-2 business days
  • Merge to Dev: Immediate after approval
  • Release Planning: Monthly dev → main merges

🎨 Style Guidelines​

Visual Standards​

  • Professional Appearance: Clean, modern design
  • Color Consistency: Use established color themes
  • Typography: Clear, readable text elements
  • Spacing: Appropriate visual hierarchy
  • Performance: Efficient rendering

User Experience​

  • Intuitive Controls: Logical parameter organization
  • Clear Feedback: Obvious visual indicators
  • Flexible Display: Multiple viewing options
  • Reliable Alerts: Consistent notification system
  • Documentation: In-line help and tooltips

🛠️ Development Tools​

Editor: Visual Studio Code Extensions:

  • Pine Script syntax highlighting
  • Bracket pair colorization
  • Indent rainbow
  • Error lens

Configuration:

{
"editor.tabSize": 4,
"editor.insertSpaces": true,
"editor.renderWhitespace": "all",
"editor.wordWrap": "off"
}

Validation Tools​

Use our development tools in tools/validation/:

  • Code formatting checker
  • Documentation validator
  • Performance analyzer
  • Compilation tester

📞 Support and Questions​

Getting Help​

  • Documentation: Check existing docs first
  • Issues: Search GitHub issues
  • Discussions: Use GitHub discussions
  • Direct Contact: paul@pinescriptstrategy.com

Community​

  • Follow library coding standards
  • Respect contributor guidelines
  • Participate constructively in reviews
  • Help maintain library quality

🏆 Recognition​

Contributor Benefits​

  • Attribution: Your name in contributor list
  • Documentation: Link to your profile/website
  • Expertise: Recognition for quality contributions
  • Community: Part of professional Pine Script community

Quality Awards​

  • Gold Contributor: 5+ high-quality contributions
  • Expert Developer: Advanced technical contributions
  • Documentation Master: Exceptional documentation
  • Community Helper: Active in reviews and support

Contribution License​

By contributing, you agree:

  • Your contribution follows library license terms
  • You have rights to submit the contribution
  • Your work can be used under library license
  • You retain credit for your contribution
  • Library License: Educational use encouraged
  • Attribution Required: For commercial use
  • Original Authors: Maintain copyright notices
  • Professional Standards: Commercial-grade quality

🎉 Thank You!​

Your contributions help build a world-class Pine Script library. We appreciate your effort to maintain high standards and create valuable tools for the trading community.

Questions? Contact paul@pinescriptstrategy.com


Last Updated: June 30, 2025
Part of: Pine Script Library