Release notes for pineforge-codegen. From 1.0.0 on, versions of codegen and
pineforge-engine are
supported as exact pairs; on the 0.x line they are independent. See the
pairing rule.
- Keep a section for each released version, including prereleases. Use the exact tag version and release date when published; leave a planned release marked Unreleased until its tag exists.
- Summarize changes users can observe: the Python and JSON contract, emitted C++ and engine requirements, support or warning changes, packaging, and security fixes. Link the merged pull requests that supply each change.
- Call out migration steps and compatibility limits explicitly. A pair change requires regenerated C++ and relinked strategy libraries, even when the C ABI number is unchanged.
- Draft from merged changes since the previous release tag, then verify against the release commit. A prerelease note describes changes since the preceding prerelease or stable tag; the final stable note consolidates the series.
-
Strategy sizing constants retain their string values in expressions, aliases and helper calls. Host order and risk settings convert these values to their numeric representation only at the setting boundary.
-
timeframe.in_secondsandtimeframe.changeresolve an evaluated empty string to the chart period, including input, variable, function-return and named arguments. The argument is evaluated once, and nonempty strings keep their explicit period. Barenaremains accepted; the value returned bytimeframe.change(na)is still awaiting verification against TradingView. Non-string timeframe arguments are refused before C++ emission with the stablePF-E2095type diagnostic and a source location, including input values, reassignments, indicator results and helper parameters. Equally specific diagnostic templates distinguish primitive types from qualifiers using their catalog argument kinds. Dotted builtin signatures retain supplied arguments, including escaped string literals and VWAP anchors. (#394) -
Script identifiers spelled like integer-to-float conversion temporaries, including the underscore suffixes of nested conversions, now use the generator's reserved-name escaping.
-
Reference-typed UDT fields keep their type when initialized or reassigned with
na, including array defaults. Drawing handles cross user-function and tuple boundaries by value, andlabel(na)produces a missing label handle. Polyline locals, arrays, fields and delete methods retain opaque handles and argument evaluation while rendering remains a visual no-op. -
Generated function variants and persistent local copies avoid authored and generated member names, including names ending in
_cs1and composed names that overlap collection-history or requested-context storage. Persistent declarations in sibling blocks also retain distinct storage when a script uses their generated spelling. Declarations, calls and history storage use the same allocated identities, including when selecting reachable variants for emission. Regenerate C++ and relink affected strategies. -
Persistent declarations accept a type qualifier after
varorvarip. Lower-timeframe requests return independently typed arrays for inline and helper-returned tuple payloads. -
Complete nested indentation levels can combine tabs and spaces. Requested
na/nzhelper parameters retain their bindings beside time operations; global tuple declarations and their member histories share one requested sample. Uncalled forwarding helpers no longer allocate unresolved TA buffers for their unreachable call variants (#372). Bare tuple-element history payloads retain their located refusal. Tuple histories rendered through the expression visitor, including reads through globals, retain their chart series and warning. Resolvable variants of a reachable helper retain their TA state even when registered through an uncalled caller. Requested builtin tuples reuse their existing sampled results, and mixed-clock tuple history uses the registered history diagnostic. -
Built-in size, position, line/label style and shape constants retain their string values in variables, selections, function arguments and returns, and string input defaults/options. This fixes ambiguous C++ assignments, NUL strings, unsupported size inputs and null-pointer string construction (#389). Sort-order constants retain their distinct
sort_orderidentity through defaults and comparisons; invalid string conversions are diagnosed at their Pine location, including individual elements of string input options.array.sort_indiceshonors a supplied sort direction. Scalar function overloads no longer crash during type checking. Regenerate C++ and relink affected strategies. -
A zone name the engine rejects now makes calendar-form
timestamp()stop the run at its first evaluation, instead of silently calculating a UTC value. The paired engine reports a typed timezone error identifying the failed bar. An engine without the typed helper prints the text without the bar prefix, an arm that paired releases do not meet. Accepted zones and UTC are unchanged; the singleTIMESTAMP_REJECTED_ZONE_STOPS_RUNswitch restores the old behavior (the compatibility macros stay in the output of a script that callstimestamp()with a calendar). Not covered: the uncheckedsetenv("TZ", ...)of the sealed branch and the restoringsetenvorunsetenvin the same lambda; on ENOMEM the environment stays unchanged and the conversion silently uses the previous zone. Setting the switch toFalserestores behavior, not the original emitted bytes: the timezone macro block and newly reserved names remain. Regenerate C++ and relink affected strategies. -
User functions retain array, object and string result types through branch returns and history clones. Untyped arguments retain collection element types through nested calls and tuple bindings, and reassigned matrix locals keep their initializer's matrix type. (#391)
-
Deeply nested user-function calls share type-inference work within each expression query, including when a return type remains unresolved.
-
array.sort_indicesreturns integer indices, accepts typedarray<int>results and honors ascending/default or descending order in namespace and method calls, including named arguments. Numericnavalues sort last in ascending order and first in descending order; string arrays use lexical ordering. The source array is unchanged. (#392)
- Pine v6 reports located errors for a missing
color.newtransparency,fill(transp=...), calendar-number timestamp defaults ininput.timewith a time zone string as the first timestamp argument or atimezonekeyword, literal plot widths below one, and variable or function declarations namedrange. input.string,input.timeframe,input.symbol,input.sessionandinput.text_areacarry never-reassigned global string literals into defaults and options, including var declarations; an unproven variable default is now a located error instead of a silent empty default, while an option that cannot be proven keeps the existing unsupported marker in the manifest.- Untyped history parameters now infer the enclosing call's primitive type through immutable plain locals, fixed-result builtins and user-call variants whose result the callee body proves, to the same type family as an explicit parameter declaration.
- Pine v6 now refuses an
iforwhilecondition whose numeric value comes from ata.*call or a built-in variable such asstrategy.position_size, as TradingView does. Use a comparison such asta.change(t) != 0for a bool condition. Bool overloads and Pine v5 libraries keep their existing behavior. (#361) - A Pine string literal that holds a NUL now keeps its whole length. Codegen
built every string literal with
std::string("..."), which is made from a C string and ends at the first NUL, so "a", NUL, "b" had length 1 (TradingView gives 3), equalled its own one-letter prefix, and two literals that differed only after the NUL compared equal. A literal with a NUL is now built with the number of bytes it stands for; a literal without one is spelled as before, so the generated code of every other script is unchanged. Not covered, and still cut at the first NUL as before: the default and the options of the string inputs (input.string,input.symbol,input.session,input.timeframe,input.text_area), which the settings receipt and the manifest equal, an input title, and the timeframe and footprint-column literals. One comparison changes with it: a string input whose default holds a NUL no longer equals the literal it was given, because the default is cut and the literal is not (the two were equal before only because both were cut). Avarthat is read with history and starts from a literal with a NUL was refused (its first value put the NUL byte itself into the generated code); it now translates and keeps the whole literal. - Direct retained record fields built from stable
vararrays, and direct plainvararray aliases, stay live through their creation bar and then keep their own copy of the array as it stood at the end of that bar; two holders built from one array do not share it.copy()of such a record keeps its existing compile error. Requested evaluations, collection history, nested records and intrabar recalculations keep their previous lowering. Regenerate C++ and relink affected strategies. str.split(source, "")with an empty separator now returns one part per UTF-16 unit, as TradingView does: "axb" gives three parts, an accent or a CJK character between two letters three, an emoji between two letters four (an emoji is a high and a low surrogate, each kept as its own three-byte part). It returned the whole string as one part, even for plain ASCII. The empty text still has one part, as in TradingView. A separator that is not empty splits as before, through the engine.- A script variable spelled like one of the generator's tuple element bindings (
_tuple_result_0_elem_0) now gets a private name instead of redeclaring the binding. - A local declared in a function or method and spelled like a built-in variable now keeps its own type, history storage and reads. Exceptions: a string local spelled like a price field (
open,high,low,close,hl2,hlc3,hlcc4,ohlc4,volume) that is read with history in a function requested throughrequest.securityis still refused, as before; the support check still warns thatbar_index,last_bar_indexandtimenowdiverge from TradingView at every read of a local with that name; a script that declares the same built-in name in several callable shapes is accepted where an ordinary name is refused by the shared-Series check; and the confirmed-bar request receipt of a request inside the declaring function names the local by its internal storage spelling. - A function-local string read with history now keeps its string type in concatenations, so the emitted C++ joins the current and previous values without applying
std::to_stringto a string (#354). - A function or method parameter spelled like a built-in variable (
close,high, ...) now keeps its[n]history operator and gives the same values as when the parameter has another name (#360). - A
vardeclared in one block no longer shares storage with a plain variable of the same name in a sibling block, so it keeps its value across runs (#359). - A float setting of a built-in indicator computed from an input now keeps
its fraction, as on TradingView: the multiplier of
ta.bb,ta.bbw,ta.kc,ta.kcwand theta.vwapbands, the factor ofta.supertrend, the arguments ofta.sar, and the offset and sigma ofta.alma(#362). Regenerate C++ and relink affected strategies. str.length,str.posandstr.substringnow count and cut text in UTF-16 code units, as TradingView does: an emoji is two units and every other character one. They counted UTF-8 bytes, so an accent counted 2, a CJK character 3 and an emoji 4, and a position or a cut after such a character was off by the extra bytes. The helpers are emitted into the generated file only when its code calls one of the three functions (a call that is only a plot argument emits nothing), so every other script keeps the text it had; the engine is not involved. A cut between the two units of an emoji keeps each half as its own three-byte sequence (the length of a half is one unit), the formstr.splitgives its parts. Such a half never occurs inside a text that holds the whole character, so three things differ from TradingView: joining the two halves again, with+orarray.join, does not give back the original four bytes, so the joined text does not equal the original text; a search for a half in the text it was cut from finds nothing (str.posreturns -1, where the one byte the old cut gave was found at the same position, andstr.containsreturns false); and a half is not equal to, or at the start or end of, a part of that text that holds the whole character. A begin position that lies inside the bytes of a text but past its units (5 on "a", an emoji, "b") now stops the run; before, it returned the bytes after that position.
str.format_timenow uses TradingView's documented defaults when arguments are omitted:"yyyy-MM-dd'T'HH:mm:ssZ"for the format and the exchange time zone (syminfo.timezone) for the timezone. Pass"yyyy-MM-dd"and"UTC"explicitly to restore the previous output. Regenerate C++ and relink affected strategies.- A
whenargument on a strategy order call in Pine v6 now reportsPF-E2081, explaining that v6 removed the argument and recommending anifstatement around the call. Other unknown keywords keepPF-E2027. - Pine identifiers spelled like generated state members or helpers use the C++ name allocator, including history-bearing locals in requested helpers.
- History retention can be selected with keyword-only
history_capacityintranspile(),transpile_full(),transpile_with_request_inventory()andgate/glue.py::transpile_json(). The JavaScript worker template does not pass this option. Without a Pine directive, large constant offsets infer sufficient bare history and dynamic offsets select this package's 5000-slot retention default. Static operator overflow and invalid capacities have typed diagnostics. Explicit runtime history bounds stop withpine_runtime_limitand argumentslimit=max_bars_back,max=N; in-capacity warmup reads retain their missing-value behavior. A Pinemax_bars_backlarger thanhistory_capacitykeeps its slots in the stores, but the offset checks usehistory_capacityalone. Requested-helper history references preserve their C++ members when a helper local or a mutable global that the request reads has the same name as one of them. Regenerate C++ and relink affected strategies. drawing_capacity, accepted bytranspile(),transpile_full(),transpile_with_request_inventory()andgate/glue.py::transpile_json(), bounds live lines, boxes and labels independently after Pine's existing collection step. Creating or copying beyond the selected bound stops withpine_runtime_limitand argumentslimit=live_drawings,max=N. Pine declaration counts keep their ordinary TradingView collection behavior; linefills are outside the bound. Typed stops require the paired engine catalog'slive_drawingsvalue. Omitting the option preserves drawing emission and collection. The JavaScript worker template does not pass this option. Capacities outside the native int64 domain are refused even for scripts without drawings. Regenerate C++ and relink affected strategies.- Typed
array.from()initializers now match their declared element type, including function-localvarandvariparrays of timestamps. - Variables initialized from
backadjustment.*,settlement_as_close.*andadjustment.*constants now use integer storage in emitted C++. int(x)of a floating value, and a storedmath.floor(x),math.ceil(x)ormath.round(x), is a 64-bit integer whatever its magnitude, as in TradingView:int(1.7e12),int(math.floor(1.7e12))andv = math.floor(1.7e12)are all 1700000000000. The generated C++ used to read such a value outside the 32-bit range as the integerna(-2147483648), which then flowed into arithmetic as that number. A value that does not fit 64 bits, and a NaN, readnaon every compiler and architecture. A variable, function result, record field or int array that holds the result of such an expression isint64_t, and a function parameter that receives one follows. A 32-bit integerna(int(na),bar_index, a narrow input) that meets one of them in a selection arm, a position of a tuple-valued selection, a store or arequest.securitypayload staysnainstead of becoming the number -2147483648. A history read (int(x[1])), a builtin float member (int(strategy.equity)) and a float field of a record (int(b.v)) count as floating values too. This changes generated C++ for scripts that use these forms: regenerate and relink affected strategies.- Repeated explicit input titles now have separate override keys: the first
keeps the bare title, and later inputs use
<title>#<n>, starting at 2 and skipping authored titles and keys already assigned. The manifest, effective settings receipt and input getters use the same keys. The checked input setter now accepts the bare title for the first input instead of refusing it as ambiguous; the legacy input setter now sets only the first input instead of every input with that title. Repeated explicit titles no longer trigger the shared-key warning; remaining collisions involving untitled fallbacks still warn. - A chart TA constructor length that shadows a global input or constant now follows its lexical binding; a series length for
ta.percentile_nearest_ranknow uses the engine'sSeriesPercentileNearestRankbuffer at each call site, including repeated calls from a loop. A call inside a conditional appends only when it runs.PF-E5092remains the refusal for a series length ofta.sma(#295), and its message names the Pine function (ta.sma, notta::SMA) and says that TradingView accepts the call. Every otherta.*function keepsPF-E5009and its wording, which makes no claim about TradingView: the functions where TradingView refuses a series length too (ta.rma,ta.ema,ta.rsi,ta.atr,ta.dmi,ta.macd,ta.kc,ta.hma,ta.tsi,ta.rciand theatrPeriodofta.supertrend) and the ones with no recorded result. - Constant-expression input defaults can size TA constructors while retaining the input getter in runtime resets (#295).
- A
request.securitypayload may read a global that is an element of a tuple declaration of a pure user function ([_, g] = pair(x)withpair(value) => [value, value + 7.0]), directly or through a function that reads it: the declaration is evaluated on the requested bar, as in TradingView, and only the element read is lowered. The function must have a one-tuple-literal body over its parameters, the requested bar's fields and literals, and be called positionally with arguments that have no state. A function with ata.*call,var,varip, a request or a method, a multi-statement body, and the history of an element (g[1]) keep their refusals. line(na)andbox(na)emit the same missing handles as typed drawing declarations initialized withna(#295).- Literal
nain emitted strategy string parameters uses the empty-string sentinel, includingstrategy.exit'sfrom_entry(#295). - Array bindings destructured from a helper's tuple retain their collection type for built-in method calls (#295).
ifandswitchexpressions reassigned to a history-bearing variable update its current Series slot (#295).- Pine identifiers
barandHUGEuse the existing C++ name escape without changing authored input titles (#295). - Colliding direct scalar history locals in ordinary functions get declaration-owned Series storage and retain separate call-site histories, including computed initializers that read a same-named global and locals of different scalar families (#295).
- Direct
size,first,lastandgetreads ofline.all,box.all,label.allandlinefill.alluse live arena order; aliases and mutations raisePF-E5086, andpolyline.allrequires engine support (PF-E5085) (#295). - C++ name escaping covers the macros defined by the audited math, limits, C++ wrapper and paired engine headers, retaining authored input keys (#295).
- A keyword argument of a built-in call reaches its own parameter.
timeframe.in_seconds(timeframe = ...)andtimeframe.change(timeframe = ...)used the chart's timeframe instead of the named one,strategy.closedtrades.*(trade_num = ...)andstrategy.opentrades.*(trade_num = ...)read trade 0 instead of the named trade,str.format_time(time, timezone = ...)read the timezone as the format,timestamp(timezone = ..., year = ..., ...)dropped the timezone and a skippedhourmovedminuteinto its slot,matrix.new<float>(rows = 2, columns = 3)built a matrix with no rows and no columns,time("60", timezone = ...)andtime_closeread the timezone as the session, andmath.random(seed = 3)read the seed as the minimum; none of them raised a diagnostic. A keyword none of these calls declares is now refused with the unknown-keyword diagnostic, as TradingView refuses it. Regenerate C++ and relink strategies. - Strategy order calls report unknown keyword arguments at the keyword (#286; #327).
- Strategy orders with omitted
qtyuse the default size; integerswitchandifresults with an explicitnaarm preserve NaN, andstrategy.risk.allow_entry_inretains input-dependent directions (#292). strategy.risk.max_drawdown()andstrategy.risk.max_intraday_loss()called withtype = strategy.percent_of_equity, or withstrategy.percent_of_equityheld in a variable, apply the percentage limit as the positional form does. The keyword and variable forms were read as an amount of account currency, so a limit of 10 halted trading early (#325, #326, #327). Regenerate C++ and relink strategies.max_bars_back(series, DEPTH)with aconst intDEPTHkeeps that many bars of history for the series, as the literal depth does. The named constant was ignored, so history reads beyond the default depth returnedna(#326, #327). Regenerate C++ and relink strategies.- A
vararray with a non-empty initializer declared inside anifblock is initialized when the declaration is first reached, as in TradingView. The generated code reset it to empty and did not apply the initializer, soarray.sizeand element reads differed (#333, #327). Regenerate C++ and relink strategies. - Methods whose first parameter is never referenced in their body now report
PF-E5087at that parameter, with a hint to use it or declare a function instead. - Consumed
if/switchselections mixing value and void arms now report locatedPF-E5088; requested void selections keepPF-E3102. - A
request.securitypayload that reads the history of an expression inside a loop, or at several reads of one helper parameter, commits one history slot per requested bar holding the last evaluation of that bar, as TradingView does. Every read of the bar sees the history before this bar. Regenerate C++ and relink strategies (#287; #327). request.securityregisters input-derivedlookaheadselections using the selected input values, including overrides; choices that depend on bar data still reportPF-E1085. A scalar empty timeframe still uses the chart timeframe; anif/switchtimeframe arm known to be empty still reportsPF-E3105. History reads of requested values now compile inside another request's TA expression, including aliases and repeated reads. Uncalled request wrappers no longer interfere with compiling unrelated direct requests (#294; #327).input.enumoptions named through immutable enum-member declarations now retain their choices and checked-settings support.- Array fields in records that stay within one bar preserve omitted and explicit
naIDs, distinct from empty arrays. - Copying a record that stays within one bar shares its array fields while keeping scalar fields independent.
- A block-local
stringdeclaration at top level may now shadow a script-levelfloatbinding with declared or literal types without sharing storage; every other cross-type shadow keeps its existing refusal. - A series variable declared or written inside a loop now opens one history
slot per bar at the first reach and updates it on later iterations, as in
TradingView. Previously, each iteration opened a separate slot, so
y[i]could read prior iterations instead of prior bars. Expression histories in loops also keep one slot per bar, holding its last evaluation. Functions read current globals produced by tuple declarations; ordinarystringdeclarations initialized withnareset on each execution; named array-constructor arguments bind tosizeandinitial_value. Reassigned ordinary inputs restart from the selected input value at their declaration on each bar;varandvaripinputs retain their accumulated state. Regenerate C++ and relink strategies (#291; #324, #327). - Runtime history offsets below 0 or above 10000 stop at the read with an error naming the Pine line and offset, before integer narrowing. Constant offsets keep their existing behavior (#311; #327).
timestamp("...")now accepts full English month names, including"01 February 2024 00:00". The existing 64-bit timestamp handling throughinput.timeand function or tuple results is preserved (#293; #327).timestamp("...")date strings with aUTCorGMTzone word now give TradingView's value for four forms that differed. A negative zone with a zero hour keeps its sign (GMT-00:30,UTC-0:30). Minutes of 60 or more are dropped and the hours kept (UTC+01:60,UTC+00:90). A number without a sign after the word is ignored (UTC30,UTC5). With a numeric offset and a word in one string the last one decides (+0000 UTC+2,UTC+2 +0000).UTC5andUTC+2 +0000are no longer refused.timestamp("...")with a UTC or GMT zone word of 24 hours or more, for exampleUTC+24,GMT-24orUTC+25, now translates instead of stopping with an internalValueError. As in TradingView, the zone word is plain arithmetic on the date fields: the value is the fields read as UTC minus the signed offset.- In
//@version=6scripts and libraries, type field defaults containing calls or user-declared variable references now reportPF-E2087at the default expression's first token. V5 sources keep their earlier handling. strategy.default_entry_qty(fill_price)reads the engine host's query of the default order size at a price (default_entry_qty); it used to lower to an undeclared function, so a script that used it did not build. It needs an engine whose strategy host provides the query. The calls TradingView refuses are refused too, at the offending argument or call, also inside the arm of a switch: no price, a second price, a price given both by position and by name, an unknown argument name (PF-E1088), and a string, bool, color or collection price (PF-E2083toPF-E2086, only for a type the syntax proves).- PF-W1505 now explains both EMA seeding modes and names the engine run option
series_origin_ms, passed through the run'ssyminfo. The default first-value seed matches TradingView charts with history before the range; when the reference starts at the range start, declaring its first bar's open time in epoch milliseconds selectsnafor the firstlength-1bars followed by an SMA seed. This also applies tota.macdandta.tsi;ta.kcandta.kcwalready start that way in every run, because the generated code applies the warm-up to their EMA basis. Declared origins startrequest.securityat the first whole higher-timeframe bucket at or after that time, with plain expressionsnauntil its first bar completes. In a measured 336-exit reference starting at the range start, 37 exit comments differ by default, including 5 finite values where TradingView isna; none differ with the origin declared. Six corpus cases add, drop or shift 1 to 3 trades in the first days by default; all six are exact with the declared origin. A wrong origin gives wrong values; do not set it for live runs, where it has no defined meaning.ta.rsi,ta.rmaandta.atralready use SMA seeds. Migration: none; undeclared runs are unchanged. The diagnostic stays an unconditional note at eachta.emacall; this text change leaves generated C++ unchanged. - Missing integer values remain
nain float writes, numeric selections, float arguments and arithmetic. Explicit float declarations keep fractional values after integer initialization. Regenerate C++ and relink strategies.
- Since 1.10.0, identifiers and import paths in Pine v6 scripts must be ASCII:
a non-ASCII character in a name is refused at that character (
no viable alternative at character ...); 1.9.1 encoded such names. Strings and comments keep non-ASCII text, spelled as octal escapes in the generated C++ (#290). - An affine chart loop proved endless is stopped with the loop-time error when
its result reaches an effect. Omission is limited to an unused loop statement
with no calls, whose writes have no readers except self-updates, a break
condition or one further unused variable declaration. Other flagged loops
stop when their result is read in a shape not measured, where TradingView
may drop them. Endless loops in functions, methods and
request.securitystill never end here while TradingView stops them; data-dependent endless loops still hang. - Pine v6 calls refuse a positional argument after a named argument with
PF-E2074at that positional expression. The check also covers strategy declarations, unused functions and v6 library bodies before lowering. - A v6 counted loop whose start has positive int check evidence now refuses a
float-typed step during translation with
PF-E2079at the step expression and the hint "Use an int step or a float counter." An unknown start with a positively float step still selects a float counter. - Counted loops can read their own counter in the end and step expressions,
including when it shadows an outer binding and inside a
request.securityhelper. The counter now wins over an outer same-named variable. The step is read once at counter 0. TradingView measurements establish that direction is fixed from the start and the first end read at counter 0, then an end that reads this counter is read again at the start before the first continuation test. The v6 end also refreshes between iterations. A non-positive v6 step stops the run instead of being converted into a positive step. This changes generated C++ for explicit-step loops; regenerate and relink affected strategies. - A v6 counted loop uses a float counter when its start has positive float
evidence, or when its start is unknown and its step has positive float
evidence, including inside a
request.securityhelper. A start whose value has positive int evidence keeps an int counter. Without float evidence, the existing int route is unchanged; v5 library loops keep their existing int-counter route. Counter-family inference follows declaration sources in a dedicated query, independently of shared expression and storage inference. A division in a loop start keeps its fraction unless it is a constant division with an exact integer result, which keeps the int route. The float-step refusal follows TradingView's check type (a division of two ints is int). - Float-counter loops accumulate the counter by repeated double addition.
TradingView's measured loop-end rule admits a counter whose excess beyond
the end, computed as one double subtraction in the loop's direction, is
strictly below
1e-10. The named valuekTvFloatStepEndis emitted only for float-counter loops. Measured on TradingView at the 0.3 scale (counted up to a 9.999e-11 shortfall, not counted from 1.0e-10) and at counter magnitudes of about 1, 1e3, 1e6 and 1e9; no magnitude-independent constant is claimed; not a constant TradingView publishes.0.0 to 0.3 by 0.1counts four iterations;0.0 to 2999.9999999999 by 1000.0counts three. A positive infinite step exits after one iteration with a finite end and needs no non-finite-step guard. - Known loop gaps: a float counter passed to
an untyped helper truncates here, while TradingView passes the fractional
value (accumulating
twice(x)from 0.0 to 1.0 by 0.25 gives 2 here and 5 on TradingView).array.from(x)can also truncate a float counter through inferredarray<int>storage. An unknown start from an untyped parameter with a positively float step now selects a float counter, independently of shared parameter inference. Forf(x)containingfor v = x to 1.0 by 0.25, TradingView refusesf(0)with CE10106 and acceptsf(0.0). PineForge accepts and runs both with a float counter because this inference cannot distinguish their call-argument types; refusing the unknown start would also refuse the valid float-argument call. Block-local/enclosing-counter bindings and stops insiderequest.securityhave no TradingView tape. - A Pine v6 function or method reading a later local without an earlier
visible binding is refused during analysis at the read (
PF-E2075), using the same declaration-order rule as later globals (PF-E2053). Reading a loop counter orfor ... inbinder after its loop without another visible binding is now refused at translate time (PF-E2054); these reads were previously accepted. TradingView accepts a namespace call after an expired block local with the same name; PineForge's analysis no longer refuses it, but code generation still rejects some such calls (a known gap).
- Translation checks the generated C++ against a fixed allowlist and refuses a
script whose output contains a construct outside it, with a fixed reason and
no script text in the message (diagnostic codes
PF-E5053throughPF-E5079). The allowlist now also refuses namespace, mount and thread-creation names (unshare,setns,clone,clone3,mount,umount,umount2,pivot_root,chroot,prctl,seccomp,pthread_create,thrd_create,__clone,thread,jthread,async), and an authored identifier spelled like one of these is renamed with the usual escape prefix. A script that uses none of these names and no non-ASCII text translates to the same C++ as before, except for the timestamp change below. - Every generated timestamp and time-field lambda that takes a timezone asks the engine whether the zone is accepted before it sets the process timezone; a rejected zone is read as UTC instead of being set. The generated C++ of every script that uses such a lambda changes by that one term, and the built strategy calls an engine library function (declared in the engine since 1.8.0), so it must be linked against the paired engine library.
- Identifiers, strings and comments in generated C++ are spelled in ASCII: non-ASCII identifier characters become encoded tokens and string bytes become octal escapes, with the same bytes at run time. A script with non-ASCII text generates different C++ text.
- The fallback renderer for a runtime technical-analysis length expression no longer rewrites text inside a string literal. It substituted identifier-shaped words everywhere in the expression, so a literal that spelled an input variable's name or a known string constant's name received that value's rendering and could close the literal early; it now substitutes identifier tokens only. The fallback is not reached by any script accepted so far, so no translated output changes.
- A string literal inside the length argument of a technical-analysis call is
no longer rewritten when the call sits in a user function. The function's
parameter substitution and local-variable expansion replaced identifier-shaped
words everywhere in the argument text, so
ta.sma(close, mode == "fast" ? fast : 10)insidesmooth(int fast)called assmooth(5)comparedmodewith"5"instead of"fast"and chose the wrong length. Both now substitute outside string literals only, and so do the three earlier passes of the fallback renderer (timeframe.members,math.members and the wordsand,or,not), which changed the text of a literal such as"buy and hold"(the fallback renderer). A script without a string literal in such an argument generates the same C++ as before. - A script that loops over every closed trade on every bar to sum profits under entry-id or profit conditions now generates a resumable fold: settled closed trades are folded once into prefix sums and only the unsettled tail is folded again each bar, in the plain loop's order, so every accumulated value is identical bit for bit. The per-bar work grows with the trades closed at the newest exit time and the trades closed since the previous bar, not with the number of closed trades. A script that does not match the loop shape generates the same C++ as before.
- Generated closed-trade text comparisons against a NUL-free string literal
call the engine's in-place closed-trade comparison members, introduced in
the engine release after
v1.8.0. Generated C++ using these members builds only against that paired engine release. Every other shape keeps its owning string emission.
Planned as 1.8.0, a minor release of the exact engine/codegen pair, paired with
engine v1.8.0. This entry records what changed in this repository since
1.7.0 and nothing else: the behaviour changes, the CHANGELOG-only change and
the fixes that ship in the same release. The behaviour changes alter the
published input manifest, the emitted C++ for scripts that read
strategy.account_currency, have a persistent declaration whose initializer
depends on earlier statements, have a helper-local var color or a
request.security rollback hook, use a pivot-levels helper or an array or
matrix history read, bind fclose, have a calendar timestamp lambda whose body
identifiers collide with requested-context bindings, or use
calc_on_order_fills with growing primitive arrays, maps or matrices, and the
accepted input (line endings, one-line field assignments, an unevaluated
request.currency_rate).
- Pairs with engine
v1.8.0exactly. Regenerate strategy C++ with this release and relink every strategy library against the enginev1.8.0headers andlibpineforge.a, even when the C ABI number is unchanged (README Engine pairing). - Hosts must recognize the new input type
color. The input manifest (transpile_full()and the Pyodide/glue manifest) now reports everyinput.colorentry as"type": "color"with an unsigned packed0xAARRGGBBintegerdefault(color.redis4294063685,0xFFF23645; transparency is included), where 1.7.0 and earlier reported"type": "string"with a Pine-spelling default such as"color.red". A host with a closed list of manifest types needs acolorarm. Treat the default as a number in0..4294967295: do not parse it as a signed 32-bit integer, and send its decimal text to the native setter (get_input_int64). A default that cannot be folded to a constant keeps its previous (null) metadata.supported, the emitted C++, the native setters and receipts, and the C ABI are unchanged.pineforge-hpoaccepts color inputs from its 1.8.0 release (a packed integer in0..4294967295, booleans refused). - Every generated strategy library gains the two id-sites receipt exports (see
the entry below); trading code is unchanged. Apart from that, the emitted C++
is intended to change only for the scripts the entries below name: those that
read
strategy.account_currency, whose persistent declarations depend on earlier statements, with a helper-localvar color, with a helper that reads the history of a derived argument, with a pivot-levels helper or an array or matrix history read, that bindfclose, with a calendar timestamp lambda whose body identifiers collide with requested-context bindings, or with arequest.security(for the late-restore change alone, only the generatedrestore_script_state()changes, in 72 of the 555 corpus and fixture scripts; the other entries change the scripts they name). This is the design intent of the pull requests and their tests, not a byte comparison of generated C++ against 1.7.0. Nine diagnostic codes are added (PF-E3093, the refusal for a helper-localvarof an unsupported type, andPF-E3094throughPF-E3101, the refusals of a derived helper-argument history) and the user-facing text ofPF-E1088andPF-W1088is reworded; the catalog schema is not changed. - Engine behavior changes are described in the paired engine's own release notes; this entry does not summarize them.
- Preserve the calendar timestamp lambda's fixed body when a request expression also reads a mutable global, helper local, loop counter or tuple element whose name matches a body identifier, including history reads. Calendar argument expressions still read their requested-context bindings.
- Avoid libc name collisions in generated C++: pivot-level helpers use
open_price, array and matrix history helpers useopen_slot, and authoredfclosenames are escaped. Scripts using either helper change only that renamed identifier; scripts bindingfclosechange its escaped spelling. - Avoid copying growing primitive arrays at each order-fill checkpoint when their writes can be tracked completely. Rollback records individual edits; bulk operations retain full preimages, and other arrays keep their existing snapshots. The generated strategy class of a script that uses this is not copyable or movable.
- Avoid checkpoint copies for isolated primitive maps and matrices with fully tracked writes. Sparse writes use individual undo records; bulk mutations save at most one full preimage per root between checkpoint or restore boundaries. Dense writes switch to that preimage after exhausting the element-count budget, preserving key order, matrix shape and handle identity.
- Reuse unchanged primitive-array history snapshots when every write can be tracked, while preserving detached historical values and order-fill rollback. The generated strategy class of a script that uses this is not copyable or movable.
- Fix a silent wrong value under
calc_on_order_fills: a fill recalculation that ran after a deferredrequest.securityevaluation (for example a late margin-call liquidation) restored the strategy checkpoint taken before that evaluation and rolled the requested context's own state back (helper-localvarseries, requested TA objects, OHLC and expression histories, mutable copies and bar-index clocks), while the engine's requested aggregators had already advanced. The generatedrestore_script_state()now leaves that requested progression alone and still restores the chart's state and the merged request results; payloads that keep user calls on the chart's bar (the chart-fallback warning) keep their old rollback, and so do the shared helper-localvarseries of a script that has such a payload, so the late-restore loss is fixed for every script without that warning and not for the helper-local state of a script that has it. The emitted C++ changes only in that one function; no engine change or ABI change is involved. - Initialize a persistent (
var) UDT, array, map or matrix once at its declaration, in statement order, when its initializer reads a value computed earlier in the statement walk: an earlier declaration, reassignment, field write, collection method or global read by a user helper (#226). The first-bar preamble previously read the zero default. Emitted C++ changes only for scripts with such a dependency; independent constructors and callable-local declarations keep their routes. Avaripdeclaration with the same dependency takes the same route, with its storage and once flag left out of thecalc_on_order_fillsrollback checkpoint (#258). - Raise currency-conversion errors only when
request.currency_rateis evaluated, not when the call merely appears in a branch that never runs (#228). No currency-rate data feed is added: an evaluated call stops the run with a no-data error. Only the diagnostic text of scripts that previously failed to translate changes, and the wording of one warning; a call that names its second argumentto = ...still does not parse, as before. - Support explicit and inferred helper-local
var colorstate inrequest.security, preserving persistence, transparency andna(#229). The epoch-width integer and the collection, object and drawing refusals are unchanged; the refusal for any other unsupported helper-localvartype has the new codePF-E3093. - Sample the history of a derived helper argument on the requested context's
own bars in
request.security: a helper such asf(x) => x[1]called asf(close - open)now reads the previous value of the argument on the requested bars, not the chart's bars (#229). The argument is sampled through one ring per call site, which the late-restore rule above leaves alone with the rest of the requested state. Shapes that cannot be sampled are refused with located errors,PF-E3094throughPF-E3101: a derived history offset that is not a non-negative constant integer, a ring capacity that is not representable, a call that is not unconditional, a helper that depends on other helpers' state, history composed with helper-result history, a mutable global that cannot be replayed, and a parameter whose type or width has no lossless history. Direct OHLC and time bindings, builtin forms and method envelopes keep their existing lowering. - Accept a UDT field assignment (
:=,+=, ...) as the body of a one-line function or method,set(State s) => s.value := 1, translating like the same body on its own indented line (#230). A plain-name or subscript target in a one-line body keeps its parser error. - Fix
input.colormetadata so its default round-trips through the native input setter (#231, #251). Pythontranspile_full()and the Pyodide/glue manifest now reporttype: "color"and an unsigned packed0xAARRGGBBinteger default for named Pine v6 colors, hex literals and literalcolor.new/color.rgbexpressions, including transparency. Unfoldable defaults retain their previous metadata; accepted expressions are unchanged. See the migration note above. - Fix
strategy.account_currencyto return the declared constant currency, falling back to the symbol currency when omitted orcurrency.NONE, and support currency-constant comparisons and string concatenation (#227, #250). No currency conversion is added; only the value the script reads changes, so a script that branches onstrategy.account_currencycan now take a different branch than under 1.7.0. - Accept CRLF and lone CR code line endings like LF across the Python and JSON
translation entry points, preserving generated C++, diagnostics and literal
string contents
(#230,
#252).
This is the line-ending part of #230; a lone
\rinside a string literal stays data. Output for LF sources is unchanged. - Report how many order sites create a computed id in one execution of the
script (not per bar:
calc_on_order_fillsruns the script again after each fill). Every generated strategy library also definesstrategy_id_sites_api_version(), which returns 1, andstrategy_id_sites_receipt(s, json, capacity, required, error, error_capacity), beside the order-shapes receipt and with the same buffer protocol. Its canonical JSON,{"strategy":{"ids":{"freshPerBar":K}},"version":1}, counts the loweredstrategy.entry,strategy.orderandstrategy.exitsites whoseidis not a literal, once per static call of the function that holds them and once per iteration of aforloop with known bounds; a loop without a static bound or a recursion around a computed id gives{"strategy":{"ids":{"freshPerBarStatus":"unbounded"}},"version":1}. The emitted C++ of every strategy gains the two exports; trading code is unchanged. - Backfill release notes for earlier codegen releases, including the Security entry for GHSA-5www-2x9c-mgr6 (#248).
A minor release of the exact engine/codegen pair, paired with engine v1.7.0
and dated 2026-10-25. This entry records what changed in this repository since
1.6.3, and nothing else: three pull requests merged after v1.6.3, one of which
changes the emitted C++ and the other two only the repository's own CI.
- Pairs with engine
v1.7.0exactly. Regenerate strategy C++ with this release and relink every strategy library against the enginev1.7.0headers andlibpineforge.a; this applies even when the C ABI number is unchanged (README Engine pairing). Replacing the archive alone does not update a statically linked strategy library. - The emitted C++ changes, as described below: every generated library gains a
new exported function, the generated constructor gains a guarded statement
for scripts that do not read closed-trade rows, and the set of reserved names
grows. The Python API, the diagnostic codes and severities, and the catalog
schema are not changed; the order-shapes receipt's
host_readslist gainsset_trade_history_streamablefor scripts that do not read closed-trade rows. - Engine behavior changes are described in the paired engine's own release notes; this entry does not summarize them.
- Declare whether the emitted code reads closed-trade rows, and let scripts that
do not read them opt into streamed trade history
(#213).
Generated libraries now export
int strategy_reads_trade_history(void):1when the emitted code reads astrategy.closedtrades.*accessor,0when it does not. The closed-trade count (strategy.closedtradesalone) and the open-trade accessors (strategy.opentrades.*) do not count as reads. For a script that does not read closed-trade rows, the generated constructor callsthis->set_trade_history_streamable(true), guarded by#if defined(PINEFORGE_HAS_TRADE_HISTORY_POLICY_V1)so that it compiles against engine headers that lack the setter; a script that reads closed-trade rows emits no such call, and the order-shapes receipt'shost_readsnames the setter for non-readers only. The constructor's host calls are now qualified (this->configure_pine_strategy(cfg)). A library generated by an earlier release has no such export, and its absence does not establish that the script is a non-reader. What the engine does with the streaming setting is described in the enginev1.7.0release notes. - Reserve more names in generated C++ and escape them as
pf_safe_<name>when a Pine identifier uses one (same pull request, documented in the new "Identifiers in generated C++" section of docs/PUBLIC_CONTRACT.md): the engine namespaces and types thatusing namespace pineforge;brings into scope (report,report_sink,report_sequence,source,native_calendar,pine_color,RunFailureCode,RunFailureInfo,QtyType,CommissionType,XLoc,YLoc,normalize_timezone_for_posix), the generated C exports (strategy_create,strategy_create_checked,run_backtest,run_backtest_full,run_backtest_full_checked,strategy_free,report_free,strategy_set_input,strategy_set_input_checked,strategy_set_override,strategy_set_override_checked,strategy_set_magnifier_volume_weightedand the newstrategy_reads_trade_history), the feature macrosPINEFORGE_HAS_TRADE_HISTORY_POLICY_V1andPINEFORGE_HAS_SYMBOL_SECURITY_EVAL_V1, and the host memberset_trade_history_streamable. A Pinetype report, for example, now becomesstruct pf_safe_report; before, such a script could fail to compile against the 1.7.0 engine headers with an ambiguous reference. User-defined type handles andrequest.securityevaluators use the escaped spelling too. An identifier that does not collide keeps its spelling. The existingCPP_RESERVEDexport lists the new names; no new reserved-name API is introduced. - Repository and CI only, no effect on emitted C++ or on the Python and JSON
contract: the
promote-baselineworkflow refuses untrusted heads and actors (SEC846, #242), andtest.ymladopts the organization's CI canon (#243).
A patch release of the exact engine/codegen pair, paired with engine v1.6.3
and dated 2026-10-23. This entry records what changed in this repository since
1.6.2 and nothing else: one security fix to the emitted C++, merged from a
private fork (commit 041889818e2206fdf7261574128064fb0b4142ad), and four pull
requests that change only the repository's own CI, publishing and documentation.
- Published advisory
GHSA-5www-2x9c-mgr6,
"Codegen can emit C++ calls and type names taken from the input script"
(severity high, CWE-94). Fixed in 1.6.3 of both packages. The affected
versions are
pineforge-codegenfrom 0.6.4 up to but not including 1.6.3 and@pineforge/codegen-pyodidefrom 0.7.0 up to but not including 1.6.3, which ships the same Python sources. Images ofghcr.io/pineforge-4pass/pineforge-releasebefore 1.6.3 contain an affected codegen; the 1.6.3 image contains the fixed one. Upgrade to 1.6.3 or later; the advisory states the mitigation and the upgrade steps and, like this entry, contains no reproduction recipe.
- Scripts that reached the two affected paths are now refused instead of
transpiled. A call or member that the codegen has no lowering for ends with
<name>(...) is not implemented in PineForge runtime.where it used to be written into the emitted C++; a token that is not a type, in a type position or inside<...>, ends with a located parse error; andarray.neworarray.fromwith an undeclared element type is refused with the same "not implemented" message. A script that compiled under 1.6.2 can therefore fail with a compile or parse error under 1.6.3, and this is the intended effect of the fix. For scripts that stay accepted the emitted C++ is unchanged except that the default of an enum-typed element isna<double>()(a type name that is not a declared user type falls back to its slot's default) andformat,currencyandordervalues are typedstd::string. A pair change requires regenerated C++ and relinked strategy libraries against the paired engine release's headers andlibpineforge.a(README Engine pairing); regenerate any C++ that an affected release produced from a script you do not trust.
- Run every codegen job on GitHub-hosted runners (#237).
- Publish to npm only by operator dispatch, in the main-only
npm-publishenvironment (#238), and state the npm publishing bound as it now exists: both npm jobs run in that environment (#240). - Stop naming a retired private campaign repository in five lines of the documentation (#239).
A patch release of the exact engine/codegen pair, paired with engine v1.6.2
and dated 2026-10-21; the prerelease 1.6.2-rc.1 (2026-10-19) pairs with engine
v1.6.2-rc.1. This entry records what changed in this repository since 1.6.1
and nothing else: a checker for generated C++ and a reserved-name change in the
emitter, a change of the licensor's written entity, and CI changes.
- New command
pf-cpp-allowlist(pineforge_codegen.cpp_allowlist:main, installed with the package), a checker for a generated C++ translation unit that flags dangerous primitives (#210). It is a denylist with known false positives, a mitigation and not proof that a unit is safe (the wording of the 1.6.3 security advisory). - A script identifier equal to a symbol that the checker refuses when it appears
bare (
system,free,socket,openand the rest of the list inpineforge_codegen/codegen/helpers.py,LIBC_RESERVED_NAMES) is now emitted aspf_safe_<name>instead of the bare libc name, so the emitted C++ for scripts that declare such a name changes. - A pair change requires regenerated C++ and relinked strategy libraries against
the paired engine release's headers and
libpineforge.a(README Engine pairing).
- The licensor entity is written exactly as
PINEFORGE LLCinLICENSE,LEGAL.mdandCONTRIBUTING.md(#234). - CI: Linux x64 jobs on the pf-ci-spot pool
(#212,
tracked at fragment b240f6d7 in
#215),
credentialed release and deploy jobs kept on hosted runners
(#214), a
guarded job and a token-free OIDC job to claim the PyPI
tunaxis-codegenand npm@tunaxis/codegen-pyodidenames with a 0.0.1 placeholder (#216, #217), the App-token owner following the repository owner (#221), the open Dependabot bumps folded and pinned by SHA with the exact release (#223), superseded pull-request runs of the gate and test workflows cancelled (#225),timeout-minutesdropped fromgate.ymlandtest.yml(#233), and the pull-request suite skipped on draft pull requests (#236).
A patch release of the exact engine/codegen pair, paired with engine v1.6.1
and dated 2026-10-18; the prerelease 1.6.1-rc.1 pairs with engine
v1.6.1-rc.1. This entry records what changed in this repository since 1.6.0,
and nothing else: after
#209 added
the 1.6.1 changelog entry for v1.6.1-rc.1, only the final release-note and
pairing documentation updates landed before 1.6.1.
- No Python, JSON, diagnostic or C ABI contract changes.
- Strategies that previously failed native C++ compilation when calling a
calendar built-in (
hour,minute,second,dayofmonth,dayofweek,month,year,weekofyear) withtimezone=and no positionaltimeargument, or when initializing avararray witharray.from(...)over unary-signed or mixed numeric constants, now emit matching C++ types and compile cleanly. - A pair change requires regenerated C++ and relinked strategy libraries against
the paired engine release's headers and
libpineforge.a(README Engine pairing).
- Bind the omitted
timeargument of calendar built-ins (hour,minute,second,dayofmonth,dayofweek,month,year,weekofyear) to the active bar's timestamp (current_bar_.timestampon the chart,bar.timestampinsiderequest.security) when called with atimezone=keyword argument only (#205). - Infer a single consistent element type across every
array.from(...)call (vararray declarations, plain declarations and inline arguments alike) inpineforge_codegen/codegen/types.pyandpineforge_codegen/analyzer/types.py, preservingintfor integer constants (including unary-signed constants and function-local constants) and promoting todoublewhen any element isfloat. For previously compiling scripts, the observable emitted-C++ change is that anarray.fromwhose arguments are all integer, including unary-signed ones likearray.from(-1, 1), now emitsstd::vector<int>instead ofstd::vector<double>; withnamixed in (array.from(-1, na)) it emitsintwith theintnasentinel, asarray.from(1, na)already did. Values are unchanged for arithmetic, since/,%,math.maxand the array reductions already work indouble(#205). - Group weekly Dependabot pull requests into one pull request per ecosystem
(
npmandpip) in.github/dependabot.yml(#206).
A minor release of the exact engine/codegen pair, paired with engine v1.6.0
and dated 2026-10-17; the prerelease 1.6.0-rc.1 pairs with engine
v1.6.0-rc.1. This entry records what changed in this repository since 1.5.0,
and nothing else: after
#203 added
the 1.6.0 changelog entry for v1.6.0-rc.1, only the final release-note and
pairing documentation updates landed before 1.6.0.
- The analyzer and the code generator do not change behavior: the only edits
under
pineforge_codegen/since 1.5.0 are comments and docstrings in five files (#202), so the C++ the transpiler emits for a script and the Python and JSON contract are unchanged. No diagnostic code, severity or catalog schema changes. - The release note policy still applies: "A pair change requires regenerated C++ and relinked strategy libraries, even when the C ABI number is unchanged." Regenerate and relink against the new engine's headers and static library.
- Engine behavior changes, including failure codes and the report contract, are described in the paired engine's own release notes; this entry does not summarize them.
- Remove the 11 gate-corpus pines that copy probes leaving the engine corpus (#200).
- Remove the subprocess time limits of CI tests and checks (#201).
- Move the recorded US-listed, futures, forex and metal tapes of the tests to the private fixtures, and reword the comments and docstrings that cited them (#202).
A minor release of the exact engine/codegen pair, paired with engine v1.5.0
and dated 2026-10-12. This entry records the diagnostic additions below and the
report-contract documentation for the paired engine fix, and nothing else: the
codegen change is diagnostics only; the report documentation adds no Python,
JSON, diagnostic or emitted-C++ change of its own, and no analyzer or
code-generation file differs.
noteis a third diagnostic severity, and it is nonfatal. A diagnostic is now anerror, awarningor anote:Level.NOTEin Python and"note"as theseverityof a catalog entry and of a JSON diagnostic. A note is nonfatal like a warning.transpile_full()["diagnostics"]and the success envelope'sdiagnosticslist warnings and notes, a script with only notes still returnsok: trueand its C++, and aCompileErrorcan carry notes beside its errors.transpile()still returns no nonfatal diagnostics.CompileError.format()printsnote[...]where it printedwarning[...]for the codes below. Code written for two severities must handlenote: read an unknown severity as a warning, never as an error. A note does not mean that results are unaffected; PF-W1505 describes a warmup approximation.- Exactly eleven codes change from warning to note: PF-W1505, PF-W1508,
PF-W1509, PF-W1525, PF-W1526, PF-W1527, PF-W1528, PF-W1529, PF-W1530,
PF-W1531 and PF-W1532. They describe calls PineForge skips as visual only
(
plot(...),table.new(...)), earnings, dividends, splits, financial, footprint and other-symbol requests whose value reaches only display and alert sinks and is lowered tona, and theta.emawarmup approximation. Every other code keeps its severity. PF-W1502 (color(...)cast), PF-W1506 (color.from_gradient), PF-W1507 (drawing setters that drop color, style or size), PF-W1078 (visual or style constants) and PF-W1552 (arequest.security_lower_tfwhose value reaches only display and alert sinks) also speak of visual-only or display-only handling and remain warnings: a message's wording does not classify it. A consumer that tallied these eleven codes as warnings, to gate a run, count warnings or color a banner, now receives notes. PF-W1509 still classifies as PF-W1508 where the two templates tie, so no new emitted code appears. user_messageis a raw ICU template overargs. Every catalog entry, everyDiagnostic(Diagnostic.user_message) and every JSON diagnostic gainsuser_message: a short English ICU template that uses only that diagnostic's existingargsnames and may be constant ({name}() does nothing in a backtest.withargs.name = "plot"). It is not pre-rendered English. Render it withargsas plain text, never as template syntax or markup, or translate bycode; do not display the unrendered template. It does not replacemessageandhint. The templates of the eleven migrated codes are fixed string for string by a delta fixture. Every template is checked for form (short, parseable, over that code's ownargsnames). Each of the 97 warning twins of an error (PF-W1nnnforPF-E1nnn) has a sentence of its own that says PineForge warns, and the 91 that warn only inside aswitcharm also say it keeps the arm's lowering. No warning or note template says that PineForge refuses or rejects something, though one may say what TradingView refuses or rejects. Beyond these checks a template's exact wording is not pinned.- Legacy fields are stable.
code,args,message,hint,line,col,endCol,ok,errorand the envelope keys keep their meaning and values: no key is renamed or removed, and no code is renumbered or reused (the notes keep theirPF-Wcodes, and the prefix is not the severity).render_diagnostic()still returns the unchanged Englishmessageandhint. The catalog schema id stayspineforge-diagnostics-catalog/v1, so a reader that checksseverityagainst two values or rejects unknown entry fields must acceptnoteanduser_message. The receiver examples intests/fixtures/diagnostic_notes/receiver.jsonspecify the compatibility rule; they are not evidence of any application's behavior. - The warmup sidecar is later work. No compile-time or runtime sidecar
exists in this entry. PF-W1505 stays the static
ta.emanote it was, with only its severity changed: the support checker emits it at eachta.emacall it visits, with no per-call condition or suppression and no call-site identifier. The startup inventory and extraction that would bind a versioned sidecar to a diagnostic bycall_site_idand source range, so that a consumer can show a startup sentence only for a known finite shortfall, are not part of this entry, and no diagnostic carries a call-site identifier or a startup length.
The engine side of the report-ownership text below is a report fix, in
preparation, that engine v1.4.0 does not carry.
- The public contract states that a report belongs to the call that returned it. A call the engine refuses without beginning gets the empty report, never an earlier run's rows; a run that began and then failed keeps its partial rows; the explicit stream snapshot keeps the owner's rows; recorded outputs keep their own record of the last run that began.
- Read the error text, the error code and the run status after every run. A refusal the engine makes before it admits the begin leaves the status at its earlier value (0 after a completed run), so the status alone misses it. The README's "Compile & run against the engine" section says the same.
- Pairing is unchanged in kind: regenerate the strategy C++ and relink against
the engine release's headers and
libpineforge.aon a pair change (README Engine pairing).
A minor release of the exact engine/codegen pair. Its behavior was validated
before tagging on codegen bfc4ddce and engine b3192bfc.
It consolidates the seven requests landed
since v1.3.0: #183
(emission ordering), #184
(coded run stops), #185
(input manifests), #186
(collection history and binding), #188
(CI history), #189
(reference tests), and #190
(emitted-string regressions and edge cases). Recorded-output support from
engine request #356 is excluded. The pre-tag validation used these commits
with VERSION equal to 1.3.0; those results are not post-tag measurements.
- Codegen 1.4.0 supports only engine
v1.4.0. Regenerate every strategy's C++ and relink with that release's generated headers andlibpineforge.a. The pair retains C ABI version 4, settings/capability API version 1 and theengine_script_run_v19epoch; equal version numbers for those interfaces do not make mixed engine/codegen releases supported. A report's fingerprint records engine/codegen versions, generated C++'s hash and the paired engine's corrected provenance values. The retained epoch and hash domain tags do not promise equal fingerprints, state-hash values or trades across 1.3.0 and 1.4.0. - Emitted C++ changes, including common run-stop shims and collection history
wrappers. Do not reuse a 1.3.0 strategy library or assume source identity.
The public Python call signatures and override keys stay the same, but
inputsvalues and the Python/Pyodide success envelopes change as described below. These are not blanket byte-identity promises for emission or envelopes. - Every manifest row now carries
supported. When it isfalse, hide the input, exclude it from sweeps and optimization, and do not send a value: the strategy uses its compiled default, and the paired engine refuses a supplied value withsetting_unsupported.supported: truealone does not validate the value's type, bounds or options, or make a shared key safe. A supported empty dropdown and an unsupported string input can both haveoptions: []; that list does not determine support. - Give each input a unique title before upgrading. Calls with the same title
or fallback declaration key still produce separate manifest rows with the
same
title; theirsupportedflags do not detect the collision. Differentgroup=labels do not separate keys. On the paired 1.4.0 engine's normal checked path, a completed run of such a script hasfingerprint: nulleven without an override. Supplying the shared key fails before execution withsetting_rejected, reasonambiguous_key. For example,Period="7"returned a success report on 1.3.0, whose legacy setter applied a shared key to all matching inputs. Legacy-path unresolved provenance rows may still appear inside a fingerprint; that differs from the whole fingerprint being null on the checked path. - The paired engine's run harness now uses the checked settings API. Stored
presets and sweep values must satisfy the compiled input's type, bounds and
options. Two other examples that succeeded on 1.3.0 now fail with
setting_rejected:Color="color.blue"(expected_integer) andChoice="15"for options[10, 20, 30](invalid_input_option). A color's manifest still hastype: "string"and a Pine spelling such as"color.red"as its default, but the checked native input requires the packed integer; do not forward that manifest string as a native color value. The checked API also validates parseable numbers, booleans, enum members and known keys. This does not mean all invalid settings previously succeeded:initial_capital="abc"andinitial_capital="-1"already failed on 1.3.0; they now reportexpected_finite_decimalandvalue_below_minimumreasons. Legacy C setters retain their existing behavior. - The paired engine adds
strategy_get_last_error_codeandstrategy_get_last_error_argsbeside the existing English error getter, underPINEFORGE_HAS_RUN_FAILURE_CODES_V1. Its run harness exposescodeand typedargsbesideerroron failures. Check the failure channel even when the English message is empty; do not accept a stopped run's partial output as success or parse the English to recover a code. These run failures are distinct from transpile-timeCompileErrordiagnostics.setting_rejectedis catalog classinput;setting_unsupportedis classunsupported. A deliberateruntime.errorisstrategy_runtime_error, classstrategy. The installed engine entrypoint returns exit 4 for all three codes: exit 4 alone does not select a billing or refund decision. - The paired engine certifies scalar input/override types in fingerprint provenance; unresolved values remain explicit rather than being treated as certified native values. This is an engine report change, not another field added to the transpile-time input manifest. See the paired engine's release notes for report resolution reasons and counts.
- Requested-context history resets and TA variant position ties no longer use address or set order; they preserve traversal order. Refusal diagnostics for conflicting scalar history and map locals are hash-seed independent.
- Generated run stops use stable engine failure codes when the paired engine
advertises
PINEFORGE_HAS_RUN_FAILURE_CODES_V1. No-data and other-symbol stops carry compile-time request provenance; copying their English intoruntime.errorcannot select their codes. Older engines keep the legacy throws and English messages. runtime.error(message = "...")now passes the named message. With the coded engine and run harness, a run stopped byruntime.error()with an empty or named message no longer reports success or exposes partial results.str.tonumberno longer hides a stop raised while evaluating its argument; only numeric parse failures becomena. Invalid array sizes, substring positions and overflowing format-placeholder indices have checked stops. String parsing and checked substring calls do not capture authored helper-like names; substring arguments retain source order without copying the source text.- Generated run wrappers preserve the inner failure code, and latched setter failures and checked strategy construction retain their failure identity.
-
The transpile-time input manifest (
transpile_full()["inputs"]and the JSON envelope of the Pyodide package) gainssupported, the checked-settings receipt's flag, on every input, and reads its defaults, choices and bounds from the descriptor that generates the receipt, with the retained limitations below. No manifest key is renamed or removed, but these values of existing keys change:- Source inputs (
input.source, a plaininput(close)):defaultis the series name, where it wasnull, andoptionslists the nine native sources, where it was absent. - Enum inputs:
optionslists theEnum.memberchoices, where it was absent;defaultkeeps itsEnum.memberspelling. The compiled receipt encodes that default as its integer member value. - String inputs: a built-in constant publishes its runtime value
(
alert.freq_allis"all",currency.USDis"USD"; the manifest held the Pine names), a named string constant its value, and the choices ofinput.timeframeandinput.sessionare listed. What the receipt cannot represent (size.small,position.top_right,na) hassupported: falseandoptions: []; an unavailable default is"", but a representable default survives an unsupported choice. String decoding uses the emitter escape grammar, keeps literal Unicode and escaped backslashes, and stops at the first NUL like the receipt'sstd::string(const char*)constructor. NUL is emitted as a fixed three-digit octal escape even before digits; this is consistency with current native truncation, not lossless NUL storage. - Typed
int,float,priceandtimeinputs: a signed or named-constantdefaultis a number, where it wasnull;min,maxandstepappear for signed and named-constant bounds (minval=-80was left out); anoptions=[...]dropdown lists its numbers. A literal or inlinedbooldefault publishes a boolean, not a number. - A plain
input(-5)orinput(-2.5)is typedintorfloatwith its number asdefault, where it wasstringwithnull. The compiled getter and checked receipt keep their existing float type for these signed plain inputs; this manifest correction does not change that lowering.
Values the receipt computes at run time (
LEN * 2,not true,timestamp(year, month, ...)) stay unpublished: the default remainsNone/JSONnull, an unfoldable bound is omitted, and the wholeoptionsfield is omitted when any numeric choice is unfoldable. Aninput.colorretains its Pine spelling as a string default, not the receipt's packed integer; other nonliteral plaininput()calls remainstringwith no published default (the source case above is the exception). A foldedtimestamp("...")is a publishable literal. These gaps are explicit intests/test_input_metadata_receipt.py::KNOWN_LIMITS, not a claim of arbitrary expression evaluation or language soundness. - Source inputs (
-
Documents the timeframe spellings of two surfaces, both stable: a capability receipt records a request's timeframe as the script wrote it (
"D"), and request discovery and feed keys use the engine's spelling ("1D").
- Bind keyword arguments of the matrix methods and the checked array methods to their own parameter slot, with the omitted optional parameters taking their defaults in place (
matrix.sort(m, order = order.descending),m.submatrix(to_column = 1),a.fill(7.0, index_to = 1)no longer drop or shift a keyword), and refuse a keyword that names no parameter, or a parameter given twice, with the existing argument diagnostics. A defaultedsubmatrixevaluates its receiver once, an index-onlyadd_row/add_coltakes any numeric index, and a boundarray.concatresult (c = a.concat(b),c := array.concat(a, b)) keeps the unsupported-function refusal. An array history that reaches a user function's or method's parameter keeps its earlier copy lowering and the earlier refusal of a callee that checks it withna(); a bound missing-history matrix reports the recorded na-ID runtime error. - Compile matrix/matrix and matrix/scalar
matrix.sumoverloads with matrix-valued results, including helpers and history. Support scalarmatrix.diff/matrix.multand omitted optional arguments to matrix row/column insertion, submatrix, sort and array fill; unsupported matrix/vector multiplication and boundarray.concatresults report an existing unsupported-function diagnostic instead of failing C++ compilation. - Preserve na array IDs when a history offset has no value, including aliases and
na()-only bindings; array methods on those IDs report the existing runtime error instead of crashing. Bounds-check legacy collection-element reads and writes to prevent unchecked access.
The inherited follow-ups remain: keywords on UDT matrix fields, matrix.new
and array methods outside the checked table; matrix.fill range handling
(both spellings still fill the whole matrix); matrix diff/mult dimension
checks; and nullable history across callable/iteration shapes not covered by
the documented lowering. This release does not claim those cases resolved.
- Return the prefix or ticker of the supplied symbol in
syminfo.prefix(symbol)andsyminfo.ticker(symbol)instead of always reading the chart symbol; the variable forms, no-argument calls and direct chart-ID calls keep their chart lowering. Supplied-symbol calls split at the first colon; a prefix is empty without a colon or with no ticker after it, and a ticker without a colon is the full string. Non-string arguments still compile and yield an empty string, including the retained string-natyping gap. - Refuse malformed library versions with the existing import diagnostic instead of allowing them to raise outside the JSON gate, including non-ASCII decimal digits and ASCII versions exceeding Python's integer-conversion limit.
- Reserve generated receipt exports and version macros against script names.
- Escape embedded NUL values in generated C++ string literals, and strengthen emitted-string regression tests with explicit emitter reach and round trips.
- CI fetches full branch history for historical reference tests (#188); two whole-C++ comparisons use the accepted immutable scaffold (#189). These changes affect verification only, not the compiler or execution semantics.
The hardening wording remains scoped to the previously documented emitted-string validation and escaping; these edge-case repairs and regression checks are not a new arbitrary-source security guarantee. No exploit payloads are included.
The new numeric options expose an exact-type comparison in
pineforge-hpo 0.11.0: a JSON integer 20 is refused with
invalid_input_option for an input.float choice 20.0, although the
numbers are equal. For HPO 0.11.0, send each selected value with the number
type the original manifest publishes for that option: 20.0 when it lists
20.0 (explicit JSON 20.0 or a Python float), and integer 20 when it lists
20. A float input written with whole-number-literal options such as
options=[10, 20, 30] publishes integer options; mixed lists retain mixed
number types. The input's float type alone does not choose the workaround.
This can affect a caller that reads a float-spelled manifest default and
sends it back through JavaScript's ordinary JSON serialization, which writes
a whole-number value as 20, losing its float spelling. Writing 20.0 in
JavaScript before ordinary serialization does not preserve that distinction;
preserve each option's original number type at the HPO boundary. Upgrade to
HPO 0.11.1 or a later release containing the fix when available. This fix is
separate from the engine/codegen release; HPO 0.11.1 has not been released at
the time of writing.
The landed #190 candidate recorded 9,254 engine-enabled pytest passes with
12 audited skips, 2,164 focused passes each under GCC and Clang without skips,
314 public corpus compilation passes, and 279 fixtures in each of the JSON
and Pyodide fixture-parity checks. Those
are the request's retained native measurements, not a new native suite run
for this documentation change. The release-pair baseline records
excellent: 7,983;
strong: 6;
graded: 7,989 probes,
with 0 below strong
and 0 engine errors.
These are recorded grading outcomes, not a statement that no internal attempt
ever failed. Baseline pineforge-parity-baseline-20261007-engine-b3192bfc
measures engine b3192bfc
and codegen bfc4ddce;
these quantities render from the public release facts, not numeric overrides.
A minor release: generated strategy libraries gain two receipts beside 1.2.0's
capability receipt, the confirmed-bar receipt, which engine v1.3.0's live
runner reads, and the order-shapes receipt; a string dropdown that uses a
built-in constant no longer breaks the checked settings; and the package is
licensed under the PineForge Source License 1.2. It covers the changes merged
to main since 1.2.0:
#173 and
#178 add
the receipts to the emitted C++,
#179
changes its checked settings metadata,
#177
replaces the license, string values derived from a script are validated and
escaped wherever they are written into generated C++ (see "Hardening"),
#174
renders the README's scoreboard, and
#175
changes the repository's CI only. Codegen 1.3.0 supports only engine
v1.3.0. Engine v1.3.0's <pineforge/pineforge.h> is the same file as
v1.2.0's: the pair keeps C ABI version 4, PF_SETTINGS_API_VERSION and
PF_CAPABILITIES_API_VERSION 1 and the script ABI epoch
engine_script_run_v19, and no engine header declares the new receipt
functions, which a host looks up in the library by name.
- Regenerate C++ with 1.3.0 and relink it against engine
v1.3.0's headers andlibpineforge.a. The C++ defines the two new receipts beside the capability functions, only when the engine'spineforge/pineforge.hdefines bothPF_SETTINGS_API_VERSIONandPF_CAPABILITIES_API_VERSION, as enginev1.3.0's does. Enginev1.2.0's header defines both too; that does not make 1.3.0 with enginev1.2.0a supported pair. C++ generated by 1.2.0 has neither receipt, and enginev1.3.0's live runner keeps its original receipt policy for it (see "Confirmed-bar receipt"). - Every generated C++ file changes: it gains the two receipts. Beyond that,
the C++ does not change for the engine's 325 public corpus sources and this
repository's 277 gate fixtures: each transpiled in a fresh process, 1.3.0's
C++ with the confirmed-bar and order-shapes functions removed is 1.2.0's C++
byte for byte, and the 13 fixtures the gate expects to be refused are
refused with the same message. Elsewhere, #173 changes the capability
receipt's request entries and
unresolvedlist, and #179 the settings metadata of a string input that uses a built-in constant (see below), shapes none of those sources has. The trading code is unchanged. - The Python and JSON contract does not change: no argument, result key or
envelope is added, removed or renamed. Since 1.2.0 the package's code
changed only in the code generator (
pineforge_codegen/codegen/) and its support checker (pineforge_codegen/support_checker.py):pineforge_codegen/__init__.py,pineforge_codegen/errors.py,gate/glue.pyandpineforge_codegen/diagnostics_catalog.json(628 codes) are 1.2.0's files. For the 602 sources above, each in a fresh process,transpile_full()'s result withoutcpp, the diagnostics' codes and arguments included, and thetranspile_jsonenvelope withoutcppare 1.2.0's. The GitHub release attaches the catalog asdiagnostics_catalog-v1.3.0.json. - Report keys: the engine's Docker harness (
docker/run_json.py, which thepineforge-releaseimage runs) is the same file in enginev1.3.0as inv1.2.0, so no report key is added, removed or renamed;metrics.equity.sharpe_tvandsortino_tv(EQUITY_REPORT_KEYS) are unchanged, and the engine's ADR-0001 keeps serialized report keys as they are. A report's fingerprint still differs between 1.2.0 and 1.3.0, since it records the engine and codegen versions and the generated C++'s hash, and the engine's Pine adapter changes sincev1.2.0(pineforge-engine#341, #345, #347) can change a run's trades. - 1.3.0 is the first release under the PineForge Source License 1.2. 1.2.0 shipped under the PineForge Source License 1.1, and releases up to and including 1.1.0 under "PineForge Codegen — License"; copies of each release keep the license it shipped with (see "License").
From #173:
- Built against engine
v1.3.0, a generated strategy library also definesstrategy_confirmed_bar_api_version(), which returns 1, andstrategy_confirmed_bar_receipt(s, json, capacity, required, error, error_capacity), with the buffer protocol and statuses ofstrategy_capabilities_receipt. Its canonical JSON is written into the C++ when it is generated, as the capability receipt's is, and has the keysversion,requests(the capability receipt's request fields and the loweredexpression),ordersandintrabar_persistence.orderslists the distinct classified shapes of the script'sstrategy.*order calls, sorted:entry:market,entry:stop,entry:limit,exit:short_bracketandclose:marketfor the modeled calls and arguments, and the call's name marked unproven, such asstrategy.exit (unproven exit terms), for any other call or argument, risk rules and an order ID that is not a string literal included. Withprocess_orders_on_close=true,strategy()sizing, slippage or account settings outside the tested literal profiles addstrategy() (unproven POOC sizing, slippage or account settings). - The capability receipt keeps its version and keys, but its request entries
now take their timeframe, Heikin-Ashi flag and feed from the request's
registration, as the confirmed-bar receipt's do. A timeframe held by a
constant global (
htf = "D") or passed as a literal to a helper called once (f("5")) is that timeframe, where 1.2.0 wrote the name (htf) and listedrequest.security[N].timeframeinunresolved. A Heikin-Ashi request of the chart's symbol isfeed: "chart", where 1.2.0 wroteauxiliaryand setrequirements.auxiliary_security_feeds. Symbol"", which lowers through another symbol's feed, isfeed: "auxiliary"and setsrequirements.auxiliary_security_feeds, where 1.2.0 wrotechart. A request ofclose,close[1],ta.sma(close, 4)orta.ema(close, 3)in a script that declares its owncloseaddsrequest.security.expression (user-bound close)tounresolved. An input, reassigned or other run-time timeframe stays unresolved. - Engine
v1.3.0's live runner,pineforge-live, reads both receipts (pineforge-engine#342), checks that they agree and fails closed on a malformed field or a missing proof. With the confirmed-bar receipt it admits a same-chart request in the proven shapes the engine'sdocs/strategy-capabilities.mdlists (such ascloserequested at5,60orD, on confirmed one-minute bars) and a standalone close-onlyvaripon script clock1, where enginev1.2.0's runner refused every request and everyvarip. Two requests together, a request withvarip, andprocess_orders_on_close=truewhatever the order shapes stay refused. A library without the confirmed-bar receipt, such as one generated by 1.2.0, keeps the original receipt's policy. A batch run reads neither receipt, and its computation is unchanged.
From #178:
- A generated strategy library also defines
strategy_order_shapes_api_version(), which returns 1, andstrategy_order_shapes_receipt(s, json, capacity, required, error, error_capacity), with the same buffer protocol, whetherprocess_orders_on_closeis on or off. Its canonical JSON describes the strategy's order calls as they are lowered, for closing-time order processing: the keys areversion,process_orders_on_close,calls,entry_ids,host_reads,settingsandunmodeled.callshas one entry per loweredstrategy.entry,strategy.order,strategy.exit,strategy.close,strategy.close_all,strategy.cancelorstrategy.cancel_allsite, in source order, classing each parameter the call passes: a number asabsent(the default),literal,never_naormaybe_na, and text, enums, directions and IDs in classes of their own, an ID without its string; a site in a loop, a user function or a method is markedrepeatable.entry_idscounts the IDs thatstrategy.entryandstrategy.ordersites set, by direction, shared and repeated;host_readslists the execution members the generated C++ references;settingsholds the compiledstrategy()order settings (pyramiding,default_qty_type,initial_capital,slippage, ...), not later overrides;unmodelednames every otherstrategy.*call that is not read-only, risk rules included. - The receipt describes the calls; it is not an admission decision. Engine
v1.3.0does not read it: the runner-side policy that reads it ships in a separate engine change. #178 leaves the capability and confirmed-bar receipts byte for byte as they were, the confirmed-barordersincluded (tests/test_order_shapes.pypins both), and the trading code unchanged. The public contract describes both new receipts.
From #179:
- A strategy whose
input.stringdropdown uses a built-in constant as its default or an option no longer breaks its checked settings. 1.2.0 wrote a display constant's integer code, such assize.tiny's orposition.top_left's, where an option of the settings metadata needs a string, so building the metadata made a string from a null pointer andstrategy_get_effective_settingsorstrategy_set_input_checkedfailed or crashed. A constant that the generated code reads as a string (alert.freq_*,order.ascendinganddescending,session.regularandextended, and thecurrency.*andformat.*members, which publish their own names) keeps its exact default and choices. A default or option with no faithful string marks the input"supported": falsein the settings receipt, with"options": []and, when the default is such a constant,"default": "", where 1.2.0 published the input as supported;strategy_set_input_checkedrefuses it withPF_SETTINGS_UNSUPPORTED. The legacystrategy_set_input, the input getters and the strategy's execution are unchanged.
- String values derived from a script are validated and escaped wherever they are written into generated C++. The generated C++ of the 602 sources measured under "Compatibility and migration" does not change.
From #177:
- 1.3.0 is the first release under the PineForge Source License 1.2.
Compared with 1.1 it changes two places and nothing else. In the Personal
Trading section, an account that a proprietary-trading firm or a
funded-trader program provides or allocates to the person to trade,
including a challenge, evaluation or simulated account, whether the capital
in it is real or simulated, is not the person's own account and is not
funded by the person's own capital. In the Commercial Use section, the
capital in such an account is investment capital whether it is real or
simulated, so trading it, or researching, developing or backtesting
strategies for it, is Investment Management, which
LICENSEmakes Commercial Use for every individual and every organization unless it is Personal Trading. 1.2.0 shipped under the PineForge Source License 1.1, and releases up to and including 1.1.0 under "PineForge Codegen — License", the PolyForm Noncommercial License 1.0.0 with PineForge's supplemental sections; copies of those releases keep the license they shipped with.LICENSEis the controlling text;LEGAL.mdsummarizes it and is not legal advice. - Packaging: the PyPI classifier and
@pineforge/codegen-pyodide'spackage.jsonlicense field are 1.2.0's; theLICENSEboth packages carry is version 1.2.
- The README's scoreboard of
mainrenders from the facts tokens ofpineforge-releaseat 3e39d64 (#174): baselinepineforge-parity-baseline-20261005-input-reanchor-781b8f00(engine 3c414528, this repository at 39545379), 7,975 excellent and 14 strong of 7,989 graded probes, none below strong. Release 1.3.0 is graded on registry baselinepineforge-parity-baseline-20261006-engine-7a1f01c0, which holds 7,982 excellent and 7 strong of 7,989 graded probes, and 0 below strong. It measured engine 7a1f01c0 (pineforge-engine#347's merge), which v1.3.0 equals in behaviour, and this repository at 3e50082f (#177's merge). The pr-gates of the later code changes, #178's receipts and the hardening of emitted string values, changed no graded probe, and the release's other changes are documentation. docs/PUBLIC_CONTRACT.mddescribes the confirmed-bar and order-shapes receipts (#173, #178), and the README's License section,LEGAL.mdand the npm README name the PineForge Source License 1.2 (#177).
A minor release: generated strategy libraries gain the compiled execution
capability receipt that engine v1.2.0 adds to the C ABI, every diagnostic
carries a stable code and named arguments, and the package is licensed under
the PineForge Source License 1.1. It covers the changes merged to main since
1.1.0:
#167
changes the emitted C++,
#166
adds diagnostic codes to the Python and JSON results and raises a script's
first error in source order again,
#171
classifies diagnostic codes in linear time, moves to the PineForge Source
License 1.1 and renders the README's scoreboard, and
#168
replaces the license. Codegen 1.2.0 supports only engine v1.2.0. Engine
v1.2.0 defines PF_CAPABILITIES_API_VERSION (1) and declares two functions
in <pineforge/pineforge.h>
(pineforge-engine#332)
that the C++ of codegen 1.2.0 defines; the pair keeps C ABI version 4 and the
script ABI epoch engine_script_run_v19.
- Regenerate C++ with 1.2.0 and relink it against engine
v1.2.0's headers andlibpineforge.a. The C++ defines the capability functions only when the engine'spineforge/pineforge.hdefines bothPF_SETTINGS_API_VERSIONandPF_CAPABILITIES_API_VERSION, as enginev1.2.0's does. Against headers withoutPF_CAPABILITIES_API_VERSION, such as enginev1.1.0's, that block compiles to nothing and the library has no receipt; this does not make such a pair supported. C++ generated by 1.1.0 has no receipt either. Enginev1.2.0's live runner warns that it cannot prove a library without a receipt eligible, and runs it (see "Compiled execution capabilities"). - Every generated C++ file changes: it gains the capability block. Beyond
that, the C++ does not change: for the engine's 325 public corpus sources
and this repository's 277 gate fixtures, each transpiled in a fresh process,
1.2.0's C++ with the capability block removed is 1.1.0's C++ byte for byte,
and the 13 fixtures the gate expects to be refused are refused with the same
message. A script name spelled
strategy_capabilities_api_versionorstrategy_capabilities_receiptis renamed in the C++ (for examplepf_safe_strategy_capabilities_receipt), so a script cannot shadow the new functions; input keys are unaffected. - The Python and JSON contract is additive: each
Diagnosticgains the propertiescodeandargs,pineforge_codegenexportsdiagnostics_catalog()andrender_diagnostic(), and each JSON diagnostic ofgate/glue.py'stranspile_jsonsuccess and error envelopes gains the keyscodeandargs(see "Diagnostic codes"). No argument, result key or envelope is removed or renamed:transpile()andtranspile_full()keep their signatures and result keys, the envelopes keep every key they had, and each diagnostic keeps itsmessage,hint, severity and location. One result changes: the error raised for a script with errors in more than one place (see "First error in source order"). - Report keys: the engine's Docker harness (
docker/run_json.py, which thepineforge-releaseimage runs) is the same file in enginev1.2.0as inv1.1.0, so no report key is added, removed or renamed;metrics.equity.sharpe_tvandsortino_tv(EQUITY_REPORT_KEYS) are unchanged, and the engine's ADR-0001 keeps serialized report keys as they are. A report's fingerprint still differs between 1.1.0 and 1.2.0, since it records the engine and codegen versions and the generated C++'s hash, and the engine's Pine adapter changes sincev1.1.0(such as pineforge-engine#330) can change a run's trades. - 1.2.0 is the first release under the PineForge Source License 1.1. Releases up to and including 1.1.0 keep the license they shipped with (see "License").
From #167:
- Built against engine
v1.2.0, a generated strategy library definesstrategy_capabilities_api_version(), which returnsPF_CAPABILITIES_API_VERSION(1), andstrategy_capabilities_receipt(s, json, capacity, required, error, error_capacity), which writes the strategy's capability receipt. It uses the statuses and the buffer protocol of 1.1.0'sstrategy_get_effective_settings: called with a NULL buffer and 0, it returnsPF_SETTINGS_BUFFER_TOO_SMALLand the size to allocate, the NUL included; a short buffer gets an empty string, never partial JSON; a NULL strategy returnsPF_SETTINGS_INVALID_ARGUMENT; no exception gets through. The base C ABI does not change. - The receipt is canonical JSON (sorted keys, compact separators) written
into the C++ when it is generated, not read from a running strategy: every
handle returns the same bytes, before and after runs and setting changes.
Version 1 has the keys
version,declarations,requests,requirementsandunresolved.declarationsholds thestrategy()values ofcalc_on_every_tick,calc_on_order_fills,calc_on_every_history_tick,process_orders_on_close,use_bar_magnifier,fill_orders_on_standard_ohlc,backtest_fill_limits_assumption,currency,timeframe,timeframe_gapsanddynamic_requests, Pine's defaults where omitted; positional arguments are read in Pine's parameter order.requestslists eachrequest.securityandrequest.security_lower_tfsite, recorded request and request lowered to a run-time stop, with its function, symbol, timeframe, lookahead, gaps, Heikin-Ashi flag and feed (chart,auxiliary,recordedorunpinned).requirementssays whether the script needs other symbols' feeds, an FX curve (acurrencyother thancurrency.NONE), recorded series or intrabar persistence (varip).unresolvednames what the receipt cannot state as a literal (a nonliteralstrategy()argument, a request's nonliteral timeframe or lookahead, a request lowered to a run-time stop) and every use ofbarstate.isrealtime,timenow,barstate.islast,barstate.islastconfirmedhistory,last_bar_indexandlast_bar_time, in plots, labels and tables too. The receipt proves declarations only, not that a stream computes what a batch run computes. - A host reads the receipt before it runs a strategy, to tell whether its
execution mode can honour what the strategy declares. Engine
v1.2.0's live runner,pineforge-live, reads it before it opens its ledger (pineforge-engine#332) and refuses, naming the requirement, intrabar calculation (calc_on_every_tick,calc_on_order_fills,calc_on_every_history_tick),process_orders_on_close, the bar magnifier, standard-OHLC fills, nonzero limit-fill verification, acurrencyor atimeframedeclared instrategy(), every true requirement, every request whatever its timeframe, and every name inunresolved. A library without the extension, such as one generated by 1.1.0, gets a warning that its eligibility cannot be proved, and runs, its requests included. A batch run does not read the receipt, and its computation is unchanged. The engine'sdocs/strategy-capabilities.mdgives the schema and the runner's policy, and the public contract the codegen side.
From #166:
- Every diagnostic carries a stable
code(PF-E1203for an error,PF-W0412for a warning) andargs, the named raw values (identifiers, types, keywords, numbers) its Englishmessageandhintwere built from: intranspile_full(...)["diagnostics"], inCompileError.diagnosticsand in the JSON diagnostics of thetranspile_jsonenvelopes. They are read off the diagnostic's text when first asked for, after the transpile, so the emitted C++ does not depend on them;messageandhintkeep their text. diagnostics_catalog()returns the catalog, andrender_diagnostic(code, args)the English(message, hint)a code renders, equal to the diagnostic's byte for byte. The catalog (schemapineforge-diagnostics-catalog/v1, 628 codes) gives each code its severity, area, ICU MessageFormat message and hint templates, argument kinds and a one-line explanation, so an application can translate a diagnostic by its code. It ships in the package aspineforge_codegen/diagnostics_catalog.json, in@pineforge/codegen-pyodideas the./diagnostics_catalog.jsonexport, and with the GitHub release asdiagnostics_catalog-v1.2.0.json.- A code is never removed or reused, and a changed meaning gets a new code
(
tests/fixtures/diagnostic_codes_pin.json). See Diagnostic codes.
- 1.1.0's settings metadata read every input's
defval,options,minval,maxvalandstepahead of the script body, so an error there, such as an unknown name in a later input'sminval, was raised before an error on an earlier line. 1.2.0 raises the script's first error in source order again, as 1.0.1 did (#166). The emitted C++ does not change.
- Classifying a diagnostic's code no longer stalls on crafted script text
(#171).
As #166 merged it, the classifier matched each catalog template as a
backtracking regular expression over the message and hint, which carry text
the script spells: 1.8 KB of one template's text took 0.55 s to classify
and 3.4 KB took 23 s, a denial of service for
transpile_json, which classifies every diagnostic it returns, and for any host that readscodeorargs. Classification now takes time linear in the text: the same text grown to 6.6 MB classifies in milliseconds, with the same codes and arguments. No release had the stall: it was onmainfrom #166 to #171, and 1.1.0 has no diagnostic codes.
- 1.2.0 is the first release under the PineForge Source License 1.1, whose
licensor is pineforge, LLC. Releases up to and including 1.1.0 shipped
under "PineForge Codegen — License", the PolyForm Noncommercial License
1.0.0 with PineForge's supplemental sections, and copies of those releases
keep that license. The PineForge Source License is not a PolyForm license.
LICENSEis the controlling text;LEGAL.mdsummarizes it and is not legal advice. - The permitted purposes, free of charge, are noncommercial purposes,
personal uses, use by the noncommercial organizations
LICENSElists for their teaching, research and other operations, and Personal Trading: a natural person's research, development and backtesting of strategies and execution of trades for their own account with their own capital, asLICENSEdefines them. Investment Management (managing, advising on or trading investment capital, researching, developing or backtesting strategies for it, or operating the software for others who do, whoever the capital belongs to and whether or not for a fee) is Commercial Use for every individual and every organization, noncommercial organizations included, unless it is Personal Trading. So is any other use that is not a permitted purpose, such as use by, for or on behalf of a company, fund, partnership or other organization. Commercial Use needs a commercial license from pineforge, LLC ([email protected]). - Distributing copies is not Commercial Use, except that distributing the
software, changed or not, embedded in or bundled with a product or service
made available to others is Commercial Use unless it is a permitted
purpose. That exception is what 1.1 adds to the PineForge Source License
1.0, which #168 put on
mainand no release carried. LICENSEdefines Output: the code the software generates, such as the C++ it generates from PineScript, and any program or library built from it; backtest results, charts, reports and trade signals are not Output.- Packaging: the PyPI classifier is
License :: Other/Proprietary License(it wasLicense :: Free for non-commercial use), and@pineforge/codegen-pyodide'spackage.jsonsays"license": "SEE LICENSE IN LICENSE"(it saidPolyForm-Noncommercial-1.0.0) and the package containsLICENSE.
- The README's scoreboard of
mainrenders from the facts tokens ofpineforge-releaseat 03b8dcc (#171): baselinepineforge-parity-baseline-20261004-engine-6b77f061(engine 6b77f061, this repository at 285ac035), 7,970 excellent and 19 strong of 7,989 graded probes, none below strong. Release 1.2.0 is graded on registry baselinepineforge-parity-baseline-20261005-engine-52292db9: 7,970 excellent and 19 strong of 7,989 graded probes, none below strong, with engine 52292db9 (pineforge-engine#339's merge), which v1.2.0 equals in behaviour, and this repository at 48e7a13b, whose emitted C++ is codegen 1.2.0's: the release's remaining changes are documentation. docs/PUBLIC_CONTRACT.mddescribes the capability functions (#167) and diagnostic codes (#166). The README's License section andLEGAL.mdname the PineForge Source License and pineforge, LLC and give [email protected] for commercial licenses, andCONTRIBUTING.mdnames pineforge, LLC as the party a Contributor License Agreement grants rights to (#168, #171).
A minor release: generated strategy libraries gain the checked settings
functions that engine v1.1.0 adds to the C ABI, and transpile_full() lists
the other symbols' feeds a script requests. It covers the changes merged to
main since 1.0.1:
#159
changes the emitted C++,
#164
adds request discovery to the Python and JSON results, and
#160 and
#162 the
documentation. Codegen 1.1.0 supports only engine v1.1.0. Engine
v1.1.0 declares six functions in <pineforge/pineforge.h>
(pineforge-engine#317)
that the C++ of codegen 1.1.0 defines; the pair keeps C ABI version 4 and the
script ABI epoch engine_script_run_v19.
- Regenerate C++ with 1.1.0 and relink it against engine
v1.1.0's headers andlibpineforge.a. The C++ includespineforge/checked_settings.hppand compiles the checked settings functions only when the engine's headers provide that file and definePF_SETTINGS_API_VERSIONinpineforge/pineforge.h, as enginev1.1.0's do. Enginev1.1.0's library refuses to begin a run of a strategy whose setter failed (see "Exceptions at the C ABI"). C++ generated by 1.0.1 has neither the checked functions nor the exception handling. - Every generated C++ file changes: it gains the settings code and the
exception handlers described below. Beyond that, the C++ changes only for
the enum defaults and the renamed names described below: for the engine's
325 public corpus sources and this repository's 277 gate fixtures, 1.1.0's
C++ with the settings code removed (
tests/_legacy_cpp.py) is 1.0.1's C++ byte for byte, and the 13 fixtures the gate expects to be refused are refused with the same message. - Request discovery does not change the emitted C++
(#164):
the engine's 325 public corpus sources and this repository's 540
test-fixture
.pinefiles transpile to the same C++ as before it, byte for byte, each in a fresh process, and the 51 refused are refused with the same message. - The Python and JSON contract is additive:
transpile_full()'s result andgate/glue.py'stranspile_jsonsuccess envelope gain the keyrequests, and eachinput.symbolentry of the input manifest gains"kind": "symbol"(see "Request discovery"). No argument, result key or envelope is removed or renamed, andtranspile()and the error envelope are unchanged. One value changes: thedefaultreported for aninput.enumwhose default is a variable (see "Enum input defaults"). - Report keys: the JSON report of the engine's Docker harness
(
docker/run_json.py, which thepineforge-releaseimage runs) keeps every key it had with 1.0.1,metrics.equity.sharpe_tvandsortino_tvincluded, and addsapplied_runtime.syminfo,{"qty_step": v, "mincontract": v}, present only when the--syminfo/PINEFORGE_SYMINFOfile carries a validsyminfo.mincontract, which the harness now applies as the lot grid (pineforge-engine#322); 1.0.1 ignored it.fingerprint.provenance.runtimeequalsapplied_runtime, so a run on such a grid has a different fingerprint; for a run without one, #322 changes no byte of the report apart fromelapsed_seconds. Amincontractthe harness cannot apply is new failure output: one stdout line{"engine":"pineforge","error":...}, harness exit status 1 and image entrypoint exit status 4 (the existing backtest-failure status), withsyminfo.mincontract must be a positive finite number, got <json>for an invalid value, orthe strategy library has no strategy_set_syminfo_metadata, so syminfo.mincontract cannot be appliedfor a library without that function. - The same harness also installs other symbols' bars for
request.securityon another symbol:--symbol-feeds <index.json>(the image'sPINEFORGE_SYMBOL_FEEDS), a JSON index keyed by the exact symbol string the script passes and by timeframe, each feed an OHLCV CSV, with the symbol's catalogsyminfo(pineforge-engine#327, pineforge-release#23). It needs one feed per requested timeframe: nothing aggregates another symbol's bars. It installs them throughstrategy_set_symbol_factsandstrategy_set_symbol_feed, C ABI calls since 1.0.0, so the generated C++ does not change for it. What it installed is recorded asapplied_runtime.symbol_feeds,{"canonicalization": ..., "symbols": {"<symbol>": {"facts": {...}, "feeds": {"<timeframe>": {"bars": ..., "first_ts": ..., "last_ts": ..., "source_values_sha256": ...}}}}}, present only when it installed a symbol, so such a run has its own fingerprint. An index or a feed it cannot install fails the run the same way: one stdout line{"engine":"pineforge","error":"--symbol-feeds: ..."}, harness exit status 1, image entrypoint exit status 4. - Between 1.0.1 and 1.1.0 a report's fingerprint differs in any case, since it
records the engine and codegen versions and the generated C++'s hash, and
the Pine adapter changes in engine
v1.1.0(pineforge-engine#315, #316) can change a run's trades.
Built against engine v1.1.0, a generated strategy library defines
strategy_settings_api_version(), which returns 1, and five checked functions
(#159).
Each returns a pf_settings_status_t, writes its message to an optional
caller buffer and lets no exception through. The legacy setters still accept
or ignore what they accepted or ignored, an unknown key included; a value that
makes one of them throw now fails the strategy (see "Exceptions at the C
ABI").
strategy_set_input_checkedtakes the key the legacy getters read: the input's title, else its variable's name, else the empty key. Before it changes anything, it refuses an unknown key, a key two inputs share, an invalid boolean, enum member or option, trailing characters (3x), a fractional or out-of-range int (5.5,2147483648.0),NaNandInf, and a value outside the input'sminval/maxval.stepis not enforced. Aninput.enumis supported only when its options are literal members of one enum.strategy_set_override_checkedtakesinitial_capital,commission_value,default_qty_value,pyramiding,slippage,process_orders_on_close,calc_on_order_fills,close_entries_rule,default_qty_typeandcommission_type, with the aliases the legacy setter accepts (such asstrategy.cash), and refuses an unknown key and an invalid enum value, boolean or number.- Both setters refuse once a run has processed a bar or a stream has begun.
strategy_create_checkedrefuses a nonemptyparams_json, which the legacy factory ignores.strategy_get_effective_settingswrites a JSON receipt of every declared input, inline inputs included, in source order, and of the overrides above: type, options, default and effective value as canonical strings, andmin/max/stepas numbers ornull. Called with a NULL buffer and 0, it returnsPF_SETTINGS_BUFFER_TOO_SMALLand the size to allocate.run_backtest_full_checkedruns the batchrun_backtest_fullruns and returnsPF_SETTINGS_RUN_FAILEDfor a failure the run reports andPF_SETTINGS_EXCEPTIONfor an exception.- Script names that the settings code uses (
config_,inputs_,override_,last_error,last_error_,script_bars_processed,stream_phase_,StreamPhase,checked_settingsand the_pf_helpers) are renamed in the C++, so a script cannot shadow that code. Input keys are unaffected.
The engine's pineforge/pineforge.h and docs/checked-settings.md give the
signatures, the statuses and the buffer rules.
1.0.1's C++ let an exception thrown in a generated entry point propagate into the host, where a C caller cannot catch it. From #159:
strategy_create,run_backtest,run_backtest_full,strategy_set_input,strategy_set_override,strategy_set_magnifier_volume_weighted,strategy_freeandreport_freecatch every exception.strategy_createthen returns NULL;run_backtestandrun_backtest_fullzero the report and recordrun_backtest: <message>(orrun_backtest_full: …) as the errorstrategy_get_last_errorreturns.- A legacy setter that throws, such as
strategy_set_override(s, "pyramiding", "abc"), fails the strategy for good.strategy_get_last_errorreturnsstrategy_set_override: <message>;run_backtestandrun_backtest_fullreturn an empty report;run_backtest_full_checked, the checked setters andstrategy_get_effective_settingsreturnPF_SETTINGS_RUN_FAILEDwith that message;strategy_stream_beginreturns -1 andstrategy_last_run_status1 (not completed). A call that clears the last error, such as feed configuration, does not clear the failure: the next run reports it again. Free the strategy and create a new one. A stream already running keeps the settings it began with. A legacy setter that does not throw behaves as before. - With engine
v1.1.0,strategy_stream_beginalso fails with the message and status 1 when preparing the script throws for any other reason; a batch run keeps 1.0.1's empty report and completed status for such a failure (pineforge-engine#317).
From #159:
- A value that came out silently wrong: an
input.enumwhose default is a variable, as indefaultSide = Side.longfollowed byinput.enum(defaultSide, "Side"), now defaults to that member. 1.0.1's C++ read the variable before the script assigned it, so unless the host set the input, it held the enum's first member for the whole run. transpile_full()'sinputsandtranspile_jsonreport that member ("Side.long") as the input'sdefault, where 1.0.1 reportednull.- This holds for a top-level variable declared once before the input, never
reassigned, and set to a literal member, directly or through another such
variable. With any other variable, such as a
varor one set by an expression (c ? Side.long : Side.short), the input reads it as 1.0.1's C++ does;strategy_set_input_checkedrefuses such an input as unsupported, and the receipt reports its default asna.
From #164:
transpile_full()returns a new key,requests: every request site that reads another symbol's feed, so a host can fetch the bars a run needs before it starts it. Each entry gives the request'slineandfn, its symbol (literal,inputwith its override key and default,computedwith its value at the inputs' defaults where literals and inputs compute it, orunresolvable), its timeframe (literalin the engine's feed spelling,chart,inputorcomputed),lookahead,gapsandignore_invalid_symbol. A request lowered tona(its value reaches only plots and alerts) is not listed. See the public contract.gate/glue.py'stranspile_jsonsuccess envelope carries the same list underrequests.- The input manifest marks each
input.symbolentry with"kind": "symbol"; itstitle,typeanddefaultare unchanged.
- The README's parity scoreboard renders from the public facts tokens of
pineforge-release, and a release's grades are stated apart from the scoreboard ofmain(#160); no fact marker starts a line, so GitHub renders each sentence in its paragraph (#162). Release 1.1.0 is graded on registry baselinepineforge-parity-baseline-20261004-engine-7b596622: 7,951 excellent and 38 strong of 7,989 graded probes, with engine 7b596622, which v1.1.0 equals in behaviour: v1.1.0 adds a performance fix that its merge gate shows changes no trade or report. This repository was at c5d97ee, whose emitted C++ is codegen 1.1.0's. docs/PUBLIC_CONTRACT.mddescribes the checked settings functions and the exception handling (#159) and request discovery (#164).
A patch release of translation fixes. It covers the changes merged to main
since 1.0.0:
#156 and
#157
change the translation, and
#154 and
#155
the documentation. Codegen 1.0.1 supports only engine v1.0.1. Engine
v1.0.1 changes only documentation since v1.0.0, so the pair keeps C ABI
version 4 and the script ABI epoch engine_script_run_v19.
- Regenerate C++ with 1.0.1 and relink it against engine
v1.0.1's headers andlibpineforge.a. A pair change requires it, even though the C ABI number is unchanged. - The Python and JSON contract is unchanged:
transpile(),transpile_full()andgate/glue.py'stranspile_jsonkeep their arguments, result keys and envelopes. No report key changes: the engine's JSON report keeps the keys it had with 1.0.0,metrics.equity.sharpe_tvandsortino_tvincluded. - The engine's 325 public corpus sources and this repository's 277 gate fixtures transpile to the same C++ as with 1.0.0, byte for byte (the 13 fixtures the gate expects to be refused are refused with the same message), and so do the 1,384 real-world strategy sources the two pull requests measured, transpiled in fresh processes.
- Some scripts that 1.0.0 transpiled are refused now, each with the code
TradingView's compiler refuses it with. Among them are an array's history
used as an operand or as a value (
a[1] + 1,c.push(a[1]): CE10123), which 1.0.0 read, with a warning, as an element of the current array, and a method straight after a history read (m[1].get(0, 0): CE10011), which is written(m[1]).get(0, 0). "Refused at compile time" below lists them all.
1.0.0 emitted C++ that did not compile for the history of an object: it
declared a variable of a user-defined type or a drawing type whose history
was read Series<double>
(#156).
obj[k]is the reference the variable held k bars back,nabefore the first, and(obj[k]).fieldreads that object as it is now, as on TradingView, for boxes, lines and labels too. This holds for globals,varobjects, block and function locals, function parameters and method receivers, and a drawing parameter's or receiver's history takes its built-in methods ((this[1]).get_top()).- In a function, a method and an
ifblock the history counts the executions of the scope. At a call site that skips bars, a function's object parameter keeps one slot per chart bar, as TradingView does; a typed method's receiver does not yet (see "Not covered" below). - A temporary drawing passed to a drawing parameter compiles: a history read, a new drawing or chart point, or a call's result.
- The history of an expression whose value is an object (
o.inner[1],f()[1],(c ? a : b)[1]) is the reference it produced at its previous evaluation. Below a lazy edge, such as a?:arm, a read that is safe to evaluate (a pure or constructor call over pure arguments, a ternary over names, a named object's field) is kept on every bar, as TradingView keeps it. ==/!=compare two lines or two labels by identity,naincluded.
1.0.0 emitted C++ that did not compile for the history of an array or a
matrix, such as (a[1]).size(), array.size(a[1]) and (m[1]).get(0, 0)
(#157).
a[k]of an array or matrix variable, top-level or a block's local, is a read-only copy of the collection as the variable left it at the end of its scope's execution k executions back: the bar k bars back for a top-level variable, the block's previous run for a block's local. A built-in reads it,na()tests it, a variable or a function argument can hold it, andmatrix.copy(m[1])has the variable's element type. Afor...inloop overa[1]iterates the array the variable holds now, as on TradingView.- Two sibling blocks that declare the same name keep a history each.
- A change to the copy, to a slice of it, or through a variable or parameter bound to it stops the run with TradingView's runtime error RE10051. A method on it before the variable has a history stops the run with RE10052 for an array and RE10053 for a matrix.
From #157:
Cell.new(v = bar_index), a non-constant int given to afloatfield of a user-defined type, compiles: the int converts to a double and an intnatona. 1.0.0 narrowed it in a braced initializer, which did not compile.- A value that came out silently wrong:
c.v := iv, an int assigned to afloatfield, stored an intnaas -2147483648; it now storesna, as TradingView does. On theuassign_floattape 112 of 336 exits differed before. - A bool given to a
floatfield converts to 1 or 0 and is neverna. TradingView refuses a bool there (CE10123 in a constructor, CE10173 in an assignment).
A located CompileError now refuses, with TradingView's error code, what
TradingView's compiler refuses
(#156,
#157):
- a field or method straight after the history operator:
c[1].v(CE10011),b[1].get_top()(CE10010),a[1].size()(CE10011). The parenthesized(c[1]).vis the valid spelling; - the history of a field: a value field (
c.v[1],(c.v)[1]) and an object's array, matrix or map field (h.xs[1],(h.xs)[1]), CE10290; ==/!=of references other than lines and labels (CE10123), and of a reference withna(CE10187);- an array's history where a number, a condition, a string or an element is
expected: an operator's operand,
nz,math.*, a value slot of an array function (c.push(a[1]),array.new<float>(2, a[1])),log.*'s message,label.new's text andstr.tostringof a color array (CE10123); a scalar variable or field (CE10173); aniforwhilecondition (CE10101);array.from, andstr.formatof a color array (CE10122); a bare statement at the top level (CE10009).
Refused by name, where TradingView compiles the script; none of these compiled under 1.0.0:
- the history of an object or a drawing inside a
request.securityexpression (TradingView reads the requested timeframe's objects, which PineForge does not keep), and the history of achart.pointvariable whose fields the script changes (PineForge holds a point as a value) (#156); - an array or matrix history read whose earlier lowering did not compile, but for the two gaps below (#157).
- A typed method's receiver at a call site that skips bars counts calls,
where TradingView keeps one slot per chart bar: from the third call on,
this[2]reads three bars further back (#156). - The history of a function's array or matrix parameter or local, of a call's result and of a selection is not kept (TradingView keeps one per call). Such a read keeps 1.0.0's lowering where that compiled, and is refused otherwise (#157).
- Two kinds of history read keep the C++ they had, which does not compile: an
element function's value of a string array's history where the earlier
lowering is kept (in a function, a method, a loop or a block
var), such asf() => str.length(array.first(s[1])); and the history of a variable or a call that the analyzer does not type as an array or a matrix (a method's ormatrix.row's new array, a selection of arrays, a tuple's element, an array of drawings) (#157). - PineForge holds no
naarray: a variable bound to a history before the variable has one holds an empty array where TradingView's isna, and one the script also tests withna()is refused (#157). - As in 1.0.0, these do not compile: an int from
matrix.rows(),columns(),elements_count()orstrategy.wintradesgiven to afloatfield;matrix.sum(m1, m2)and other matrix results used without a declared type; a method called on an operator expression ((close * 2).m()).str.tostringof an array is not lowered.
- The README, the changelog and the docs describe the 1.0.0 release
(#154),
and the README calls no version the latest
(#155).
PyPI shows each release's README as its description, so 1.0.1's PyPI page
shows the README of the
v1.0.1tag; 1.0.0's keeps the one it was uploaded with.
This is the 1.0 release note. It covers the changes merged to main
since 0.10.4 (2026-09-06), through
#152;
#153
then updated the documentation. Codegen 1.0.0 supports only engine
v1.0.0; 1.0.0-rc.1 supports only engine v1.0.0-rc.1. The notes of
0.10.4 and earlier releases are on the
GitHub releases page.
- Generated strategies use the engine's
PineStrategyHostsource layer and explicitly attach Pine execution policies and cap compatibility (#127, #128, #129). Regenerate C++ and relink libraries for the exact engine pair. - Reused strategy handles reset persistent generated state before a new run
(#126).
Price-less
strategy.exitfollows the bracket-cancel command and the first-tick predicate uses its accessor (#130). - A
strategy()that omitsinitial_capital,default_qty_typeordefault_qty_valuegets TradingView's Pine v6 defaults (100,000,strategy.percent_of_equity, 100); before, the engine's own defaults applied (1,000,000 and 1 contract) (#147). Such a script sizes its orders differently and can book different trades; declare the arguments to keep the old sizing. time()/time_close()with a nonzerobars_backortimeframe_bars_backread another bar's time through the engine host'spine_time_offset, which the paired engine provides (#152).
- Replace Python expression execution in constant folding with bounded
evaluation (#125).
Preserve
nawhen double-valued expressions enter integer slots (#131). - Inline
input.*()TA lengths use the same reset and override path as bound inputs (#133).ta.changereceives its lookback incompute(), and input titles are escaped consistently (#134). - Input overrides reach precalculated TA sites;
ta.valuewhen, VWAP anchors, input keys, and Pine string escapes follow the validated spellings (#135). TA arguments are routed by signature; multiline strings, nested input keys, genericinput()lengths, and formattedlog.*calls are covered (#136). - Bare
ta.tr, located parser errors, TradingView numeric text,str.format(formatString=...), string-safe trace pragmas, and the native floating-point contraction flag are pinned by tests (#138). The paired TA1 engine handles ALMAfloor, KCuseTrueRange, explicit VWAP anchors, and pivot-level anchors/developing values (#139). nafollows Pine's rules wherever the generated C++ converts a value: it is false inif,?:,and/orand boolean parameters, an integer conversion ofnastaysna, and stored booleans and dynamic series indices keep it. Keltner Channel middle bands arenauntil their length is warm, as on TradingView. Standaloneta.emawarmup, collection history and a nullablestr.repeatresult, which the engine cannot yet represent exactly, now warn (#140).- An inverted
array.fillrange leaves the array unchanged and an invertedarray.sliceraises TradingView's runtime error, as on TradingView; everyarray.slicewarns that PineForge copies the slice where TradingView aliases it.request.securityresolves a chart-symbol name by lexical scope, so a function-local rebind no longer blocks an unrelated global (#140). A?:symbol that can select another symbol warned there; see the next section for what it does since #148.
- Pine library imports are inlined at transpile time: pass the sources as
transpile(..., libraries={"user/name/version": source}), or let the script's own requests manifest pin them ($PINEFORGE_PINE_LIBRARIESwith$PINEFORGE_REQUESTS_ROOT). Only what the script reaches is inlined, and a v5 library is lowered by v5's rules or refused naming the rule it would need (#148). An import whose alias ista,mathorstrand that names only that namespace's built-ins is a no-op (#146). Any other import without a source is still refused. - A
request.securityof another symbol whose value can reach a trade reads the feed a requests manifest pins for that symbol, and stops the run where its value is read when none is installed; it never reads the chart's bars in its place. A?:symbol that can select another symbol and whose value can reach a trade registers the symbol the run computes (#148). request.financial,request.earnings,request.dividendsandrequest.splitsread the per-bar series a requests manifest records, and arequest.securitywhose expression isrequest.footprint(ticks, va)reads the pinned feed's delta column (#148). Without that data, a request whose value reaches only plots, alerts, tables or logs lowers tonawith a warning, and one that can reach a trade stops the run where its value is read (#146).- A
request.securitysymbol, timeframe or payload parameter that reaches the request through helper functions resolves on every call path, one context per value (#146, #148). Payloads accept helpers with mixed tuples, multi-statement bodies andvarstate (#144), readinput.sourcevalues andhl2-family history on the requested bars, register a computed lower timeframe with its first-bar value, keep epochs in 64 bits (#146), and run helperfor/whileloops and a global's history on the requested bars (#152).
session.ismarket,session.ispremarketandsession.ispostmarketread the engine's session calendar and in-session facts, andsession.isfirstbar/islastbarand their_regularforms read the engine's session-day members (#142, #145, #150). Inside arequest.securitypayload they keep time-of-day predicates and warn.session.<flag>[k]reads the flag's history (#144).
- Pine's
intis 64-bit: constant arithmetic such as400 * 7200000folds in 64 bits, and an integer sum or product whose operands' known bounds can leave the 32-bit range (days * 86400000), or a product that%or/reads, is computed in 64 bits (#149, #151, #152). - Inputs are read before
varinitializers (#144), and avarread with history initializes at its declaration (#149). fixnanand 17 other built-in argument slots evaluate their argument once, a function returns its last statement's value, and a script variable read with history inside a function reads that call site's history (#146). Anifwithoutelsethat runs no arm isna(#148).- A deleted or collected drawing reads as
na, and drawings are collected as TradingView collects them (#146). color.new/color.rgbbind a keyword transparency like a positional one (#151), and a fractional input or series transparency rounds to the nearest alpha byte as TradingView's does, where it was truncated (#150). A fractional constantcolor.newtransparency, which TradingView truncates, now rounds too: a known divergence (10.5 reads back 11 where TradingView reads 10).- A function whose untyped parameter receives different types gets one body per call site (#151).
- A binary operator evaluates its left operand first when the other operand can observe its effect (#147).
- A
ta.*length fixed for the run builds the constant-length indicator on its first execution, and a series length ofta.highest,ta.lowest,ta.highestbarsorta.lowestbarsre-windows every call, andta.supertrendtakes a series factor or ATR length and reads the values of its first execution, as TradingView does; a series length of any otherta.*stays refused (#144). - A
switcharm written on its=>line may be a comma list of statements, library overloads that differ by qualifier bind as TradingView binds them, a genericinput()takes its default's type, andsyminfo.timezonespells a UTC exchange zoneEtc/UTC(#152). - A script that declares
use_bar_magnifier = trueexportsstrategy_declares_bar_magnifier()to the host, andsyminfo.mincontractreads the symbol fact the run declares (#146).
- Untrusted source that would crash or hang the transpiler raises a located
CompileError: source over 5 MiB (TradingView's 5MB compilation request), nesting over 512 levels, or a transpilation over 120 seconds (TradingView's compile limit). There is no statement-count limit. A 500-link?:chain, a 500-branchelse ifladder and a 2,000-elementarray.fromtranspile and compile; deeply nested calls no longer take exponential time.transpile()raises Python's recursion limit to 20,480 frames when it is lower. Numeric literals outside the C++ range raise a located error (#140). - A Pine name that is a C++17/C++20 keyword, a standard macro or an engine
name (for example
namespace,NULLorBox) compiles: the generated C++ spells itpf_safe_<name>, for variables, parameters, types, fields and tuple or loop bindings alike (#140). A script name that equals a host member the generated class reads is escaped too (#144).
- Update the direct build-tool
tardependency past the reported advisories and require a high-severity npm audit in release and publish gates (#140). - Limit the Python source archive to package code and release documents so a VCS-free RC build cannot include installed Node dependencies or generated gate payloads (#140).
- One
VERSIONvalue gives every channel its spelling: a prerelease such as1.0.0-rc.1ships as PyPI1.0.0rc1, on npm dist-tagnextand as a GitHub prerelease, never aslatest(#141). - Document the supported Python and gate/glue JSON contract, exact engine pairing, contribution checks, and release-note policy. Classify the package as Production/Stable for the 1.0 release (#140).
The release candidate for 1.0.0. Its changes since 0.10.4 are the ones listed
under 1.0.0; 1.0.0 changed only the version after it. It shipped as PyPI
1.0.0rc1, on npm dist-tag next and as a GitHub prerelease, and supports
only engine v1.0.0-rc.1.