pinescript-to-python-translator

Installation
SKILL.md

🌲 PineScript to Python Translator

This skill is designed to take raw TradingView PineScript files (.pine) and rigorously deconstruct them into Python-native components so they can be optimized using vectorization and tools like Optuna.

When to use this skill

Use this skill when you want to migrate a backtest from the TradingView ecosystem into a headless Python environment. This is critical for running multi-fold Walk-Forward Analysis (WFA) and Monte Carlo simulations that TradingView cannot handle.

Workflow

  1. Deconstruction & Classification (The IR Build)

    • Parse the .pine script to identify input(), input.int(), input.float(), and input.bool().
    • Classify parameters into three buckets:
      • Signal: Parameters that dictate entries (e.g., length, crossover_threshold).
      • Risk: Parameters that dictate exits (e.g., stop_ticks, trail_offset).
      • Display: Parameters used only for plotting/UI (discard these).
  2. Boundary Extraction

    • For every Signal and Risk parameter, extract the minval, maxval, and step if provided.
    • Format these into Optuna trial suggestions (e.g., trial.suggest_int('length', 10, 50)).
Installs
92
GitHub Stars
18
First Seen
May 9, 2026
pinescript-to-python-translator — mphinance/alpha-skills