Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

3 Commits

Folders and files

Repository files navigation

Schwab Lot Plotter - Plot Lots on TradingView charts for Schwab positions

Screenshot of Schwab Purchase Lots indicator on TradingView

Automatically generate TradingView Pine Script indicators from Schwab transaction CSV files to visualize your purchase lots across multiple stocks.

Features

  • Multi-Symbol Support: Single indicator works for all your stocks
  • Purchase Lot Visualization: Blue gradient labels show lot sizes at purchase dates
  • Average Cost Lines: Purple horizontal lines with text labels
  • Summary Table: Overview of all symbols and their data
  • Automatic Updates: Regenerate when you add new CSV files

Quick Start

  1. Add your CSV files to the data/ directory

    • Files should be named like AAP.csv, KSS.csv, etc.
    • Use Schwab's standard transaction export format
  2. Generate the Pine Script:

    python generate.py
  3. Copy to TradingView:

    • Copy schwab-purchase-lots.pine to TradingView's Pine Editor
    • Add the indicator to a chart
    • The indicator automatically shows data for the current symbol if there was an associated csv file for that symbol

What You'll See

  • Blue Labels: Purchase lots with gradient colors (darker = larger lots)
  • Blue Lines: Average cost per share with text labels
  • Summary Table: All symbols, lots, shares, and average costs

File Structure

Schwab-Tv-Blotter/
├── data/                          # Your CSV files go here
│   ├── AAP.csv
│   ├── KSS.csv
│   └── ...
├── output_pine.py               # Main generator script
├── generate.py                  # Quick generation script
├── schwab-purchase-lots.pine # Generated Pine Script
└── README.md

CSV Format

Your Schwab CSV files should have these columns:

  • Open Date: Purchase date (MM/DD/YYYY)
  • Quantity: Number of shares
  • Price: Purchase price per share
  • Cost/Share: Cost basis per share

Usage

Generate Pine Script

# Quick generation
python generate.py

# Custom options
python output_pine.py --data-dir data --output my_script.pine

Update When Adding New Data

  1. Add new CSV files to data/ directory
  2. Run python generate.py
  3. Copy the updated Pine Script to TradingView

Supported Symbols

Stock symbols in the following markets/exchanges

  • NYSE
  • NASDAQ
  • AMEX
  • ARCA

Requirements

  • Python 3.6+
  • Schwab CSV export files
  • TradingView account

Caveats and Improvements

  • some tax lots don't get plotted for some reason, I ran into this issue when there were only 2 lots on a ticker. Um, this is fixed now? Keep an eye out for this just in case.
  • Make label size proportional to the full position. The bucket approach has several limitations.
  • Only works on daily timeframe, would be nice if this could aggregate dynamically per the timeframe
  • I'm sure I'm forgetting other features that I was too impatient to resolve.

Troubleshooting

  • No labels visible: Check that you're viewing the correct symbol chart
  • CSV parsing errors: Ensure your CSV files match Schwab's export format
  • Missing data: Verify CSV files are in the data/ directory

SECURITY WARNING - PRIVATE DATA

CRITICAL: Your Pine Script contains your actual purchase data!

The generated Pine Script files contain your real financial transaction data including:

  • Purchase prices and quantities
  • Purchase dates and cost basis
  • Total investment amounts per symbol
  • Portfolio composition and position sizes

DO NOT:

  • Publish Pine Scripts to GitHub - They contain your financial data
  • Share Pine Scripts publicly on TradingView - Others can see your positions
  • Post Pine Scripts on forums or social media - Your data becomes public
  • Upload to public repositories - Even if you think it's "anonymized"
  • Share screenshots showing your actual purchase lots and costs

SAFE PRACTICES:

  • Keep Pine Scripts private - Only use them on your own TradingView account
  • Use .gitignore - Prevents accidental commits of generated files
  • Delete old Pine Scripts - Remove files you no longer need
  • Check before sharing - Verify no financial data is included
  • Use demo data - For public examples, use fake transaction data

Additional Security Tips:

  • Regular cleanup: Delete old Pine Script files periodically
  • Local only: Keep your CSV files and generated scripts on your local machine
  • Backup safely: If backing up, use encrypted storage
  • Monitor sharing: Be careful when sharing TradingView charts that show your indicators

For Public Examples:

If you want to share your work publicly, create a separate version with:

  • Fake stock symbols (DEMO, TEST, etc.)
  • Random purchase prices and quantities
  • No real financial data

Remember: Your financial data is valuable and private. Protect it like you would protect your bank account information!


License

MIT License - feel free to modify and distribute.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages