PyneCore runs Pine Script-style trading code in Python. You write ordinary Python, and PyneCore rewrites it at import time with AST transformations, so it executes bar by bar with Pine Script's semantics: series with history, variables that keep their value between bars, and na for missing data. The rest of the Python ecosystem stays available to the same code.
PyneCore is tested against TradingView on 809 published TradingView scripts (Pine Script v4 to v6, converted to Pyne code with PyneComp). All 1,090 comparable outputs match, 99.714% of 99 million plotted values are bit-identical, and 289,074 strategy trades match TradingView's timing (snapshot 2026-09-27). Every script and every result is public at Pyne in the Wild, and the Compatibility page lists the status of each Pine Script feature.
- Pine Script's bar-by-bar execution model in plain Python
- Scripts marked with
@pyneare transformed when they are imported - No mandatory dependencies outside the Python standard library
Seriesvariables with bar history andPersistentvariables that keep state between bars- Function isolation: every call of a function keeps its own persistent state
nahandling that follows Pine Script- Every
ta.*function of Pine Script v6 - Pine Script-compatible strategy backtesting
"""
@pyne
"""
from pynecore.lib import script, close, ta, plot, color, input
@script.indicator(title="Bollinger Bands")
def main(
length=input.int(20, "Length", minval=1),
mult=input.float(2.0, "Multiplier", minval=0.1, step=0.1),
src=input.source(close, "Source")
):
# Calculate Bollinger Bands
basis = ta.sma(src, length)
dev = mult * ta.stdev(src, length)
upper = basis + dev
lower = basis - dev
# Output to chart
plot(basis, "Basis", color=color.orange)
plot(upper, "Upper", color=color.blue)
plot(lower, "Lower", color=color.blue)A script is marked with a magic comment in its docstring:
"""
@pyne
"""PyneCore's import hook recognizes the marker and applies its AST transformations to the module when it is imported.
A series variable keeps its history across bars, as in Pine Script:
from pynecore import Series
price: Series[float] = close
previous_price = price[1] # Access previous bar's priceA Persistent annotation keeps a variable's value from one bar to the next:
from pynecore import Persistent
counter: Persistent[int] = 0
counter += 1 # Increments with each barEvery call of a function keeps its own persistent state:
def my_indicator(src, length):
# Each call gets its own instance of total
total: Persistent[float] = 0
total += src
return total / length# Basic installation
pip install pynesys-pynecore
# With CLI tools (recommended)
pip install pynesys-pynecore[cli]
# With all features including data providers
pip install pynesys-pynecore[all]Windows: PyneCore needs timezone data that Windows does not ship. The
[cli]and[all]extras install thetzdatapackage. With the basic installation, runpip install tzdataif you get timezone errors.
- Create a file with the
@pyneannotation:
"""
@pyne
"""
from pynecore.lib import script, close, plot
@script.indicator("My First Indicator")
def main():
# Calculate a simple moving average
sma_value = (close + close[1] + close[2]) / 3
# Plot the result
plot(sma_value, "Simple Moving Average")- Run it with the PyneCore CLI:
# First, download some price data
pyne data download ccxt --symbol "BYBIT:BTC/USDT:USDT"
# Then run your script on the data
pyne run my_script.py ccxt_BYBIT_BTC_USDT_USDT_1D.ohlcvPyneCore runs Pyne code. Existing Pine Script (v4, v5 and v6, and v1 to v3 on a best-effort basis) is converted to Pyne code by PyneComp, a separate PyneSys service that needs an API key. With the key, the pyne CLI compiles .pine files for you:
# Run a Pine Script file directly (requires PyneSys API key)
pyne run my_indicator.pine ccxt_BYBIT_BTC_USDT_USDT_1D.ohlcv --api-key YOUR_API_KEY
# Or compile Pine Script to Python first
pyne compile my_indicator.pine --api-key YOUR_API_KEY
# Then run the compiled Python file
pyne run my_indicator.py ccxt_BYBIT_BTC_USDT_USDT_1D.ohlcvYou can get an API key at pynesys.io.
- Your scripts run outside TradingView, without its platform restrictions or code size limits.
- Python's data science, machine learning and analysis libraries work in the same code as the trading logic.
- The match with TradingView is measured on real published scripts: 99.714% of 99 million plotted values are identical to the bit.
- The runtime and its library are open source under the Apache 2.0 license.
If you have Pine Script code you want to run in Python, PyneComp converts it to Pyne code. You can use it on the web, from the pyne CLI with an API key, or through the PyneSys Discord bot: /pyne-help shows how the bot works, /pyne-convert converts a script, and every Discord user gets 3 free conversions.
The subscription plans on pynesys.io raise the daily conversion limit and the maximum script size. They also fund the development of PyneCore, which stays free and open source.
- Documentation: pynecore.org
- Validation report: Pyne in the Wild, where every corpus script is compared with TradingView
- Discussions: GitHub Discussions
- Discord: discord.pynesys.io
- X: x.com/pynesys
- Website: pynecore.org
PyneCore is licensed under the Apache License 2.0.
Pine Script™ is a trademark of TradingView, Inc. PyneCore is not affiliated with, endorsed by, or sponsored by TradingView. This project is an independent implementation of the Pine Script language concept in Python; its results are measured against TradingView on Pyne in the Wild.
Trading involves significant risk of loss and is not suitable for all investors. The use of PyneCore does not guarantee any specific results. Past performance is not indicative of future results.
- PyneCore is provided "as is" without any warranty of any kind
- PyneCore is not a trading advisor and does not provide trading advice
- Scripts created with PyneCore should be thoroughly tested before using with real funds
- Users are responsible for their own trading decisions
- You should consult with a licensed financial advisor before making any financial decisions
By using PyneCore, you acknowledge that you are using the software at your own risk. The creators and contributors of PyneCore shall not be held liable for any financial loss or damage resulting from the use of this software.
PyneCore is part of the PyneSys ecosystem. For commercial support, custom development or enterprise solutions, contact us at pynesys.com/contact.