Skip to content

amhashmi75/TradingView-Combined

Repository files navigation

TradingView Combined Workflow

This folder contains a combined, self-contained workflow that runs both TradingView automation (screenshots + data download) and n8n upload operations sequentially.

Overview

The combined workflow:

  1. TradingView Automation: Captures screenshots and downloads CSV data from TradingView charts
  2. n8n Upload: Uploads the generated files to your n8n webhook

All operations are independent and do not affect the original workflows in:

  • C:\Cursor Projects\Data Tradingview
  • C:\Cursor Projects\Auto Browser

Prerequisites

  • Node.js (v14 or higher) - Download
  • Python 3 (v3.7 or higher) - Download
  • TradingView Account - The script uses a persistent browser profile for authentication

Setup (First Time Only)

  1. Run setup_combined.bat to install all dependencies:

    • Node.js packages (Playwright)
    • Playwright browsers
    • Python packages (requests)

    This may take several minutes, especially when installing Playwright browsers.

Usage

Running the Combined Workflow

Simply double-click run_combined_workflow.bat or run it from the command line:

run_combined_workflow.bat

Running with Custom Chart URL

You can pass a custom TradingView chart URL as an argument:

run_combined_workflow.bat "https://www.tradingview.com/chart/..."

What It Does

  1. Step 1 - TradingView Automation:

    • Opens TradingView in a browser
    • Selects the configured layout
    • For each timeframe (3M, 1Y, 5Y):
      • Captures a screenshot
      • Downloads CSV data
    • Saves files to downloads\ folder
  2. Step 2 - n8n Upload:

    • Scans the downloads\ folder
    • Matches screenshots with CSV files by symbol and period
    • If csv_last_upload_folder is set: compares each CSV to the last-upload baseline and sends only new rows (delta) to the webhook; unchanged files can be skipped or sent as header-only (see when_no_new_rows)
    • Uploads matched pairs to the n8n webhook (same filenames; recipient sees less data when delta is used)
    • After upload: latest CSV becomes the new baseline in the last-upload folder; the previous baseline is moved to the full archive; screenshots go to screenshot archive

Configuration

n8n Configuration

Edit n8n_config_v2.json to configure:

  • webhook_url: Your n8n webhook URL
  • image_folder: Where screenshots are stored (default: downloads\screenshots)
  • csv_folder: Where CSV files are stored (default: downloads)
  • csv_last_upload_folder: Folder for the "last upload" baseline per symbol/period (e.g. downloads\LastUpload). If set, only new CSV rows (delta) are sent; the latest file is stored here after upload and the previous baseline is moved to csv_archive_folder. Leave empty to send full files every time.
  • archive_folder: Where screenshots are archived after upload
  • csv_archive_folder: Where CSV files are archived (previous baseline is moved here when using delta)
  • when_no_new_rows: When a CSV has no new rows compared to the baseline: "skip" = do not upload that set (1 or 2 of the 3 data files may be omitted); "upload_zeros" = still send all 3 data files (header-only for unchanged sets). Default: "upload_zeros".
  • require_complete_sets: Require both image and CSV before uploading (default: true)
  • skip_periods: Periods to skip (default: ["1M"])

TradingView Automation

The Node.js script can be configured via environment variables:

  • TV_PROFILE_DIR: Browser profile directory (default: %USERPROFILE%\AppData\Local\TradingView_Bot)
  • TV_OUTPUT_DIR: Output directory for downloads (default: ./downloads)
  • TV_SCREENSHOT_DIR: Screenshot directory (default: ./downloads/screenshots)
  • TV_LAYOUT_NAME: TradingView layout name (default: "KWEB Regular")
  • HEADLESS: Run browser in headless mode (default: "0" = visible)
  • TV_SCREENSHOTS: Enable screenshots (default: "1")
  • TV_DOWNLOAD: Enable CSV downloads (default: "1")

Example:

set TV_LAYOUT_NAME=My Custom Layout
set HEADLESS=1
run_combined_workflow.bat

File Structure

TradingView Combined/
├── downloads/                    # Output directory
│   ├── screenshots/             # Screenshot storage
│   │   └── Archive/             # Archived screenshots
│   ├── LastUpload/              # Last-upload baseline (one CSV per symbol_period when using delta)
│   └── Archive/                 # Archived CSV files (and previous baselines when using delta)
├── node_modules/                # Node.js dependencies
├── tv-download-with-screenshots-v2.js  # TradingView automation script
├── n8n_uploader_v2.py          # n8n upload script
├── n8n_config_v2.json          # n8n configuration
├── package.json                 # Node.js dependencies
├── requirements_n8n.txt         # Python dependencies
├── setup_combined.bat           # Setup script (run once)
├── run_combined_workflow.bat   # Main workflow script
└── README.md                    # This file

Troubleshooting

"Node.js dependencies not found"

  • Run setup_combined.bat to install dependencies

"Python dependencies not found"

  • Run setup_combined.bat to install dependencies
  • Ensure Python is in your PATH

"Could not find layout"

  • Check that the layout name in TV_LAYOUT_NAME matches your TradingView layout exactly
  • Use setup mode: set TV_SETUP=1 then run the workflow to manually configure

"No files to upload"

  • Ensure the TradingView automation completed successfully
  • Check that both screenshots and CSV files were generated
  • Verify folder paths in n8n_config_v2.json

Browser Profile Issues

  • The script uses a persistent browser profile for authentication
  • First run may require manual login to TradingView
  • Profile location: %USERPROFILE%\AppData\Local\TradingView_Bot

Notes

  • The workflow is sequential: automation must complete before upload starts
  • Files are archived (moved) after successful upload, not deleted
  • When csv_last_upload_folder is set: the webhook receives the same filenames as before; only the CSV content is smaller (new rows only, or header-only for unchanged sets if when_no_new_rows is "upload_zeros")
  • Original workflow folders remain completely untouched
  • All output files are stored in the Combined folder's downloads\ directory

Support

For issues or questions, refer to the original workflow documentation:

  • TradingView Automation: C:\Cursor Projects\Data Tradingview
  • n8n Uploader: C:\Cursor Projects\Auto Browser

About

TradingView chart download and screenshot automation tools

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors