pineforge-codegen 1.10.0__tar.gz → 1.12.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (114) hide show
  1. {pineforge_codegen-1.10.0 → pineforge_codegen-1.12.0}/CHANGELOG.md +258 -4
  2. {pineforge_codegen-1.10.0 → pineforge_codegen-1.12.0}/CONTRIBUTING.md +3 -0
  3. {pineforge_codegen-1.10.0 → pineforge_codegen-1.12.0}/PKG-INFO +13 -3
  4. {pineforge_codegen-1.10.0 → pineforge_codegen-1.12.0}/README.md +11 -2
  5. pineforge_codegen-1.12.0/VERSION +1 -0
  6. {pineforge_codegen-1.10.0 → pineforge_codegen-1.12.0}/docs/PUBLIC_CONTRACT.md +242 -36
  7. {pineforge_codegen-1.10.0 → pineforge_codegen-1.12.0}/docs/ci.md +87 -22
  8. {pineforge_codegen-1.10.0 → pineforge_codegen-1.12.0}/docs/codegen-coverage-gaps.md +48 -41
  9. pineforge_codegen-1.12.0/docs/engine-main-ci.md +339 -0
  10. pineforge_codegen-1.12.0/docs/reference/adding-a-pine-function.md +40 -0
  11. pineforge_codegen-1.12.0/docs/reference/conventions.md +156 -0
  12. pineforge_codegen-1.12.0/docs/reference/file-map.md +189 -0
  13. pineforge_codegen-1.12.0/docs/reference/known-codegen-quirks.md +493 -0
  14. pineforge_codegen-1.12.0/docs/reference/pipeline.md +74 -0
  15. pineforge_codegen-1.12.0/docs/reference/support-contracts.md +347 -0
  16. {pineforge_codegen-1.10.0 → pineforge_codegen-1.12.0}/pineforge_codegen/__init__.py +40 -9
  17. {pineforge_codegen-1.10.0 → pineforge_codegen-1.12.0}/pineforge_codegen/analyzer/base.py +944 -156
  18. {pineforge_codegen-1.10.0 → pineforge_codegen-1.12.0}/pineforge_codegen/analyzer/call_handlers.py +125 -37
  19. pineforge_codegen-1.12.0/pineforge_codegen/analyzer/callable_history_names.py +375 -0
  20. {pineforge_codegen-1.10.0 → pineforge_codegen-1.12.0}/pineforge_codegen/analyzer/contracts.py +8 -1
  21. pineforge_codegen-1.12.0/pineforge_codegen/analyzer/qualifiers.py +444 -0
  22. {pineforge_codegen-1.10.0 → pineforge_codegen-1.12.0}/pineforge_codegen/analyzer/types.py +79 -6
  23. pineforge_codegen-1.12.0/pineforge_codegen/analyzer/v6_forms.py +116 -0
  24. {pineforge_codegen-1.10.0 → pineforge_codegen-1.12.0}/pineforge_codegen/analyzer/value_bindings.py +28 -1
  25. pineforge_codegen-1.12.0/pineforge_codegen/array_binding.py +49 -0
  26. {pineforge_codegen-1.10.0 → pineforge_codegen-1.12.0}/pineforge_codegen/block_locals.py +56 -20
  27. pineforge_codegen-1.12.0/pineforge_codegen/builtin_keywords.py +93 -0
  28. {pineforge_codegen-1.10.0 → pineforge_codegen-1.12.0}/pineforge_codegen/codegen/array_field_width.py +2 -0
  29. pineforge_codegen-1.12.0/pineforge_codegen/codegen/array_slice.py +444 -0
  30. {pineforge_codegen-1.10.0 → pineforge_codegen-1.12.0}/pineforge_codegen/codegen/base.py +363 -93
  31. {pineforge_codegen-1.10.0 → pineforge_codegen-1.12.0}/pineforge_codegen/codegen/capabilities.py +4 -0
  32. pineforge_codegen-1.12.0/pineforge_codegen/codegen/capacities.py +139 -0
  33. {pineforge_codegen-1.10.0 → pineforge_codegen-1.12.0}/pineforge_codegen/codegen/checked_settings.py +21 -11
  34. {pineforge_codegen-1.10.0 → pineforge_codegen-1.12.0}/pineforge_codegen/codegen/closed_trade_fold.py +29 -2
  35. {pineforge_codegen-1.10.0 → pineforge_codegen-1.12.0}/pineforge_codegen/codegen/collection_history.py +23 -3
  36. {pineforge_codegen-1.10.0 → pineforge_codegen-1.12.0}/pineforge_codegen/codegen/constant_fold.py +4 -1
  37. {pineforge_codegen-1.10.0 → pineforge_codegen-1.12.0}/pineforge_codegen/codegen/constant_values.py +69 -4
  38. {pineforge_codegen-1.10.0 → pineforge_codegen-1.12.0}/pineforge_codegen/codegen/drawing.py +90 -7
  39. {pineforge_codegen-1.10.0 → pineforge_codegen-1.12.0}/pineforge_codegen/codegen/emit_top.py +169 -23
  40. {pineforge_codegen-1.10.0 → pineforge_codegen-1.12.0}/pineforge_codegen/codegen/helpers.py +171 -11
  41. {pineforge_codegen-1.10.0 → pineforge_codegen-1.12.0}/pineforge_codegen/codegen/host_members.py +5 -0
  42. {pineforge_codegen-1.10.0 → pineforge_codegen-1.12.0}/pineforge_codegen/codegen/input.py +70 -23
  43. {pineforge_codegen-1.10.0 → pineforge_codegen-1.12.0}/pineforge_codegen/codegen/order_shapes.py +14 -4
  44. pineforge_codegen-1.12.0/pineforge_codegen/codegen/retained_alias.py +315 -0
  45. {pineforge_codegen-1.10.0 → pineforge_codegen-1.12.0}/pineforge_codegen/codegen/run_stops.py +40 -0
  46. {pineforge_codegen-1.10.0 → pineforge_codegen-1.12.0}/pineforge_codegen/codegen/security.py +1279 -172
  47. {pineforge_codegen-1.10.0 → pineforge_codegen-1.12.0}/pineforge_codegen/codegen/ta.py +146 -97
  48. {pineforge_codegen-1.10.0 → pineforge_codegen-1.12.0}/pineforge_codegen/codegen/tables.py +204 -25
  49. {pineforge_codegen-1.10.0 → pineforge_codegen-1.12.0}/pineforge_codegen/codegen/timeframe_values.py +106 -12
  50. pineforge_codegen-1.12.0/pineforge_codegen/codegen/tv_string_units.py +122 -0
  51. {pineforge_codegen-1.10.0 → pineforge_codegen-1.12.0}/pineforge_codegen/codegen/types.py +1692 -158
  52. {pineforge_codegen-1.10.0 → pineforge_codegen-1.12.0}/pineforge_codegen/codegen/visit_call.py +467 -169
  53. {pineforge_codegen-1.10.0 → pineforge_codegen-1.12.0}/pineforge_codegen/codegen/visit_expr.py +305 -57
  54. {pineforge_codegen-1.10.0 → pineforge_codegen-1.12.0}/pineforge_codegen/codegen/visit_stmt.py +448 -149
  55. {pineforge_codegen-1.10.0 → pineforge_codegen-1.12.0}/pineforge_codegen/diagnostics_catalog.json +31 -3
  56. pineforge_codegen-1.12.0/pineforge_codegen/drawing_all.py +239 -0
  57. pineforge_codegen-1.12.0/pineforge_codegen/input_keys.py +88 -0
  58. pineforge_codegen-1.12.0/pineforge_codegen/intrinsic_binding.py +166 -0
  59. {pineforge_codegen-1.10.0 → pineforge_codegen-1.12.0}/pineforge_codegen/loop_types.py +6 -0
  60. {pineforge_codegen-1.10.0 → pineforge_codegen-1.12.0}/pineforge_codegen/method_binding.py +22 -2
  61. {pineforge_codegen-1.10.0 → pineforge_codegen-1.12.0}/pineforge_codegen/parser.py +35 -4
  62. {pineforge_codegen-1.10.0 → pineforge_codegen-1.12.0}/pineforge_codegen/request_discovery.py +7 -1
  63. {pineforge_codegen-1.10.0 → pineforge_codegen-1.12.0}/pineforge_codegen/security_contexts.py +256 -37
  64. {pineforge_codegen-1.10.0 → pineforge_codegen-1.12.0}/pineforge_codegen/signatures.py +140 -58
  65. {pineforge_codegen-1.10.0 → pineforge_codegen-1.12.0}/pineforge_codegen/support_checker.py +229 -43
  66. {pineforge_codegen-1.10.0 → pineforge_codegen-1.12.0}/pyproject.toml +1 -0
  67. pineforge_codegen-1.10.0/VERSION +0 -1
  68. pineforge_codegen-1.10.0/pineforge_codegen/builtin_keywords.py +0 -42
  69. pineforge_codegen-1.10.0/pineforge_codegen/intrinsic_binding.py +0 -50
  70. {pineforge_codegen-1.10.0 → pineforge_codegen-1.12.0}/.gitignore +0 -0
  71. {pineforge_codegen-1.10.0 → pineforge_codegen-1.12.0}/LEGAL.md +0 -0
  72. {pineforge_codegen-1.10.0 → pineforge_codegen-1.12.0}/LICENSE +0 -0
  73. {pineforge_codegen-1.10.0 → pineforge_codegen-1.12.0}/docs/pine-cap-activation.md +0 -0
  74. {pineforge_codegen-1.10.0 → pineforge_codegen-1.12.0}/pineforge_codegen/analyzer/__init__.py +0 -0
  75. {pineforge_codegen-1.10.0 → pineforge_codegen-1.12.0}/pineforge_codegen/analyzer/diagnostics.py +0 -0
  76. {pineforge_codegen-1.10.0 → pineforge_codegen-1.12.0}/pineforge_codegen/analyzer/operators.py +0 -0
  77. {pineforge_codegen-1.10.0 → pineforge_codegen-1.12.0}/pineforge_codegen/analyzer/tables.py +0 -0
  78. {pineforge_codegen-1.10.0 → pineforge_codegen-1.12.0}/pineforge_codegen/ast_nodes.py +0 -0
  79. {pineforge_codegen-1.10.0 → pineforge_codegen-1.12.0}/pineforge_codegen/codegen/__init__.py +0 -0
  80. {pineforge_codegen-1.10.0 → pineforge_codegen-1.12.0}/pineforge_codegen/codegen/ascii.py +0 -0
  81. {pineforge_codegen-1.10.0 → pineforge_codegen-1.12.0}/pineforge_codegen/codegen/bool_text.py +0 -0
  82. {pineforge_codegen-1.10.0 → pineforge_codegen-1.12.0}/pineforge_codegen/codegen/color_constants.py +0 -0
  83. {pineforge_codegen-1.10.0 → pineforge_codegen-1.12.0}/pineforge_codegen/codegen/endless_for.py +0 -0
  84. {pineforge_codegen-1.10.0 → pineforge_codegen-1.12.0}/pineforge_codegen/codegen/for_loops.py +0 -0
  85. {pineforge_codegen-1.10.0 → pineforge_codegen-1.12.0}/pineforge_codegen/codegen/graph_journal.py +0 -0
  86. {pineforge_codegen-1.10.0 → pineforge_codegen-1.12.0}/pineforge_codegen/codegen/helpers_syminfo.py +0 -0
  87. {pineforge_codegen-1.10.0 → pineforge_codegen-1.12.0}/pineforge_codegen/codegen/history_sharing.py +0 -0
  88. {pineforge_codegen-1.10.0 → pineforge_codegen-1.12.0}/pineforge_codegen/codegen/id_sites.py +0 -0
  89. {pineforge_codegen-1.10.0 → pineforge_codegen-1.12.0}/pineforge_codegen/codegen/session_market.py +0 -0
  90. {pineforge_codegen-1.10.0 → pineforge_codegen-1.12.0}/pineforge_codegen/codegen/strategy_declaration.py +0 -0
  91. {pineforge_codegen-1.10.0 → pineforge_codegen-1.12.0}/pineforge_codegen/codegen/tv_number_format.py +0 -0
  92. {pineforge_codegen-1.10.0 → pineforge_codegen-1.12.0}/pineforge_codegen/collection_history.py +0 -0
  93. {pineforge_codegen-1.10.0 → pineforge_codegen-1.12.0}/pineforge_codegen/cpp_allowlist.py +0 -0
  94. {pineforge_codegen-1.10.0 → pineforge_codegen-1.12.0}/pineforge_codegen/cpp_names.py +0 -0
  95. {pineforge_codegen-1.10.0 → pineforge_codegen-1.12.0}/pineforge_codegen/diagnostic_codes.py +0 -0
  96. {pineforge_codegen-1.10.0 → pineforge_codegen-1.12.0}/pineforge_codegen/errors.py +0 -0
  97. {pineforge_codegen-1.10.0 → pineforge_codegen-1.12.0}/pineforge_codegen/external_requests.py +0 -0
  98. {pineforge_codegen-1.10.0 → pineforge_codegen-1.12.0}/pineforge_codegen/finite_ta_length.py +0 -0
  99. {pineforge_codegen-1.10.0 → pineforge_codegen-1.12.0}/pineforge_codegen/function_overloads.py +0 -0
  100. {pineforge_codegen-1.10.0 → pineforge_codegen-1.12.0}/pineforge_codegen/lexer.py +0 -0
  101. {pineforge_codegen-1.10.0 → pineforge_codegen-1.12.0}/pineforge_codegen/library_inline.py +0 -0
  102. {pineforge_codegen-1.10.0 → pineforge_codegen-1.12.0}/pineforge_codegen/library_modules.py +0 -0
  103. {pineforge_codegen-1.10.0 → pineforge_codegen-1.12.0}/pineforge_codegen/library_v5.py +0 -0
  104. {pineforge_codegen-1.10.0 → pineforge_codegen-1.12.0}/pineforge_codegen/limits.py +0 -0
  105. {pineforge_codegen-1.10.0 → pineforge_codegen-1.12.0}/pineforge_codegen/matrix_overloads.py +0 -0
  106. {pineforge_codegen-1.10.0 → pineforge_codegen-1.12.0}/pineforge_codegen/pine_libraries.py +0 -0
  107. {pineforge_codegen-1.10.0 → pineforge_codegen-1.12.0}/pineforge_codegen/pine_spelling.py +0 -0
  108. {pineforge_codegen-1.10.0 → pineforge_codegen-1.12.0}/pineforge_codegen/pragmas.py +0 -0
  109. {pineforge_codegen-1.10.0 → pineforge_codegen-1.12.0}/pineforge_codegen/request_feed_inventory.py +0 -0
  110. {pineforge_codegen-1.10.0 → pineforge_codegen-1.12.0}/pineforge_codegen/session_reads.py +0 -0
  111. {pineforge_codegen-1.10.0 → pineforge_codegen-1.12.0}/pineforge_codegen/symbols.py +0 -0
  112. {pineforge_codegen-1.10.0 → pineforge_codegen-1.12.0}/pineforge_codegen/timeframe_token_cli.py +0 -0
  113. {pineforge_codegen-1.10.0 → pineforge_codegen-1.12.0}/pineforge_codegen/tokens.py +0 -0
  114. {pineforge_codegen-1.10.0 → pineforge_codegen-1.12.0}/pineforge_codegen/tv_input_choices.py +0 -0
