PyneCore™

Build Pine Script™-style indicators and strategies in Python.
Measured bit-for-bit against TradingView.

Pine Script™ is a trademark of TradingView. PyneCore™ is not affiliated with TradingView.
PyneCore™ is a trademark of PYNESYS LLC.
Snakes on Pine Tree

A Pine Script™ runtime, written in Python.

PyneCore is a fast, clean Pine Script™ compatible framework in Python. At its core is a runtime that reproduces Pine Script’s bar-by-bar execution model (series, persistent state, function isolation), so you can run and backtest your indicators and strategies in any Python environment — from a notebook to a live trading bot.

Measured Against TradingView. Bar by Bar, Bit by Bit.

Every claim on this page is measured. Pyne in the Wild takes popular open-source Pine Script™ indicators and strategies published on TradingView, compiles each one to Python, and runs it with PyneCore on real market data. Wherever TradingView’s own output can be exported, every plotted value and every trade is compared against it.

153
real TradingView scripts
70 indicators, 83 strategies
100%
compile and run
153/153, zero failures
99.66%
bit-exact values
of 16.1M compared, 119/131 scripts exact throughout
0
trade divergences
across 57,143 compared trades

The remaining 0.34% of values? Within 10−9 relative tolerance — last-digit floating-point rounding where the two runtimes’ math libraries legitimately differ, documented per script. And every result is reproducible - the corpus pins the exact source of each script with a SHA-256 hash.

Script-by-script results at wild.pynesys.io · snapshot 2026-08-08 · the corpus keeps growing

PyneCore Terminal Demo

Download, run, backtest — from one command line.

PyneCore CLI provides an intuitive command-line interface for downloading data, running scripts, and performing analyses. With user-friendly formatting, color codes, and progress bars, every operation becomes transparent. The compile command translates Pine Script™ straight to Python, and run executes it — over history, or on a live feed. More information about PyneCore CLI can be found in the PyneCore CLI documentation.

If you can read Pine Script™, you can read Pyne.

This is a Bollinger Bands strategy in Pine Script™ and Pyne side by side. As you can see, the code is very similar, though Pyne is more pythonic.

Pine Script™

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
//@version=6









strategy("Bollinger Bands Strategy", overlay=true)



source = input.source(close, "Source")
length = input.int(20, minval=1)
mult = input.float(2.0, minval=0.001, maxval=50)

basis = ta.sma(source, length)
dev = mult * ta.stdev(source, length)
upper = basis + dev
lower = basis - dev

buyEntry = ta.crossover(source, lower)
sellEntry = ta.crossunder(source, upper)

if buyEntry
    strategy.entry("BBandLE",
         strategy.long, stop=lower,
         oca_name="BollingerBands",
         oca_type=strategy.oca.cancel,
         comment="BBandLE")
else
    strategy.cancel(id="BBandLE")

if sellEntry
    strategy.entry("BBandSE",
         strategy.short, stop=upper,
         oca_name="BollingerBands",
         oca_type=strategy.oca.cancel,
         comment="BBandSE")
else
    strategy.cancel(id="BBandSE")


plot(basis, "Basis", color=color.blue)


plot(upper, "Upper", color=color.red)
plot(lower, "Lower", color=color.green)

plot(source - source[1], "diff", color=color.yellow)
 

Pyne (Python)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
"""@pyne"""  # Must start with "@pyne" magic comment
# Import Series type
from pynecore import Series
# You can import Pine Script compatible functions
#  and properties from pynecore.lib
from pynecore.lib import (script, strategy, input,
                          ta, plot, color)


# You can define a strategy or indicator with decorator
@script.strategy("Bollinger Bands Strategy", overlay=True)
# Every Pyne code must have a main function
def main(
        # Inputs are defined in main function arguments
        source: Series[float] = input.source("close", "Source"),
        length: int = input.int(20, minval=1),
        mult: float = input.float(2.0, minval=0.001, maxval=50)
):
    basis = ta.sma(source, length)
    dev = mult * ta.stdev(source, length)
    upper = basis + dev
    lower = basis - dev

    buy_entry = ta.crossover(source, lower)
    sell_entry = ta.crossunder(source, upper)

    if buy_entry:
        strategy.entry("BBandLE",
                       strategy.long, stop=lower,
                       oca_name="BollingerBands",
                       oca_type=strategy.oca.cancel,
                       comment="BBandLE")
    else:
        strategy.cancel(id="BBandLE")

    if sell_entry:
        strategy.entry("BBandSE",
                       strategy.short, stop=upper,
                       oca_name="BollingerBands",
                       oca_type=strategy.oca.cancel,
                       comment="BBandSE")
    else:
        strategy.cancel(id="BBandSE")

    # You can use plot function as in Pine...
    plot(basis, "Basis", color=color.blue)
    # ... or return a dictionary with the values
    return {
        "upper": upper,
        "lower": lower,
        # Series annotated variables can be used like in Pine
        "diff": source - source[1]
    }

The runtime is only where it starts.

Pine Script™ Compatible

Though Pyne is actually Python code, with its magic it works the same way as Pine Script™. There are persistent variables, series and function are isolated the same way as in Pine. If you like Pine Script™, you will love Pyne too.

Complete Library

The Pine namespaces you actually write against - ta, math, array, matrix, map, string, request, strategy and the drawing objects - are implemented and validated against TradingView reference data.

Strategy Backtesting

Pine’s strategy model is implemented, not approximated - entry, exit, order, close and cancel, OCA groups, pyramiding, commission, the risk.* guards and the full closedtrades/opentrades history.

Plugin System

PyneCore is extensible with a plain pip install. A plugin registers itself as a data provider, a live broker or an extra CLI command - no fork, no patching, no monkey business.

Data Providers and Live Trading

Download historical OHLCV through the built-in CCXT provider or a venue-specific plugin, then keep the very same script running on a live feed with --live - and let it place real orders with --broker. The official cTrader, Bybit and Capital.com plugins do both.

Open Source

PyneCore is open source and licensed under the Apache v2.0 license. You can use it for free, and you can modify it for your own needs. Contributions are very welcome.

No Dependencies

There are no mandatory dependencies to other libraries (e.g. numpy, pandas) if you just want to use it in your own project. If you use it as a standalone app in CLI, you need to install typer and it is recommended to install rich.

Fast and Clean

It is designed to be as fast as possible, mostly use recursive functions to avoid loops. It is clean, everything is annotated and documented. It is easy to understand and to extend.

Easy to Learn, Easy to Embed

If you know Pine Script™, you already know Pyne - and if you don’t, it is short and straightforward to learn. Use it as a standalone CLI app, or import it into your own project as a plain library.

Bring your existing Pine Script™ with you.

PyneCore contains a connector to our pynesys.io service, which has a fully compatible Pine Script™ compiler (or transpiler if you like). You can compile your Pine Script™ code to Pyne code. If you have API key, PyneCore can compile and run Pine Script™ code directly from CLI or from your own project. The compiler compiles Pine Script™ code to readable and easily understandable Python code, with the help of PyneCore.