TradingView Pine Script, transpiled to Python on your own machine
Indicators, strategies and libraries in Pine Script v4, v5 and v6, compiled to PyneCore.
No API key, no quota, no network.
pine2pyne converts TradingView Pine Script indicators, strategies and libraries into Python scripts for PyneCore, the open-source runtime that runs Pine-style code bar by bar. A converted script can backtest offline on any candles you have, without a TradingView account or chart.
Install
Requires Python 3.11+.
pip install pine2pyne
This installs the pine2pyne command. python -m pine2pyne does the same.
Usage
pine2pyne strategy.pine -o strategy.py
pine2pyne [-h] [-o OUTPUT] [--validate] [-v] [--version] input [input ...]
| Option | Meaning |
|---|---|
input |
One or more .pine files. A quoted pattern such as "src/*.pine" is expanded by pine2pyne itself |
-o, --output |
Output file, or a directory for several inputs. Without it, the code goes to stdout |
--validate |
Check the script, write nothing |
-v, --verbose |
Print each step |
--version |
Print the version and exit |
Examples
| Command | Result |
|---|---|
pine2pyne a.pine |
The code on stdout, so pine2pyne a.pine > a.py gives a clean file |
pine2pyne a.pine -o out/a.py |
Written to out/a.py. Missing directories are created |
pine2pyne a.pine b.pine -o out/ |
out/a.py and out/b.py |
pine2pyne "src/*.pine" -o out/ |
One <name>.py in out/ for every match of the pattern |
pine2pyne a.pine --validate |
✓ a.pine - Valid syntax, or the error |
With several inputs, -o is a directory. A failed file does not stop the batch: every input is
processed, then a summary is printed:
Summary: 41 succeeded, 2 failed
Errors
Errors and warnings go to stderr with the Pine line and column:
✗ bad.pine: Error at 4:6: Pine refuses: cannot assign with ':=' to a history reference (x[n]) [history-target]
A warning (⚠) does not stop the file from being written.
| Exit code | When |
|---|---|
0 |
Every input was converted or validated |
1 |
At least one input failed, or no input file was found |
License
Apache-2.0. PyneCore is Powered by PyneSys (https://pynesys.io).
Metadata
Release files for pine2pyne 0.2.10
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pine2pyne-0.2.10.tar.gz | 269.2 kB | Without provenance | Details for pine2pyne-0.2.10.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pine2pyne-0.2.10-py3-none-any.whl | Python 3 | none | any | Details for pine2pyne-0.2.10-py3-none-any.whl |
Total release size: 566.2 kB
Release files / pine2pyne-0.2.10.tar.gz
| Download URL | pine2pyne-0.2.10.tar.gz |
|---|---|
| Size | 269.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
44a0e39956baeb0eb4088177c99c1115bcbcd78cfe6bf396d29e9646c25d6d04
|
|
BLAKE2b-256 checksum How to use checksums |
9161e81802a4a0d9ef9f620b395d43c24f6df702ef23070bd122ac76c121717e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.13.6 {"installer":{"name":"uv","version":"0.13.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / pine2pyne-0.2.10-py3-none-any.whl
| Download URL | pine2pyne-0.2.10-py3-none-any.whl |
|---|---|
| Size | 297.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8e2b15a6137e49ee3d57d58bed6d732392a39dafc0b1b280b4185ab24ca3bf2d
|
|
BLAKE2b-256 checksum How to use checksums |
93b070c60fc5fd636294d0f8e273639466b08ff34538167bc5acd6747b96f415
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.13.6 {"installer":{"name":"uv","version":"0.13.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for pine2pyne 0.2.10
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.