@@ -22,6 +22,236 @@ supported as exact pairs; on the 0.x line they are independent. See the
22
22
 
23
23
  ## Unreleased (next release)
24
24
 
25
+ - Pine v6 reports located errors for a missing `color.new` transparency,
26
+ `fill(transp=...)`, calendar-number timestamp defaults in `input.time` with
27
+ a time zone string as the first timestamp argument or a `timezone` keyword,
28
+ literal plot widths below one, and variable or function declarations named
29
+ `range`.
30
+ - `input.string`, `input.timeframe`, `input.symbol`, `input.session` and
31
+ `input.text_area` carry never-reassigned global string literals into defaults
32
+ and options, including var declarations; an unproven variable default is now
33
+ a located error instead of a silent empty default, while an option that
34
+ cannot be proven keeps the existing unsupported marker in the manifest.
35
+ - Untyped history parameters now infer the enclosing call's primitive type
36
+ through immutable plain locals, fixed-result builtins and user-call variants
37
+ whose result the callee body proves, to the same type family as an explicit
38
+ parameter declaration.
39
+ - Pine v6 now refuses an `if` or `while` condition whose numeric value comes
40
+ from a `ta.*` call or a built-in variable such as `strategy.position_size`,
41
+ as TradingView does. Use a comparison such as `ta.change(t) != 0` for a bool
42
+ condition. Bool overloads and Pine v5 libraries keep their existing behavior. (#361)
43
+ - A Pine string literal that holds a NUL now keeps its whole length. Codegen
44
+ built every string literal with `std::string("...")`, which is made from a C
45
+ string and ends at the first NUL, so "a", NUL, "b" had length 1 (TradingView
46
+ gives 3), equalled its own one-letter prefix, and two literals that differed
47
+ only after the NUL compared equal. A literal with a NUL is now built with the
48
+ number of bytes it stands for; a literal without one is spelled as before, so
49
+ the generated code of every other script is unchanged. Not covered, and still
50
+ cut at the first NUL as before: the default and the options of the string
51
+ inputs (`input.string`, `input.symbol`, `input.session`, `input.timeframe`,
52
+ `input.text_area`), which the settings receipt and the manifest equal, an
53
+ input title, and the timeframe and footprint-column literals. One comparison
54
+ changes with it: a string input whose default holds a NUL no longer equals
55
+ the literal it was given, because the default is cut and the literal is not
56
+ (the two were equal before only because both were cut). A `var` that is read
57
+ with history and starts from a literal with a NUL was refused (its first
58
+ value put the NUL byte itself into the generated code); it now translates
59
+ and keeps the whole literal.
60
+ - Direct retained record fields built from stable `var` arrays, and direct
61
+ plain `var` array aliases, stay live through their creation bar and then
62
+ keep their own copy of the array as it stood at the end of that bar; two
63
+ holders built from one array do not share it. `copy()` of such a record
64
+ keeps its existing compile error. Requested evaluations, collection
65
+ history, nested records and intrabar recalculations keep their previous
66
+ lowering. Regenerate C++ and relink affected strategies.
67
+ - `str.format_time` now uses TradingView's documented defaults when arguments
68
+ are omitted: `"yyyy-MM-dd'T'HH:mm:ssZ"` for the format and the exchange time
69
+ zone (`syminfo.timezone`) for the timezone. Pass `"yyyy-MM-dd"` and `"UTC"`
70
+ explicitly to restore the previous output. Regenerate C++ and relink
71
+ affected strategies.
72
+ - `str.split(source, "")` with an empty separator now returns one part per
73
+ UTF-16 unit, as TradingView does: "axb" gives three parts, an accent or a CJK
74
+ character between two letters three, an emoji between two letters four (an
75
+ emoji is a high and a low surrogate, each kept as its own three-byte part).
76
+ It returned the whole string as one part, even for plain ASCII. The empty
77
+ text still has one part, as in TradingView. A separator that is not empty
78
+ splits as before, through the engine.
79
+ - A `when` argument on a strategy order call in Pine v6 now reports `PF-E2081`,
80
+ explaining that v6 removed the argument and recommending an `if` statement
81
+ around the call. Other unknown keywords keep `PF-E2027`.
82
+ - Pine identifiers spelled like generated state members or helpers use the C++ name allocator, including history-bearing locals in requested helpers.
83
+ - 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.
84
+ - 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 through `request.security` is still refused, as before; the support check still warns that `bar_index`, `last_bar_index` and `timenow` diverge 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.
85
+ - 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_string` to a string (#354).
86
+ - A function or method parameter spelled like a built-in variable (`close`,
87
+ `high`, ...) now keeps its `[n]` history operator and gives the same values
88
+ as when the parameter has another name (#360).
89
+ - History retention can be selected with keyword-only `history_capacity`
90
+ in `transpile()`, `transpile_full()`, `transpile_with_request_inventory()`
91
+ and `gate/glue.py::transpile_json()`. The JavaScript worker template does
92
+ not pass this option. Without a Pine directive, large constant offsets
93
+ infer sufficient bare history and dynamic offsets select this package's
94
+ 5000-slot retention default. Static operator overflow and invalid capacities
95
+ have typed diagnostics. Explicit runtime history bounds
96
+ stop with `pine_runtime_limit` and arguments `limit=max_bars_back`, `max=N`;
97
+ in-capacity warmup reads retain their missing-value behavior. A Pine
98
+ `max_bars_back` larger than `history_capacity` keeps its slots in the
99
+ stores, but the offset checks use `history_capacity` alone. Requested-helper
100
+ history references preserve their C++ members when a helper local or a
101
+ mutable global that the request reads has the same name as one of them.
102
+ Regenerate C++ and relink affected strategies.
103
+ - `drawing_capacity`, accepted by `transpile()`, `transpile_full()`,
104
+ `transpile_with_request_inventory()` and `gate/glue.py::transpile_json()`,
105
+ bounds live lines, boxes and labels independently after
106
+ Pine's existing collection step. Creating or copying beyond the selected
107
+ bound stops with `pine_runtime_limit` and arguments `limit=live_drawings`,
108
+ `max=N`. Pine declaration counts keep their ordinary TradingView collection
109
+ behavior; linefills are outside the bound. Typed stops require the paired
110
+ engine catalog's `live_drawings` value. Omitting the option preserves drawing
111
+ emission and collection. The JavaScript worker template does not pass this
112
+ option. Capacities outside the native int64 domain are refused even for
113
+ scripts without drawings. Regenerate C++ and relink affected strategies.
114
+ - Typed `array.from()` initializers now match their declared element type, including function-local `var` and `varip` arrays of timestamps.
115
+ - A `var` declared in one block no longer shares storage with a plain variable
116
+ of the same name in a sibling block, so it keeps its value across runs (#359).
117
+ - Variables initialized from `backadjustment.*`, `settlement_as_close.*` and
118
+ `adjustment.*` constants now use integer storage in emitted C++.
119
+ - `int(x)` of a floating value, and a stored `math.floor(x)`, `math.ceil(x)`
120
+ or `math.round(x)`, is a 64-bit integer whatever its magnitude, as in
121
+ TradingView: `int(1.7e12)`, `int(math.floor(1.7e12))` and
122
+ `v = math.floor(1.7e12)` are all 1700000000000. The generated C++ used to
123
+ read such a value outside the 32-bit range as the integer `na`
124
+ (-2147483648), which then flowed into arithmetic as that number. A value
125
+ that does not fit 64 bits, and a NaN, read `na` on every compiler and
126
+ architecture. A variable, function result, record field or int array that
127
+ holds the result of such an expression is `int64_t`, and a function
128
+ parameter that receives one follows. A 32-bit integer `na` (`int(na)`,
129
+ `bar_index`, a narrow input) that meets one of them in a selection arm, a
130
+ position of a tuple-valued selection, a store or a `request.security`
131
+ payload stays `na` instead of becoming the
132
+ number -2147483648. A history read (`int(x[1])`), a builtin float member
133
+ (`int(strategy.equity)`) and a float field of a record (`int(b.v)`) count as
134
+ floating values too. This changes generated C++ for scripts that use these
135
+ forms: regenerate and relink affected strategies.
136
+ - A float setting of a built-in indicator computed from an input now keeps
137
+ its fraction, as on TradingView: the multiplier of `ta.bb`, `ta.bbw`,
138
+ `ta.kc`, `ta.kcw` and the `ta.vwap` bands, the factor of `ta.supertrend`,
139
+ the arguments of `ta.sar`, and the offset and sigma of `ta.alma` (#362).
140
+ Regenerate C++ and relink affected strategies.
141
+ - Repeated explicit input titles now have separate override keys: the first
142
+ keeps the bare title, and later inputs use `<title>#<n>`, starting at 2 and
143
+ skipping authored titles and keys already assigned. The manifest, effective
144
+ settings receipt and input getters use the same keys. The checked input
145
+ setter now accepts the bare title for the first input instead of refusing
146
+ it as ambiguous; the legacy input setter now sets only the first input
147
+ instead of every input with that title. Repeated explicit titles no longer
148
+ trigger the shared-key warning; remaining collisions involving untitled
149
+ fallbacks still warn.
150
+ - A chart TA constructor length that shadows a global input or constant now follows its lexical binding; a series length for `ta.percentile_nearest_rank` now uses the engine's `SeriesPercentileNearestRank` buffer at each call site, including repeated calls from a loop. A call inside a conditional appends only when it runs. `PF-E5092` remains the refusal for a series length of `ta.sma` (#295), and its message names the Pine function (`ta.sma`, not `ta::SMA`) and says that TradingView accepts the call. Every other `ta.*` function keeps `PF-E5009` and 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.rci` and the `atrPeriod` of `ta.supertrend`) and the ones with no recorded result.
151
+ - Constant-expression input defaults can size TA constructors while retaining the input getter in runtime resets (#295).
152
+ - A `request.security` payload may read a global that is an element of a tuple declaration of a pure user function (`[_, g] = pair(x)` with `pair(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 a `ta.*` call, `var`, `varip`, a request or a method, a multi-statement body, and the history of an element (`g[1]`) keep their refusals.
153
+ - `line(na)` and `box(na)` emit the same missing handles as typed drawing declarations initialized with `na` (#295).
154
+ - Literal `na` in emitted strategy string parameters uses the empty-string sentinel, including `strategy.exit`'s `from_entry` (#295).
155
+ - Array bindings destructured from a helper's tuple retain their collection type for built-in method calls (#295).
156
+ - `if` and `switch` expressions reassigned to a history-bearing variable update its current Series slot (#295).
157
+ - Pine identifiers `bar` and `HUGE` use the existing C++ name escape without changing authored input titles (#295).
158
+ - 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).
159
+ - Direct `size`, `first`, `last` and `get` reads of `line.all`, `box.all`, `label.all` and `linefill.all` use live arena order; aliases and mutations raise `PF-E5086`, and `polyline.all` requires engine support (`PF-E5085`) (#295).
160
+ - C++ name escaping covers the macros defined by the audited math, limits, C++ wrapper and paired engine headers, retaining authored input keys (#295).
161
+ - A keyword argument of a built-in call reaches its own parameter. `timeframe.in_seconds(timeframe = ...)` and `timeframe.change(timeframe = ...)` used the chart's timeframe instead of the named one, `strategy.closedtrades.*(trade_num = ...)` and `strategy.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 skipped `hour` moved `minute` into its slot, `matrix.new<float>(rows = 2, columns = 3)` built a matrix with no rows and no columns, `time("60", timezone = ...)` and `time_close` read the timezone as the session, and `math.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.
162
+ - Strategy order calls report unknown keyword arguments at the keyword
163
+ (#286;
164
+ [#327](https://github.com/pineforge-4pass/pineforge-codegen-oss/pull/327)).
165
+ - Strategy orders with omitted `qty` use the default size; integer `switch` and
166
+ `if` results with an explicit `na` arm preserve NaN, and
167
+ `strategy.risk.allow_entry_in` retains input-dependent directions (#292).
168
+ - `strategy.risk.max_drawdown()` and `strategy.risk.max_intraday_loss()` called with `type = strategy.percent_of_equity`, or with `strategy.percent_of_equity` held 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.
169
+ - `max_bars_back(series, DEPTH)` with a `const int` `DEPTH` keeps 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 returned `na` (#326, #327). Regenerate C++ and relink strategies.
170
+ - A `var` array with a non-empty initializer declared inside an `if` block is initialized when the declaration is first reached, as in TradingView. The generated code reset it to empty and did not apply the initializer, so `array.size` and element reads differed (#333, #327). Regenerate C++ and relink strategies.
171
+ - Methods whose first parameter is never referenced in their body now report `PF-E5087` at that parameter, with a hint to use it or declare a function instead.
172
+ - Consumed `if`/`switch` selections mixing value and void arms now report located `PF-E5088`; requested void selections keep `PF-E3102`.
173
+ - A `request.security` payload that reads the history of an expression inside
174
+ a loop, or at several reads of one helper parameter, commits one history
175
+ slot per requested bar holding the last evaluation of that bar, as
176
+ TradingView does. Every read of the bar sees the history before this bar.
177
+ Regenerate C++ and relink strategies (#287;
178
+ [#327](https://github.com/pineforge-4pass/pineforge-codegen-oss/pull/327)).
179
+ - `request.security` registers input-derived `lookahead` selections using the
180
+ selected input values, including overrides; choices that depend on bar data
181
+ still report `PF-E1085`. A scalar empty timeframe still uses the chart
182
+ timeframe; an `if`/`switch` timeframe arm known to be empty still reports
183
+ `PF-E3105`.
184
+ History reads of requested values now compile inside another request's TA
185
+ expression, including aliases and repeated reads. Uncalled request wrappers
186
+ no longer interfere with compiling unrelated direct requests (#294;
187
+ [#327](https://github.com/pineforge-4pass/pineforge-codegen-oss/pull/327)).
188
+ - `input.enum` options named through immutable enum-member declarations now retain their choices and checked-settings support.
189
+ - Array fields in records that stay within one bar preserve omitted and explicit `na` IDs, distinct from empty arrays.
190
+ - Copying a record that stays within one bar shares its array fields while keeping scalar fields independent.
191
+ - A block-local `string` declaration at top level may now shadow a script-level `float` binding with declared or literal types without sharing storage; every other cross-type shadow keeps its existing refusal.
192
+ - A series variable declared or written inside a loop now opens one history
193
+ slot per bar at the first reach and updates it on later iterations, as in
194
+ TradingView. Previously, each iteration opened a separate slot, so `y[i]`
195
+ could read prior iterations instead of prior bars. Expression histories in
196
+ loops also keep one slot per bar, holding its last evaluation. Functions
197
+ read current globals produced by tuple declarations; ordinary `string`
198
+ declarations initialized with `na` reset on each execution; named
199
+ array-constructor arguments bind to `size` and `initial_value`.
200
+ Reassigned ordinary inputs restart from the selected input value at their
201
+ declaration on each bar; `var` and `varip` inputs retain their accumulated
202
+ state. Regenerate C++ and relink strategies
203
+ (#291; [#324](https://github.com/pineforge-4pass/pineforge-codegen-oss/pull/324),
204
+ [#327](https://github.com/pineforge-4pass/pineforge-codegen-oss/pull/327)).
205
+ - Runtime history offsets below 0 or above 10000 stop at the read with an
206
+ error naming the Pine line and offset, before integer narrowing. Constant
207
+ offsets keep their existing behavior (#311;
208
+ [#327](https://github.com/pineforge-4pass/pineforge-codegen-oss/pull/327)).
209
+ - `timestamp("...")` now accepts full English month names, including
210
+ `"01 February 2024 00:00"`. The existing 64-bit timestamp handling through
211
+ `input.time` and function or tuple results is preserved (#293;
212
+ [#327](https://github.com/pineforge-4pass/pineforge-codegen-oss/pull/327)).
213
+ - `timestamp("...")` date strings with a `UTC` or `GMT` zone word now give
214
+ TradingView's value for four forms that differed. A negative zone with a
215
+ zero hour keeps its sign (`GMT-00:30`, `UTC-0:30`). Minutes of 60 or more
216
+ are dropped and the hours kept (`UTC+01:60`, `UTC+00:90`). A number without
217
+ a sign after the word is ignored (`UTC30`, `UTC5`). With a numeric offset
218
+ and a word in one string the last one decides (`+0000 UTC+2`,
219
+ `UTC+2 +0000`). `UTC5` and `UTC+2 +0000` are no longer refused.
220
+ - `timestamp("...")` with a UTC or GMT zone word of 24 hours or more, for
221
+ example `UTC+24`, `GMT-24` or `UTC+25`, now translates instead of stopping
222
+ with an internal `ValueError`. As in TradingView, the zone word is plain
223
+ arithmetic on the date fields: the value is the fields read as UTC minus the
224
+ signed offset.
225
+ - In `//@version=6` scripts and libraries, type field defaults containing calls
226
+ or user-declared variable references now report `PF-E2087` at the default
227
+ expression's first token. V5 sources keep their earlier handling.
228
+ - `strategy.default_entry_qty(fill_price)` reads the engine host's query of the
229
+ default order size at a price (`default_entry_qty`); it used to lower to an
230
+ undeclared function, so a script that used it did not build. It needs an
231
+ engine whose strategy host provides the query. The calls TradingView refuses
232
+ are refused too, at the offending argument or call, also inside the arm of a
233
+ switch: no price, a second price, a price given both by position and by name,
234
+ an unknown argument name (`PF-E1088`), and a string, bool, color or
235
+ collection price (`PF-E2083` to `PF-E2086`, only for a type the syntax proves).
236
+ - PF-W1505 now explains both EMA seeding modes and names the engine run option
237
+ `series_origin_ms`, passed through the run's `syminfo`. The default first-value
238
+ seed matches TradingView charts with history before the range; when the
239
+ reference starts at the range start, declaring its first bar's open time in
240
+ epoch milliseconds selects `na` for the first `length-1` bars followed by an
241
+ SMA seed. This also applies to `ta.macd` and `ta.tsi`; `ta.kc` and `ta.kcw`
242
+ already start that way in every run, because the generated code applies the
243
+ warm-up to their EMA basis. Declared origins
244
+ start `request.security` at the first whole higher-timeframe bucket at or
245
+ after that time, with plain expressions `na` until its first bar completes.
246
+ In a measured 336-exit reference starting at the range start, 37 exit comments
247
+ differ by default, including 5 finite values where TradingView is `na`; none
248
+ differ with the origin declared. Six corpus cases add, drop or shift 1 to 3
249
+ trades in the first days by default; all six are exact with the declared
250
+ origin. A wrong origin gives wrong values; do not set it for live runs, where
251
+ it has no defined meaning. `ta.rsi`, `ta.rma` and `ta.atr` already use SMA
252
+ seeds. Migration: none; undeclared runs are unchanged. The diagnostic stays
253
+ an unconditional note at each `ta.ema` call; this text change leaves generated
254
+ C++ unchanged.
25
255
  - An affine chart loop proved endless is stopped with the loop-time error when
26
256
  its result reaches an effect. Omission is limited to an unused loop statement
27
257
  with no calls, whose writes have no readers except self-updates, a break
@@ -30,6 +260,10 @@ supported as exact pairs; on the 0.x line they are independent. See the
30
260
  may drop them. Endless loops in functions, methods and `request.security`
31
261
  still never end here while TradingView stops them; data-dependent endless
32
262
  loops still hang.
263
+ - Missing integer values remain `na` in float writes, numeric selections,
264
+ float arguments and arithmetic. Explicit float declarations keep fractional
265
+ values after integer initialization. Regenerate C++ and relink strategies.
266
+
33
267
  - Pine v6 calls refuse a positional argument after a named argument with
34
268
  `PF-E2074` at that positional expression. The check also covers strategy
35
269
  declarations, unused functions and v6 library bodies before lowering.
@@ -92,6 +326,26 @@ supported as exact pairs; on the 0.x line they are independent. See the
92
326
  TradingView accepts a namespace call after an expired block local with the
93
327
  same name; PineForge's analysis no longer refuses it, but code generation
94
328
  still rejects some such calls (a known gap).
329
+ - `str.length`, `str.pos` and `str.substring` now count and cut text in UTF-16
330
+ code units, as TradingView does: an emoji is two units and every other
331
+ character one. They counted UTF-8 bytes, so an accent counted 2, a CJK
332
+ character 3 and an emoji 4, and a position or a cut after such a character
333
+ was off by the extra bytes. The helpers are emitted into the generated file
334
+ only when its code calls one of the three functions (a call that is only a
335
+ plot argument emits nothing), so every other script keeps the text it had;
336
+ the engine is not involved. A cut between the two units of an emoji keeps
337
+ each half as its own three-byte sequence (the length of a half is one unit),
338
+ the form `str.split` gives its parts. Such a half never occurs inside a text
339
+ that holds the whole character, so three things differ from TradingView:
340
+ joining the two halves again, with `+` or `array.join`, does not give back
341
+ the original four bytes, so the joined text does not equal the original text;
342
+ a search for a half in the text it was cut from finds nothing (`str.pos`
343
+ returns -1, where the one byte the old cut gave was found at the same
344
+ position, and `str.contains` returns false); and a half is not equal to, or
345
+ at the start or end of, a part of that text that holds the whole character.
346
+ A begin position that lies inside the bytes of a text but past its units
347
+ (5 on "a", an emoji, "b") now stops the run; before, it returned the bytes
348
+ after that position.
95
349
 
96
350
  ## 1.9.1 — 2026-10-31
97
351
 
@@ -397,8 +651,8 @@ changes the emitted C++ and the other two only the repository's own CI.
397
651
  contract: the `promote-baseline` workflow refuses untrusted heads and actors
398
652
  (SEC846,
399
653
  [#242](https://github.com/pineforge-4pass/pineforge-codegen-oss/pull/242)),
400
- and `test.yml` adopts the organization's CI canon (CR-241,
401
- [#243](https://github.com/pineforge-4pass/pineforge-codegen-oss/pull/243)).
654
+ and `test.yml` adopts the organization's CI canon
655
+ ([#243](https://github.com/pineforge-4pass/pineforge-codegen-oss/pull/243)).
402
656
 
403
657
  ## 1.6.3 — 2026-10-23
404
658
 
@@ -468,8 +722,8 @@ emitter, a change of the licensor's written entity, and CI changes.
468
722
  - New command `pf-cpp-allowlist` (`pineforge_codegen.cpp_allowlist:main`,
469
723
  installed with the package), a checker for a generated C++ translation unit
470
724
  that flags dangerous primitives
471
- ([#210](https://github.com/pineforge-4pass/pineforge-codegen-oss/pull/210),
472
- CR-164 S1). It is a denylist with known false positives, a mitigation and not
725
+ ([#210](https://github.com/pineforge-4pass/pineforge-codegen-oss/pull/210)).
726
+ It is a denylist with known false positives, a mitigation and not
473
727
  proof that a unit is safe (the wording of the 1.6.3 security advisory).
474
728
  - A script identifier equal to a symbol that the checker refuses when it appears
475
729
  bare (`system`, `free`, `socket`, `open` and the rest of the list in
@@ -7,6 +7,9 @@ line with `git commit -s`. Material contributions also require a Contributor
7
7
  License Agreement so PINEFORGE LLC can include them in its commercial licenses;
8
8
  contact luis@4pass.com.tw before opening a material pull request.
9
9
 
10
+ Read the [emission invariant](AGENTS.md#emission-invariant) before changing
11
+ the translator: it governs lowerings, refusals and generated-C++ failures.
12
+
10
13
  ## Local setup
11
14
 
12
15
  Use Python 3.11 or newer, Node 22, a C++17 compiler, CMake, and a matching
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: pineforge-codegen
3
- Version: 1.10.0
3
+ Version: 1.12.0
4
4
  Summary: PineScript v6 to C++ transpiler that targets the pineforge-engine runtime.
5
5
  Project-URL: Homepage, https://github.com/pineforge-4pass/pineforge-codegen-oss
6
6
  Project-URL: Issues, https://github.com/pineforge-4pass/pineforge-codegen-oss/issues
@@ -280,6 +280,7 @@ Classifier: Programming Language :: Python :: 3.14
280
280
  Classifier: Topic :: Office/Business :: Financial
281
281
  Requires-Python: >=3.11
282
282
  Provides-Extra: dev
283
+ Requires-Dist: pytest-xdist>=3.5; extra == 'dev'
283
284
  Requires-Dist: pytest>=7.0; extra == 'dev'
284
285
  Description-Content-Type: text/markdown
285
286
 
@@ -641,6 +642,10 @@ gives every field.
641
642
 
642
643
  ### Transpile a file to a `.cpp`
643
644
 
645
+ Missing integers stay `na` when used as floats, including history reads,
646
+ assignments and float parameters. Regenerate C++ and relink strategy libraries
647
+ to apply corrections to previously generated code.
648
+
644
649
  ```python
645
650
  from pathlib import Path
646
651
  from pineforge_codegen import transpile
@@ -690,8 +695,10 @@ lists what 1.0.0 reads, warns about or refuses for such requests.
690
695
  ### Skip the support checker
691
696
 
692
697
  `check_support=False` on either Python function is **experimental**. It
693
- bypasses the gate and can produce C++ the engine will not accept or execute
694
- faithfully:
698
+ bypasses the support gate. Existing paths can produce C++ the engine will
699
+ not accept or execute faithfully; those are defects under the
700
+ [emission invariant](AGENTS.md#emission-invariant), which applies even when
701
+ the gate is bypassed. See the [open defects](docs/codegen-coverage-gaps.md).
695
702
 
696
703
  ```python
697
704
  from pathlib import Path
@@ -730,6 +737,9 @@ fields, such as `// @pf-trace gap=close - e` or
730
737
  pragma itself is not computed: `// @pf-trace rsi=ta.rsi(close, 14)` records
731
738
  `na` on every bar, and its C++ carries an `/* unsupported: ta.rsi */` marker.
732
739
  0.10.4, 1.0.0, 1.0.1, 1.1.0, 1.2.0 and 1.3.0 all behave this way.
740
+ This placeholder is an implementation gap under the
741
+ [emission invariant](AGENTS.md#emission-invariant); see the
742
+ [open defects](docs/codegen-coverage-gaps.md).
733
743
 
734
744
  ### Advanced: run the pipeline stages directly
735
745
 
@@ -356,6 +356,10 @@ gives every field.
356
356
 
357
357
  ### Transpile a file to a `.cpp`
358
358
 
359
+ Missing integers stay `na` when used as floats, including history reads,
360
+ assignments and float parameters. Regenerate C++ and relink strategy libraries
361
+ to apply corrections to previously generated code.
362
+
359
363
  ```python
360
364
  from pathlib import Path
361
365
  from pineforge_codegen import transpile
@@ -405,8 +409,10 @@ lists what 1.0.0 reads, warns about or refuses for such requests.
405
409
  ### Skip the support checker
406
410
 
407
411
  `check_support=False` on either Python function is **experimental**. It
408
- bypasses the gate and can produce C++ the engine will not accept or execute
409
- faithfully:
412
+ bypasses the support gate. Existing paths can produce C++ the engine will
413
+ not accept or execute faithfully; those are defects under the
414
+ [emission invariant](AGENTS.md#emission-invariant), which applies even when
415
+ the gate is bypassed. See the [open defects](docs/codegen-coverage-gaps.md).
410
416
 
411
417
  ```python
412
418
  from pathlib import Path
@@ -445,6 +451,9 @@ fields, such as `// @pf-trace gap=close - e` or
445
451
  pragma itself is not computed: `// @pf-trace rsi=ta.rsi(close, 14)` records
446
452
  `na` on every bar, and its C++ carries an `/* unsupported: ta.rsi */` marker.
447
453
  0.10.4, 1.0.0, 1.0.1, 1.1.0, 1.2.0 and 1.3.0 all behave this way.
454
+ This placeholder is an implementation gap under the
455
+ [emission invariant](AGENTS.md#emission-invariant); see the
456
+ [open defects](docs/codegen-coverage-gaps.md).
448
457
 
449
458
  ### Advanced: run the pipeline stages directly
450
459
 
@@ -0,0 +1 @@
1
+ 1.12.0