# PyneCore > PyneCore is an open-source (Apache 2.0) Python runtime for TradingView-style indicators and strategies; its API follows Pine Script v6. It is validated against TradingView on 1,132 published TradingView scripts: all 1,529 comparable outputs match, 100.000% of 153 million plotted values are bit-identical, and 434,019 strategy trades match TradingView's timing (snapshot 2026-12-04, https://wild.pynesys.io/). - PyneCore runs Pyne code: Python files marked `@pyne`, which PyneCore transforms at import time so they run bar by bar with Pine Script's semantics (series with history, persistent variables, `na`). - PyneCore does not read Pine Script source itself. Pine Script v4, v5 and v6 (v1-v3 on a best-effort basis) is converted to Pyne code by PyneComp, a separate PyneSys service that needs an API key (https://pynesys.io). With the key, `pyne compile script.pine` converts a script and `pyne run script.pine DATA` converts it before running. - PyneCore never reproduces TradingView's lookahead: where TradingView would read data a bar could not have had, PyneCore returns `na`. Every deliberate difference is listed on the Compatibility page. - Install with `pip install "pynesys-pynecore[cli]"` (Python 3.11+). Source: https://github.com/PyneSys/pynecore ## Docs - [What is PyneCore](https://pynecore.org/docs/overview/what-is-pynecore/index.md): Meet PyneCore, the open-source Python runtime for Pyne code. Learn about its bar-by-bar execution model and Pine Script-compatible indicator and strategy library. - [Pine Script Compatibility](https://pynecore.org/docs/overview/compatibility/index.md): Review PyneCore's Pine Script v6 API coverage and measured results against TradingView. Check module compatibility, intentional differences and current limitations. - [FAQ](https://pynecore.org/docs/faq/index.md): Find answers to common PyneCore questions about the runtime, Pine Script compatibility and development workflow, with links to detailed guides and examples. - [Installing PyneCore](https://pynecore.org/docs/getting-started/installation/index.md): Install PyneCore and its optional components for your platform. Follow the setup instructions and prepare an environment for running Pyne code and CLI commands. - [Your First PyneCore Script](https://pynecore.org/docs/getting-started/first-script/index.md): Write and run your first PyneCore script. Learn the required @pyne module marker and basic program structure, then compare Pyne code with ordinary Python. - [Converting from Pine Script](https://pynecore.org/docs/getting-started/converting-from-pine/index.md): Move TradingView Pine Script to Pyne code manually or through the PyneComp compiler service. Compare the workflows and learn when a PyneSys API key is required. - [Core Concepts](https://pynecore.org/docs/overview/core-concepts/index.md): Learn how PyneCore uses AST transformations to execute Pyne code bar by bar. Understand Series history, persistent variables and the state kept by function calls. - [Differences from Pine Script](https://pynecore.org/docs/overview/differences/index.md): Compare Pyne code with Pine Script, including the module marker, Python syntax and explicit state annotations. Learn how ordinary Pyne and the edge profile differ. - [Scripting with PyneCore](https://pynecore.org/docs/scripting/index.md): Write PyneCore scripts with the required module marker and script structure. Learn how Series and persistent state work within Pine Script-style execution. - [Strategy Development](https://pynecore.org/docs/strategy/index.md): Create and test PyneCore strategies with script.strategy(). Configure backtest settings through TOML files and learn the basics of orders and position management. - [request.security()](https://pynecore.org/docs/lib/request-security/index.md): Use request.security() to evaluate other symbols and timeframes in PyneCore. Prepare OHLCV files, provide security data mappings and write multi-context scripts. - [Running Scripts](https://pynecore.org/docs/cli/run/index.md): Run Pyne code on local OHLCV files or provider data with pyne run. Learn command arguments, script settings and the options for continuing with live data. - [Compiling Pine Scripts](https://pynecore.org/docs/cli/compile/index.md): Convert Pine Script files to Pyne code with the pyne compile command and PyneSys API. Configure your API key, output path and compilation options. ## Validation - [Pyne in the Wild](https://wild.pynesys.io/): the public comparison with TradingView, with the result of every corpus script ## Optional - [AST Transformation](https://pynecore.org/docs/advanced/ast-transformations/index.md): Follow the AST passes that give Pyne code its Pine Script execution rules, including series history, isolated state, na handling and request.security() calls. - [Bar Magnifier](https://pynecore.org/docs/advanced/bar-magnifier/index.md): Configure PyneCore's bar magnifier to process strategy order fills using lower-timeframe data. Understand intrabar price assumptions and prepare the required data. - [Basic Usage](https://pynecore.org/docs/cli/basics/index.md): Learn the PyneCore command structure, common CLI options and working directory layout. Install the CLI extras and find help for running commands in a project. - [Broker Plugin Authoring Guide](https://pynecore.org/docs/development/broker-plugin-authoring/index.md): Implement a PyneCore BrokerPlugin using the documented contract for live order handling. Review persistence requirements and the behavior broker authors must test. - [Broker Run Management](https://pynecore.org/docs/cli/broker/index.md): Manage quarantined live broker runs with the PyneCore CLI. Understand quarantine states, inspect what a bot continues to do and resume a run when appropriate. - [Configuring PyneCore](https://pynecore.org/docs/overview/configuration/index.md): Configure a PyneCore working directory with TOML files. Learn how the runtime finds projects and organizes script settings, market data and generated output. - [Contributing](https://pynecore.org/docs/development/contributing/index.md): Set up a PyneCore development environment and prepare contributions. Read the project requirements and workflow for changing code and checking your implementation. - [Data & SymInfo](https://pynecore.org/docs/programmatic/data-and-syminfo/index.md): Supply OHLCV candles and SymInfo metadata when running PyneCore from Python. Learn data conversion options and the timestamp units expected by the runtime. - [Data Management](https://pynecore.org/docs/cli/data/index.md): Download historical OHLCV data with the PyneCore CLI, convert local files between supported formats and aggregate bars into the timeframes your scripts need. - [Debugging](https://pynecore.org/docs/debugging/index.md): Debug PyneCore scripts with print statements, Pine-style logging and IDE breakpoints. Inspect Series values and understand execution after AST transformation. - [Extra Fields](https://pynecore.org/docs/advanced/extra-fields/index.md): Access custom CSV columns alongside OHLCV bars in Pyne code. Learn how extra_fields carries per-bar values and how data loading affects their availability. - [Fast CSV Reader/Writer](https://pynecore.org/docs/advanced/csv-reader-writer/index.md): Read and write market data with PyneCore's CSV tools. Learn about memory-mapped reading, multithreaded writing and the options for processing OHLCV records. - [Function Isolation](https://pynecore.org/docs/advanced/function-isolation/index.md): Understand how PyneCore isolates function calls so each call site keeps its own Series and Persistent state, following Pine Script's bar-by-bar execution rules. - [How Broker Plugins Are Tested](https://pynecore.org/docs/advanced/broker-plugin-testing/index.md): Learn how PyneCore broker plugins are checked with unit tests, an offline conformance lab and venue demo runs, including faults and end-of-run reconciliation. - [IDE Setup](https://pynecore.org/docs/getting-started/ide-setup/index.md): Choose an editor for Pyne code and for PyneCore development. PyneIDE sets up a Pyne project by itself; other editors need a small type checker configuration. - [Integration Patterns](https://pynecore.org/docs/programmatic/integration-patterns/index.md): Integrate PyneCore into Python trading applications using data bridges and script runners. Follow patterns for DataFrames, FreqTrade and other trading frameworks. - [Library Reference](https://pynecore.org/docs/lib/reference/index.md): Browse the PyneCore library overview for built-in market data variables and function usage. Find the modules and types used when writing indicators and strategies. - [Live Mode](https://pynecore.org/docs/advanced/live-mode/index.md): Run PyneCore scripts on live provider data after historical replay. Configure tick updates, persistent intrabar state, paper trading and broker order routing. - [OHLCV Reader/Writer](https://pynecore.org/docs/advanced/ohlcv-reader-writer/index.md): Use PyneCore's OHLCV v2 binary format to store market data with timeframe metadata. Read about file headers, delta-encoded records and memory-mapped access. - [Plugin System](https://pynecore.org/docs/development/plugin-system/index.md): Extend PyneCore with Python entry-point plugins. Learn provider and broker class relationships, configuration files and how plugins add or extend CLI commands. - [Profiling](https://pynecore.org/docs/profiling/index.md): Profile PyneCore backtests with pyne run --profile. Find slow script lines, read execution counts and inspect how runtime is divided between processing stages. - [Project Structure](https://pynecore.org/docs/overview/project-structure/index.md): Explore the PyneCore repository layout and its main components. Find the modules responsible for series data, script execution and the framework's extension points. - [Pyne Ecosystem](https://pynecore.org/docs/overview/ecosystem/index.md): See how PyneCore runs Pyne code, PyneComp converts Pine Script and Pyne in the Wild compares results with TradingView. Learn where Pyne Edge fits in the ecosystem. - [request.currency_rate() & Corporate Events](https://pynecore.org/docs/lib/request-data/index.md): Use request.currency_rate() for timestamp-based currency conversion in PyneCore. Understand the fallback behavior of dividend, split and earnings data requests. - [request.security() Internals](https://pynecore.org/docs/advanced/request-security-internals/index.md): Examine how PyneCore implements request.security(), including AST rewriting, context processes and shared memory used to coordinate bar-by-bar data requests. - [Robustness Tests](https://pynecore.org/docs/cli/robustness/index.md): Test a strategy's backtest with pyne robustness: Monte Carlo, coin-flip, bootstrap, cost and period tests, written as CSV files. Reference of the command's arguments and options. - [Robustness Tests](https://pynecore.org/docs/robustness/index.md): Test how much of a PyneCore strategy's backtest result could be luck: Monte Carlo of the trade sequence, coin-flip tests, bootstrap intervals, extra costs and period breakdowns. - [ScriptRunner API](https://pynecore.org/docs/programmatic/script-runner/index.md): Run PyneCore scripts from Python with ScriptRunner. Configure OHLCV data, symbol metadata and script inputs, then access indicator values and strategy results. - [Symbol Browser TUI](https://pynecore.org/docs/cli/symbol-browser/index.md): Choose provider symbols in PyneCore's terminal browser when running pyne data download. Inspect symbol information and start a download with the inline wizard. - [Symbol Map](https://pynecore.org/docs/overview/symbol-map/index.md): Map TradingView symbol names to provider-native data in a PyneCore workdir. Configure symbol resolution for backtests, live runs and request.security() contexts. - [Testing System](https://pynecore.org/docs/development/testing-system/index.md): Understand PyneCore's testing system, where test scripts run as Pyne code. Review the test structure and how the framework checks behavior in its own runtime. - [time() Offsets on D/W/M Grids](https://pynecore.org/docs/development/tradingview-time-bars-back/index.md): Learn how time() and time_close() handle timeframe_bars_back on daily, weekly and monthly grids, with calendar rules and measurements taken on TradingView. - [Versioning](https://pynecore.org/docs/overview/versioning/index.md): Understand PyneCore version numbers and their relationship to Pine Script API versions. See how breaking changes, feature releases and fixes affect each component. - [Visual Output (Viz)](https://pynecore.org/docs/programmatic/visual-output/index.md): Export PyneCore plot styles and drawing data through the optional NDJSON viz stream. Configure CLI flags or Python accessors to read visual metadata per bar. - [What is Pyne code?](https://pynecore.org/docs/overview/pyne-code/index.md): Learn what Pyne code is: a language for market data and trading scripts using Python syntax, with bar-by-bar execution rules, series history and persistent state. - [adjustment](https://pynecore.org/docs/reference/lib/adjustment/index.md): Look up PyneCore adjustment constants for corporate-action price adjustments. Read their use with request.security() and check the documented compatibility notes. - [alert](https://pynecore.org/docs/reference/lib/alert/index.md): Use alert() in PyneCore to print highlighted terminal messages. Review its parameters and learn why the Pine-compatible freq argument has no effect at runtime. - [array](https://pynecore.org/docs/reference/lib/array/index.md): Create and manipulate typed arrays in PyneCore with the array namespace. Find functions for updating elements, searching collections and calculating statistics. - [barmerge](https://pynecore.org/docs/reference/lib/barmerge/index.md): Configure request.security() bar merging in PyneCore. Compare gaps_on and gaps_off, and understand how lookahead settings align requested data with chart bars. - [barstate](https://pynecore.org/docs/reference/lib/barstate/index.md): Inspect barstate flags in PyneCore to identify first and last bars, new updates and confirmed data. Review how each flag describes historical or live execution. - [box](https://pynecore.org/docs/reference/lib/box/index.md): Create and modify rectangular chart drawings with PyneCore's box namespace. Set price and time coordinates, style borders and backgrounds, and add box text. - [chart](https://pynecore.org/docs/reference/lib/chart/index.md): Read PyneCore chart properties for chart type, color scheme and visible range. Review the available variables and compatibility notes before using them in scripts. - [color](https://pynecore.org/docs/reference/lib/color/index.md): Create and modify PyneCore colors for plots and chart drawings. Look up RGB construction, transparency controls, gradient functions and color component accessors. - [currency](https://pynecore.org/docs/reference/lib/currency/index.md): Look up PyneCore currency code constants such as USD and EUR. Learn their Currency type and how to use them in script declarations and strategy configuration. - [dayofweek](https://pynecore.org/docs/reference/lib/dayofweek/index.md): Use PyneCore dayofweek constants to compare a bar's day with Sunday through Saturday. Learn how the namespace and current-bar variable share the same import. - [display](https://pynecore.org/docs/reference/lib/display/index.md): Look up PyneCore display constants for plot and input visibility. Review the display parameter values and their compatibility with TradingView chart interfaces. - [dividends](https://pynecore.org/docs/reference/lib/dividends/index.md): Review PyneCore dividend fields and gross or net request constants. Check compatibility notes to understand which dividend values return na in the runtime. - [earnings](https://pynecore.org/docs/reference/lib/earnings/index.md): Look up PyneCore earnings fields and constants used by request.earnings(). Read the reference and compatibility notes for estimates and earnings data availability. - [extend](https://pynecore.org/docs/reference/lib/extend/index.md): Control line extension in PyneCore with extend.none, left, right and both. Review how extension constants are passed to line.new() and line.set_extend(). - [font](https://pynecore.org/docs/reference/lib/font/index.md): Choose default or monospace fonts for PyneCore drawing text. Look up font family constants and their use in label.new(), box.new() and table.cell() parameters. - [footprint](https://pynecore.org/docs/reference/lib/footprint/index.md): Review PyneCore volume footprint accessors for buy/sell volume, delta and value-area rows. Understand why these return na when footprint data is unavailable. - [format](https://pynecore.org/docs/reference/lib/format/index.md): Set numeric display formats in PyneCore with format constants. Review their use in script.indicator() and str.tostring() for legend values and text output. - [Global functions](https://pynecore.org/docs/reference/lib/builtins/index.md): Look up global pynecore.lib functions for time and dates, na handling and history buffers. Find the plot-family functions imported directly into Pyne code. - [hline](https://pynecore.org/docs/reference/lib/hline/index.md): Draw fixed horizontal price levels in PyneCore with hline(). Look up its parameters and line style constants for levels that span the full chart history. - [Input Functions](https://pynecore.org/docs/reference/inputs/index.md): Define configurable PyneCore script parameters with input functions. Review supported input types and override main() defaults through generated TOML files. - [label](https://pynecore.org/docs/reference/lib/label/index.md): Create, update and style chart labels with PyneCore's label namespace. Review coordinate overloads and the parameters for positioning text on bars or price levels. - [line](https://pynecore.org/docs/reference/lib/line/index.md): Draw and modify chart lines with PyneCore's line namespace. Look up coordinate overloads and methods for setting line color, style and extension behavior. - [linefill](https://pynecore.org/docs/reference/lib/linefill/index.md): Fill the area between two chart lines with PyneCore's linefill namespace. Learn how to create, inspect and manage fills for price channels and chart zones. - [location](https://pynecore.org/docs/reference/lib/location/index.md): Position plotshape and plotchar markers with PyneCore location constants. Compare placement above or below bars with absolute values and chart-edge locations. - [log](https://pynecore.org/docs/reference/lib/log/index.md): Debug PyneCore scripts with log.info(), log.warning() and log.error(). Review message formatting and the timestamps and bar indices included in console output. - [map](https://pynecore.org/docs/reference/lib/map/index.md): Store and manage key-value pairs with PyneCore's map namespace. Look up functions for creating maps, reading values and updating or removing dictionary entries. - [math](https://pynecore.org/docs/reference/lib/math/index.md): Use PyneCore math functions and constants for indicator calculations. Find arithmetic, trigonometric and logarithmic operations, with notes on na value handling. - [matrix](https://pynecore.org/docs/reference/lib/matrix/index.md): Create and manipulate two-dimensional data with PyneCore's matrix namespace. Look up element access, row and column operations and linear algebra functions. - [order](https://pynecore.org/docs/reference/lib/order/index.md): Sort PyneCore arrays with order.ascending or order.descending. Review the sort direction constants and examples of passing them to array sorting functions. - [pivotpointtype](https://pynecore.org/docs/reference/lib/pivotpointtype/index.md): Select pivot calculation methods with PyneCore pivotpointtype constants. Compare the named methods accepted by ta.pivot_point_levels() in the library reference. - [plot](https://pynecore.org/docs/reference/lib/plot/index.md): Record value series with PyneCore's plot() function. Look up plot parameters and learn how numeric CSV output differs from styles captured by the viz stream. - [polyline](https://pynecore.org/docs/reference/lib/polyline/index.md): Create multi-segment chart drawings with PyneCore's polyline namespace. Review point arrays and the options for curved segments, closed paths and fill colors. - [position](https://pynecore.org/docs/reference/lib/position/index.md): Anchor PyneCore tables to fixed chart locations with position constants. Review each Position value and its use when creating tables and configuring cells. - [Pyne Code Rules](https://pynecore.org/docs/reference/codes/pyne-code-rules/index.md): Look up the P codes PyneCore reports when a module breaks a rule of Pyne code, before it runs: the message, the place it points at and the fix. - [Pyne Edge Profile](https://pynecore.org/docs/reference/codes/edge-profile/index.md): Look up the E codes of the Pyne Edge profile check: the Python constructs and types a script outside the profile uses, and how to stay inside it. - [request](https://pynecore.org/docs/reference/lib/request/index.md): Request other symbols, timeframes and currency rates in PyneCore. Look up request functions and check the fallback behavior of unsupported corporate event data. - [Run-Time Errors](https://pynecore.org/docs/reference/codes/runtime-errors/index.md): Look up the error codes a PyneCore run stops with: what each R code means, the message it shows and what to change in the script or its data. - [runtime](https://pynecore.org/docs/reference/lib/runtime/index.md): Stop a PyneCore script with runtime.error() when an invalid condition occurs. Review the message parameter, return behavior and an example of runtime validation. - [scale](https://pynecore.org/docs/reference/lib/scale/index.md): Set an indicator's price scale in PyneCore with scale.left, scale.right or scale.none. Look up the constants accepted by the script.indicator() scale parameter. - [Script Format](https://pynecore.org/docs/reference/script-format/index.md): Write a valid Pyne code script with the @pyne module marker, imports and main() function. Learn required elements, decorators and the optional edge profile. - [session](https://pynecore.org/docs/reference/lib/session/index.md): Detect trading session phases in PyneCore with session flags. Identify session boundaries and use read-only bar properties to condition script calculations. - [shape](https://pynecore.org/docs/reference/lib/shape/index.md): Choose chart marker styles with PyneCore shape constants. Look up the Shape values accepted by plotshape() and compare the available symbols in the reference. - [size](https://pynecore.org/docs/reference/lib/size/index.md): Set visual sizes for PyneCore labels, shapes and drawing text. Look up size constants and their use in label.new(), box.new(), plotchar() and plotshape(). - [splits](https://pynecore.org/docs/reference/lib/splits/index.md): Look up splits.numerator and splits.denominator for request.splits() in PyneCore. Understand the constants and why stock split requests currently return na. - [str](https://pynecore.org/docs/reference/lib/str/index.md): Work with text in PyneCore indicators and strategies using the str namespace. Find string search, formatting and conversion functions with arguments and examples. - [strategy](https://pynecore.org/docs/reference/lib/strategy/index.md): Manage strategy entries, exits and orders with PyneCore's strategy namespace. Look up position metrics, cancellation methods and functions used in backtests. - [strategy.closedtrades](https://pynecore.org/docs/reference/lib/strategy_closedtrades/index.md): Inspect closed trades in PyneCore with strategy.closedtrades functions. Look up entry and exit details, bar indices, commissions and profit metrics by trade number. - [strategy.opentrades](https://pynecore.org/docs/reference/lib/strategy_opentrades/index.md): Inspect open trades in PyneCore with strategy.opentrades functions. Read entry details, profit and loss, commissions and drawdown statistics by trade number. - [strategy.risk](https://pynecore.org/docs/reference/lib/strategy_risk/index.md): Define PyneCore strategy risk rules that close positions, cancel pending orders or prevent new entries. Review risk function parameters and script examples. - [syminfo](https://pynecore.org/docs/reference/lib/syminfo/index.md): Access current-symbol metadata with PyneCore's syminfo namespace. Look up ticker names, exchange prefixes and currency fields, with variable types and examples. - [ta](https://pynecore.org/docs/reference/lib/ta/index.md): Look up PyneCore technical analysis functions in the ta namespace. Find moving averages, momentum oscillators and volatility calculations with usage examples. - [table](https://pynecore.org/docs/reference/lib/table/index.md): Create and populate chart tables with PyneCore's table namespace. Review functions for cells, text and styling to display script data or strategy statistics. - [text](https://pynecore.org/docs/reference/lib/text/index.md): Control drawing text in PyneCore with text alignment, formatting and wrapping constants. Look up options for labels, boxes and table cells in the reference. - [ticker](https://pynecore.org/docs/reference/lib/ticker/index.md): Build ticker identifiers for request.security() in PyneCore. Review exchange-qualified symbols, Heikin Ashi support and limitations of other synthetic charts. - [timeframe](https://pynecore.org/docs/reference/lib/timeframe/index.md): Detect timeframe changes and convert timeframe strings in PyneCore. Look up functions and properties for intraday, daily, weekly and monthly bar intervals. - [Type System](https://pynecore.org/docs/reference/types/index.md): Review PyneCore primitive types, Series and Persistent annotations, collections and drawing types. Learn how type declarations affect values during bar execution. - [volume_row](https://pynecore.org/docs/reference/lib/volume_row/index.md): Review PyneCore volume_row accessors for footprint price boundaries and buy/sell volume. Understand the na results when the runtime has no footprint data. - [xloc](https://pynecore.org/docs/reference/lib/xloc/index.md): Choose bar-index or timestamp coordinates for PyneCore labels and lines with xloc constants. Review the values accepted by label.new() and line.new(). - [yloc](https://pynecore.org/docs/reference/lib/yloc/index.md): Position PyneCore labels at a price, above a bar or below a bar with yloc constants. Learn how these settings affect the y coordinate passed to label.new().