Pine Script Compatibility

PyneCore aims for high compatibility with TradingView’s Pine Script v6. This page tracks the implementation status of all major Pine Script features.

Note: PyneCore only supports Pine Script v6. Scripts written in v5 or earlier must be updated to v6 syntax (PyneComp handles this automatically during compilation).

Status Legend

SymbolMeaning
fullFully implemented and tested against TradingView
partialPartially implemented — see notes for limitations
stubFunction exists but returns na or raises NotImplementedError
stub/pluginAPI accepted (scripts don’t break), but no real output — future plugin
pluginNot in core — designed as future plugin extension point
Not applicable to offline execution

Technical Analysis (ta)

FeatureStatusNotes
Moving averagesfullSMA, EMA, WMA, HMA, ALMA, RMA, KAMA, etc.
Momentum indicatorsfullRSI, MACD, CCI, CMO, MFI, ROC, TSI, etc.
Volatility indicatorsfullATR, BB, KC, STDev, Supertrend, etc.
Volume indicatorsfullOBV, ACCDIST, PVT, WAD, WVAD, etc.
Pivot pointsfullAll 7 pivot types
Statistical functionsfullCorrelation, percentile, variance, etc.
Pattern detectionfullCrossover, crossunder, rising, falling, etc.
Total: 74 indicatorsfullPrecision-tested against TradingView

Strategy Simulator

FeatureStatusNotes
Entry/exit ordersfullMarket, limit, stop orders
Position managementfullLong, short, pyramiding
Take-profit / stop-lossfullPrice, ticks, percent-based
Trailing stopsfullOffset-based trailing
OCA groupsfullOne-Cancels-All order groups
Commission modelsfullFixed, percent, per-contract
Margin callsfullTradingView-exact 10-step algorithm
SlippagefullConfigurable tick-based slippage
Equity trackingfullEquity curve, drawdown, P&L
Trade loggingfullCSV export with all trade fields
strategy.close_all()full
strategy.cancel_all()full
Risk managementfullstrategy.risk.* functions

Request Module

FeatureStatusNotes
request.security()fullMultiprocessing with shared memory
request.security_lower_tf()fullReturns arrays of intrabar values
request.currency_rate()fullTOML-based currency pair auto-detection
request.dividends()stubReturns na with ignore_invalid_symbol=True
request.splits()stubReturns na with ignore_invalid_symbol=True
request.earnings()stubReturns na with ignore_invalid_symbol=True
request.financial()pluginFactSet data — external data source
request.economic()pluginMacro data — external data source
request.quandl()pluginNasdaq Data Link — paid external API
request.seed()pluginGitHub repository data
request.footprint()pluginRequires tick-level data

request.security() Details

FeatureStatusNotes
Higher timeframefull1D, 1W, 1M, etc. from lower TF chart
Different symbolfullAny symbol with OHLCV data
Lower timeframe (LTF)fullVia request.security_lower_tf()
Multiple callsfullEach gets its own OS process
Conditional callsfullInside if/for/while blocks
Nested callsfullsecurity(… security(…) …)
barmerge.gaps_offfullForward-fills last value (default)
barmerge.gaps_onfullReturns na between periods
lookahead_offfullConfirmed previous period (default)
ignore_invalid_symbolfullReturns na for missing symbols
lookahead_onDeliberate safety-first exclusion
currency parameterfullAuto-converts via CurrencyRateProvider

Drawing Objects

Scripts using drawing objects will not error out — all API calls are accepted and object state is tracked in memory. However, PyneCore currently has no built-in visualization. A future plot plugin will consume the stored drawing data to render charts.

FeatureStatusNotes
label.*stub/pluginAPI functional, data stored — visualization via plugin
line.*stub/pluginAPI functional, data stored — visualization via plugin
box.*stub/pluginAPI functional, data stored — visualization via plugin
table.*stub/pluginAPI functional, data stored — visualization via plugin
polyline.*stub/pluginAPI functional, data stored — visualization via plugin
linefill.*stub/pluginAPI functional, data stored — visualization via plugin

Core Modules

ModuleStatusFunctionsNotes
mathfull24+ constants (e, pi, phi, rphi)
arrayfull57Wraps Python list
mapfull11Wraps Python dict
matrixfull51Full 2D array operations
stringfull21Named string (not str)
colorfull50+ colorsRGB creation, constants
timeframefull19Conversion, validation
sessionfull8Market session handling
barstatefull5isfirst, islast, isnew, etc.
syminfofull20+ propsFrom TOML metadata
chartfullChart type flags, colors
logfull3info, warning, error
alertfull1 + 3Alert with frequency constants
runtimefull1error() for script termination
inputfullAll input types via function params
plot / hline / fillfullOutput to CSV

Type System

TypeStatusNotes
int, float, bool, strfullNative Python types
Series[T]fullCircular buffer, historical access
Persistent[T]fullCross-bar state via AST transformation
na / NA[T]fullFull NA propagation
ColorfullRGBA with transparency
label, line, boxfullDataclass-based drawing objects
table, polylinefull
chart.pointfullChartPoint in PyneCore
array / matrix / mapfullPython list / custom / dict
footprint / volume_rowstubTypes defined, no data source

Enum Constants

All Pine Script v6 enum constants are implemented:

ModuleConstants
currency21 currency codes (USD, EUR, BTC, etc.)
barmergegaps_on/off, lookahead_on/off
displaynone, all, data_window, pane, price_scale, status_line
color50+ named colors
extendnone, left, right, both
formatinherit, price, volume, percent, mintick
locationabovebar, belowbar, top, bottom, absolute
position9 table positions (top/middle/bottom x left/center/right)
shape10+ marker shapes
sizeauto, tiny, small, normal, large, huge
xloc / ylocbar_index/bar_time, price/abovebar/belowbar
dayofweekmonday through sunday
dividendsgross, net
earningsactual, estimate, standardized
adjustmentnone, dividends, splits
scaleright, left, none

Pine Script Syntax Features

FeatureStatusNotes
FunctionsfullIncluding nested/inline functions
if/else/switchfullVia PyneComp compilation
for/while loopsfull
var (persistent)fullPersistent[T] annotation
varip (intrabar persist)Not applicable in offline mode
Methods on typesfull.get(), .set(), .size(), etc.
User-defined types (UDT)fullVia PyneComp compilation
EnumsfullVia PyneComp compilation
LibrariesfullImport and use Pine libraries
Operator overloadingfull+, -, *, /, %, comparisons
Ternary operatorfullPython conditional expression
Type castingfullint(), float(), str(), bool()
na propagationfullArithmetic, comparison, logical
Multi-return (tuples)full
Default parametersfull
export (libraries)fullVia PyneComp compilation

Not Applicable to PyneCore

These Pine Script features exist only in TradingView’s live charting environment and are not applicable to offline backtesting:

FeatureReason
varipIntrabar persistence — offline bars are confirmed
Realtime bar updatesAll bars are historical in offline mode
alert() triggersNo broker/notification integration
Chart renderingNo visual chart — output is CSV
input() UI widgetsInputs are function parameters or TOML config
Order executionStrategy simulator, not live trading

Precision

PyneCore is precision-tested against TradingView:

  • Indicator values: 0.001% relative tolerance, 0.00000001 absolute tolerance
  • Strategy trades: Exact trade-by-trade matching (245+ trades verified)
  • OHLCV data: float32 storage with 6-significant-digit rounding