@orangecharts/wrun-chart-host 0.3.0 → 0.5.0

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 (362) hide show
  1. package/README.md +23 -6
  2. package/dist/constants/exchange-names.leaf.d.ts +8 -0
  3. package/dist/constants/exchange-names.leaf.js +101 -0
  4. package/dist/constants/kscript-data-interval-restrictions.constants.d.ts +15 -0
  5. package/dist/constants/kscript-data-interval-restrictions.constants.js +40 -0
  6. package/dist/constants/opra-compliance.constants.d.ts +19 -0
  7. package/dist/constants/opra-compliance.constants.js +19 -0
  8. package/dist/constants/replay-ladder.leaf.d.ts +30 -0
  9. package/dist/constants/replay-ladder.leaf.js +99 -0
  10. package/dist/constants/scriptEditor/builtin-script-snippets.d.ts +133 -0
  11. package/dist/constants/scriptEditor/builtin-script-snippets.js +451 -0
  12. package/dist/constants/scriptEditor/cme-official-scripts.constants.d.ts +168 -0
  13. package/dist/constants/scriptEditor/cme-official-scripts.constants.js +398 -0
  14. package/dist/constants/scriptEditor/converted-script-id.leaf.d.ts +8 -0
  15. package/dist/constants/scriptEditor/converted-script-id.leaf.js +10 -0
  16. package/dist/constants/scriptEditor/execution.constants.d.ts +4 -0
  17. package/dist/constants/scriptEditor/execution.constants.js +14 -0
  18. package/dist/constants/wrun-prefix-safe.constants.d.ts +23 -0
  19. package/dist/constants/wrun-prefix-safe.constants.js +26 -0
  20. package/dist/host-env.d.ts +321 -24
  21. package/dist/host-env.js +15 -0
  22. package/dist/host-ports.types.d.ts +857 -35
  23. package/dist/index.d.ts +149 -2
  24. package/dist/index.js +149 -2
  25. package/dist/instances/script-engine-worker-ohlcv-transfer.d.ts +31 -0
  26. package/dist/instances/script-engine-worker-ohlcv-transfer.js +164 -0
  27. package/dist/interfaces/market-event.interface.d.ts +231 -0
  28. package/dist/interfaces/market-event.interface.js +15 -0
  29. package/dist/interfaces/opra-realtime.interface.d.ts +70 -134
  30. package/dist/interfaces/opra-realtime.interface.js +34 -59
  31. package/dist/interfaces/replay.interface.d.ts +285 -0
  32. package/dist/interfaces/replay.interface.js +1 -0
  33. package/dist/kscript-data/controls/live-ohlcv-merge.util.d.ts +1 -0
  34. package/dist/kscript-data/controls/live-ohlcv-merge.util.js +93 -0
  35. package/dist/kscript-data/controls/live-trades-merge.util.d.ts +5 -1
  36. package/dist/kscript-data/controls/live-trades-merge.util.js +2 -2
  37. package/dist/market-data/billing.interface.d.ts +219 -0
  38. package/dist/market-data/billing.interface.js +58 -0
  39. package/dist/market-data/venue-governed.util.d.ts +2 -0
  40. package/dist/market-data/venue-governed.util.js +10 -0
  41. package/dist/market-data/venue.d.ts +122 -0
  42. package/dist/market-data/venue.js +1 -0
  43. package/dist/market-data/venues/index.d.ts +97 -0
  44. package/dist/market-data/venues/index.js +33 -0
  45. package/dist/market-data/venues/opra.contract.copy.json +35 -0
  46. package/dist/market-data/venues/opra.d.ts +70 -0
  47. package/dist/market-data/venues/opra.js +74 -0
  48. package/dist/replay/replayIndicatorRows.d.ts +31 -0
  49. package/dist/replay/replayIndicatorRows.js +117 -0
  50. package/dist/replay/replayLadder.d.ts +85 -0
  51. package/dist/replay/replayLadder.js +388 -0
  52. package/dist/utility/auth/server-clock.util.d.ts +81 -0
  53. package/dist/utility/auth/server-clock.util.js +238 -0
  54. package/dist/utility/chart/builtin-identity.util.d.ts +18 -0
  55. package/dist/utility/chart/builtin-identity.util.js +51 -0
  56. package/dist/utility/chart/cache-alignment.util.d.ts +454 -0
  57. package/dist/utility/chart/cache-alignment.util.js +926 -0
  58. package/dist/utility/chart/chart-data-fetch-generation.util.d.ts +15 -0
  59. package/dist/utility/chart/chart-data-fetch-generation.util.js +22 -0
  60. package/dist/utility/chart/chart-mount-epoch.util.d.ts +5 -0
  61. package/dist/utility/chart/chart-mount-epoch.util.js +29 -0
  62. package/dist/utility/chart/chart-time-domain.util.d.ts +12 -0
  63. package/dist/utility/chart/chart-time-domain.util.js +23 -0
  64. package/dist/utility/chart/color-customization.leaf.d.ts +10 -0
  65. package/dist/utility/chart/color-customization.leaf.js +16 -0
  66. package/dist/utility/chart/date-labelled-interval.leaf.d.ts +15 -0
  67. package/dist/utility/chart/date-labelled-interval.leaf.js +19 -0
  68. package/dist/utility/chart/footprint-tick-grid.util.d.ts +106 -0
  69. package/dist/utility/chart/footprint-tick-grid.util.js +167 -0
  70. package/dist/utility/chart/gesture-timing.leaf.d.ts +29 -0
  71. package/dist/utility/chart/gesture-timing.leaf.js +29 -0
  72. package/dist/utility/chart/governed-contract-coin.util.d.ts +22 -0
  73. package/dist/utility/chart/governed-contract-coin.util.js +39 -0
  74. package/dist/utility/chart/host-bar-placement.util.d.ts +107 -0
  75. package/dist/utility/chart/host-bar-placement.util.js +447 -0
  76. package/dist/utility/chart/index-host-tier.util.d.ts +31 -0
  77. package/dist/utility/chart/index-host-tier.util.js +118 -0
  78. package/dist/utility/chart/index-mode-admission.util.d.ts +34 -0
  79. package/dist/utility/chart/index-mode-admission.util.js +67 -0
  80. package/dist/utility/chart/indicator-error-message.util.d.ts +35 -0
  81. package/dist/utility/chart/indicator-error-message.util.js +44 -0
  82. package/dist/utility/chart/indicator-run-interval.util.d.ts +130 -0
  83. package/dist/utility/chart/indicator-run-interval.util.js +268 -0
  84. package/dist/utility/chart/kscript-apply-fingerprint.util.d.ts +65 -0
  85. package/dist/utility/chart/kscript-apply-fingerprint.util.js +357 -0
  86. package/dist/utility/chart/kscript-chart-flush.leaf.d.ts +22 -0
  87. package/dist/utility/chart/kscript-chart-flush.leaf.js +13 -0
  88. package/dist/utility/chart/kscript-data-interval-restriction.leaf.d.ts +6 -0
  89. package/dist/utility/chart/kscript-data-interval-restriction.leaf.js +27 -0
  90. package/dist/utility/chart/kscript-integration-decision.leaf.d.ts +89 -0
  91. package/dist/utility/chart/kscript-integration-decision.leaf.js +80 -0
  92. package/dist/utility/chart/kscript-live-coalesce.util.d.ts +76 -0
  93. package/dist/utility/chart/kscript-live-coalesce.util.js +156 -0
  94. package/dist/utility/chart/kscript-live-rest-pace.util.d.ts +34 -0
  95. package/dist/utility/chart/kscript-live-rest-pace.util.js +134 -0
  96. package/dist/utility/chart/kscript-live-source-identity.util.d.ts +98 -0
  97. package/dist/utility/chart/kscript-live-source-identity.util.js +121 -0
  98. package/dist/utility/chart/kscript-mounted-plot-set.leaf.d.ts +48 -0
  99. package/dist/utility/chart/kscript-mounted-plot-set.leaf.js +145 -0
  100. package/dist/utility/chart/kscript-perf-tracker.util.d.ts +243 -0
  101. package/dist/utility/chart/kscript-perf-tracker.util.js +522 -0
  102. package/dist/utility/chart/kscript-run-interval-projection.util.d.ts +43 -0
  103. package/dist/utility/chart/kscript-run-interval-projection.util.js +471 -0
  104. package/dist/utility/chart/kscript-run-result-equality.util.d.ts +38 -0
  105. package/dist/utility/chart/kscript-run-result-equality.util.js +89 -0
  106. package/dist/utility/chart/kscript-settings-revision.leaf.d.ts +2 -0
  107. package/dist/utility/chart/kscript-settings-revision.leaf.js +12 -0
  108. package/dist/utility/chart/kscript-source-degrade.leaf.d.ts +63 -0
  109. package/dist/utility/chart/kscript-source-degrade.leaf.js +68 -0
  110. package/dist/utility/chart/kscript-source-retention.util.d.ts +134 -0
  111. package/dist/utility/chart/kscript-source-retention.util.js +218 -0
  112. package/dist/utility/chart/kscript-standin-identity.leaf.d.ts +57 -0
  113. package/dist/utility/chart/kscript-standin-identity.leaf.js +61 -0
  114. package/dist/utility/chart/kscript-titancharts-preparation.util.d.ts +15 -0
  115. package/dist/utility/chart/kscript-titancharts-preparation.util.js +376 -0
  116. package/dist/utility/chart/kscript-titancharts-render-keys.constants.d.ts +9 -0
  117. package/dist/utility/chart/kscript-titancharts-render-keys.constants.js +130 -0
  118. package/dist/utility/chart/kscript-venue-policy.util.d.ts +217 -0
  119. package/dist/utility/chart/kscript-venue-policy.util.js +324 -0
  120. package/dist/utility/chart/live-cadence.util.d.ts +38 -0
  121. package/dist/utility/chart/live-cadence.util.js +37 -0
  122. package/dist/utility/chart/live-feed-series-match.leaf.d.ts +13 -0
  123. package/dist/utility/chart/live-feed-series-match.leaf.js +21 -0
  124. package/dist/utility/chart/local-engine-self-heal-backoff.util.d.ts +46 -0
  125. package/dist/utility/chart/local-engine-self-heal-backoff.util.js +46 -0
  126. package/dist/utility/chart/local-engine-uninit.leaf.d.ts +21 -0
  127. package/dist/utility/chart/local-engine-uninit.leaf.js +22 -0
  128. package/dist/utility/chart/local-kscript-source-revalidation.util.d.ts +62 -0
  129. package/dist/utility/chart/local-kscript-source-revalidation.util.js +123 -0
  130. package/dist/utility/chart/local-kscript-warmup-depth.util.d.ts +214 -0
  131. package/dist/utility/chart/local-kscript-warmup-depth.util.js +376 -0
  132. package/dist/utility/chart/local-technical-script-live-apply-coalescer.util.d.ts +85 -0
  133. package/dist/utility/chart/local-technical-script-live-apply-coalescer.util.js +197 -0
  134. package/dist/utility/chart/local-technical-script-range.leaf.d.ts +72 -0
  135. package/dist/utility/chart/local-technical-script-range.leaf.js +126 -0
  136. package/dist/utility/chart/mixed-mode.util.d.ts +167 -0
  137. package/dist/utility/chart/mixed-mode.util.js +139 -0
  138. package/dist/utility/chart/ohlcv-row-readiness.util.d.ts +36 -0
  139. package/dist/utility/chart/ohlcv-row-readiness.util.js +90 -0
  140. package/dist/utility/chart/opra-user-scripts-gate.util.d.ts +19 -0
  141. package/dist/utility/chart/opra-user-scripts-gate.util.js +32 -0
  142. package/dist/utility/chart/overlay-execution-guard-key.leaf.d.ts +8 -0
  143. package/dist/utility/chart/overlay-execution-guard-key.leaf.js +10 -0
  144. package/dist/utility/chart/price-precision.util.d.ts +40 -0
  145. package/dist/utility/chart/price-precision.util.js +70 -0
  146. package/dist/utility/chart/profile-block-size.util.d.ts +64 -0
  147. package/dist/utility/chart/profile-block-size.util.js +141 -0
  148. package/dist/utility/chart/protected-kscript-degenerate-rows.leaf.d.ts +11 -0
  149. package/dist/utility/chart/protected-kscript-degenerate-rows.leaf.js +29 -0
  150. package/dist/utility/chart/protected-kscript-empty-output.util.d.ts +28 -0
  151. package/dist/utility/chart/protected-kscript-empty-output.util.js +84 -0
  152. package/dist/utility/chart/run-interval-unservable.leaf.d.ts +9 -0
  153. package/dist/utility/chart/run-interval-unservable.leaf.js +20 -0
  154. package/dist/utility/chart/run-interval-warmup.leaf.d.ts +19 -0
  155. package/dist/utility/chart/run-interval-warmup.leaf.js +35 -0
  156. package/dist/utility/chart/titan-constants.pin.d.ts +9 -5
  157. package/dist/utility/chart/titan-constants.pin.js +18 -5
  158. package/dist/utility/chart/warmup-backfill-retry.leaf.d.ts +9 -0
  159. package/dist/utility/chart/warmup-backfill-retry.leaf.js +9 -0
  160. package/dist/utility/chart/window-geometry.leaf.d.ts +119 -0
  161. package/dist/utility/chart/window-geometry.leaf.js +391 -0
  162. package/dist/utility/chart/window-owner.leaf.d.ts +19 -0
  163. package/dist/utility/chart/window-owner.leaf.js +24 -0
  164. package/dist/utility/chart/wrun-bar-session-facts.util.d.ts +11 -2
  165. package/dist/utility/chart/wrun-bar-session-facts.util.js +10 -3
  166. package/dist/utility/chart/wrun-run-result.util.d.ts +5 -1
  167. package/dist/utility/chart/wrun-run-result.util.js +20 -14
  168. package/dist/utility/common/data-processing.util.d.ts +138 -0
  169. package/dist/utility/common/data-processing.util.js +346 -0
  170. package/dist/utility/common/visible-timeout.util.d.ts +13 -4
  171. package/dist/utility/common/visible-timeout.util.js +23 -8
  172. package/dist/utility/exchange-format.leaf.d.ts +1 -0
  173. package/dist/utility/exchange-format.leaf.js +47 -0
  174. package/dist/utility/html-escape.leaf.d.ts +11 -0
  175. package/dist/utility/html-escape.leaf.js +20 -0
  176. package/dist/utility/market-events/earnings-scope.util.d.ts +60 -0
  177. package/dist/utility/market-events/earnings-scope.util.js +92 -0
  178. package/dist/utility/market-events/market-events.util.d.ts +147 -0
  179. package/dist/utility/market-events/market-events.util.js +392 -0
  180. package/dist/utility/market-events/zoned-clock.util.d.ts +1 -0
  181. package/dist/utility/market-events/zoned-clock.util.js +11 -0
  182. package/dist/utility/options/option-venue-disclosure.util.d.ts +43 -0
  183. package/dist/utility/options/option-venue-disclosure.util.js +56 -0
  184. package/dist/utility/scriptEditor/package-semver.util.d.ts +51 -0
  185. package/dist/utility/scriptEditor/package-semver.util.js +120 -0
  186. package/dist/utility/scriptEditor/temp-script-id.util.d.ts +18 -0
  187. package/dist/utility/scriptEditor/temp-script-id.util.js +25 -0
  188. package/dist/utility/symbol-selection/markets-request-from-symbols.leaf.d.ts +20 -0
  189. package/dist/utility/symbol-selection/markets-request-from-symbols.leaf.js +81 -0
  190. package/dist/utility/v2/governed-tier.leaf.d.ts +103 -0
  191. package/dist/utility/v2/governed-tier.leaf.js +113 -0
  192. package/dist/utility/watchlist/import/import-request.leaf.d.ts +10 -0
  193. package/dist/utility/watchlist/import/import-request.leaf.js +10 -0
  194. package/dist/utility/wrun/sources/lanes/option_daily.d.ts +43 -15
  195. package/dist/utility/wrun/sources/lanes/option_daily.js +78 -20
  196. package/dist/utility/wrun/sources/lanes/option_stats_10m.d.ts +14 -10
  197. package/dist/utility/wrun/sources/lanes/option_stats_10m.js +5 -4
  198. package/dist/utility/wrun/sources/lanes/series.js +2 -2
  199. package/dist/utility/wrun/sources/opra-option-lanes.util.d.ts +22 -3
  200. package/dist/utility/wrun/sources/opra-option-lanes.util.js +38 -7
  201. package/dist/utility/wrun/sources/registry.js +31 -1
  202. package/dist/utility/wrun/sources/row-lane-registry.js +5 -5
  203. package/dist/utility/wrun/sources/row-lanes/option_contract_state.d.ts +49 -0
  204. package/dist/utility/wrun/sources/row-lanes/option_contract_state.js +75 -20
  205. package/dist/utility/wrun/sources/row-lanes/option_strikes.d.ts +49 -0
  206. package/dist/utility/wrun/sources/row-lanes/option_strikes.js +57 -47
  207. package/dist/utility/wrun/sources/row-lanes/option_surface.d.ts +36 -4
  208. package/dist/utility/wrun/sources/row-lanes/option_surface.js +6 -12
  209. package/dist/utility/wrun/sources/wrun-poll-lane.types.d.ts +37 -3
  210. package/dist/utility/wrun/sources/wrun-poll-lanes.util.d.ts +128 -2
  211. package/dist/utility/wrun/sources/wrun-poll-lanes.util.js +233 -51
  212. package/dist/utility/wrun/sources/wrun-row-lane.types.d.ts +0 -8
  213. package/dist/utility/wrun/sources/wrun-row-lanes.util.d.ts +26 -24
  214. package/dist/utility/wrun/sources/wrun-row-lanes.util.js +85 -104
  215. package/dist/utility/wrun/wrun-alert-outputs.registry.d.ts +166 -0
  216. package/dist/utility/wrun/wrun-alert-outputs.registry.js +219 -0
  217. package/dist/utility/wrun/wrun-bar-count.util.d.ts +83 -0
  218. package/dist/utility/wrun/wrun-bar-count.util.js +259 -0
  219. package/dist/utility/wrun/wrun-chart-context-names.util.d.ts +84 -0
  220. package/dist/utility/wrun/wrun-chart-context-names.util.js +186 -0
  221. package/dist/utility/wrun/wrun-chart-market-facts.util.d.ts +253 -0
  222. package/dist/utility/wrun/wrun-chart-market-facts.util.js +731 -0
  223. package/dist/utility/wrun/wrun-cloud-opra-stamp.util.d.ts +28 -0
  224. package/dist/utility/wrun/wrun-cloud-opra-stamp.util.js +45 -0
  225. package/dist/utility/wrun/wrun-coin-lane-live.util.d.ts +18 -0
  226. package/dist/utility/wrun/wrun-coin-lane-live.util.js +47 -0
  227. package/dist/utility/wrun/wrun-deadline.util.js +2 -1
  228. package/dist/utility/wrun/wrun-debug-output.util.d.ts +39 -0
  229. package/dist/utility/wrun/wrun-debug-output.util.js +63 -0
  230. package/dist/utility/wrun/wrun-declared-warmup.util.d.ts +113 -0
  231. package/dist/utility/wrun/wrun-declared-warmup.util.js +181 -0
  232. package/dist/utility/wrun/wrun-draft-legend-note.util.d.ts +43 -0
  233. package/dist/utility/wrun/wrun-draft-legend-note.util.js +158 -0
  234. package/dist/utility/wrun/wrun-draft-overlay.util.d.ts +181 -0
  235. package/dist/utility/wrun/wrun-draft-overlay.util.js +357 -0
  236. package/dist/utility/wrun/wrun-draw-skipped.leaf.d.ts +16 -0
  237. package/dist/utility/wrun/wrun-draw-skipped.leaf.js +16 -0
  238. package/dist/utility/wrun/wrun-earnings-facts.util.d.ts +42 -0
  239. package/dist/utility/wrun/wrun-earnings-facts.util.js +131 -0
  240. package/dist/utility/wrun/wrun-first-run-depth.util.d.ts +32 -0
  241. package/dist/utility/wrun/wrun-first-run-depth.util.js +118 -0
  242. package/dist/utility/wrun/wrun-gate-plane-readers.util.d.ts +24 -0
  243. package/dist/utility/wrun/wrun-gate-plane-readers.util.js +31 -0
  244. package/dist/utility/wrun/wrun-held-lanes.util.d.ts +32 -0
  245. package/dist/utility/wrun/wrun-held-lanes.util.js +94 -0
  246. package/dist/utility/wrun/wrun-host-visible-clock.util.d.ts +2 -0
  247. package/dist/utility/wrun/wrun-host-visible-clock.util.js +17 -0
  248. package/dist/utility/wrun/wrun-host.service.d.ts +266 -0
  249. package/dist/utility/wrun/wrun-host.service.js +655 -0
  250. package/dist/utility/wrun/wrun-inert-legend.util.d.ts +33 -0
  251. package/dist/utility/wrun/wrun-inert-legend.util.js +125 -0
  252. package/dist/utility/wrun/wrun-input-requirements.leaf.d.ts +155 -0
  253. package/dist/utility/wrun/wrun-input-requirements.leaf.js +450 -0
  254. package/dist/utility/wrun/wrun-integration-route.util.d.ts +51 -0
  255. package/dist/utility/wrun/wrun-integration-route.util.js +59 -0
  256. package/dist/utility/wrun/wrun-latest-history.leaf.d.ts +8 -0
  257. package/dist/utility/wrun/wrun-latest-history.leaf.js +8 -0
  258. package/dist/utility/wrun/wrun-legend-hover.lazy.d.ts +12 -0
  259. package/dist/utility/wrun/wrun-legend-hover.lazy.js +96 -0
  260. package/dist/utility/wrun/wrun-lifecycle-runtime.util.d.ts +21 -0
  261. package/dist/utility/wrun/wrun-lifecycle-runtime.util.js +21 -0
  262. package/dist/utility/wrun/wrun-live-hidden-hold.util.d.ts +23 -0
  263. package/dist/utility/wrun/wrun-live-hidden-hold.util.js +13 -0
  264. package/dist/utility/wrun/wrun-live-intake.util.d.ts +374 -0
  265. package/dist/utility/wrun/wrun-live-intake.util.js +2027 -0
  266. package/dist/utility/wrun/wrun-live-patch.util.d.ts +116 -0
  267. package/dist/utility/wrun/wrun-live-patch.util.js +523 -0
  268. package/dist/utility/wrun/wrun-live-tick.util.d.ts +619 -0
  269. package/dist/utility/wrun/wrun-live-tick.util.js +4974 -0
  270. package/dist/utility/wrun/wrun-loading-owner.util.d.ts +58 -0
  271. package/dist/utility/wrun/wrun-loading-owner.util.js +89 -0
  272. package/dist/utility/wrun/wrun-official-scope.leaf.d.ts +29 -0
  273. package/dist/utility/wrun/wrun-official-scope.leaf.js +36 -0
  274. package/dist/utility/wrun/wrun-oi-lane.util.d.ts +27 -0
  275. package/dist/utility/wrun/wrun-oi-lane.util.js +42 -0
  276. package/dist/utility/wrun/wrun-opra-stats.leaf.d.ts +29 -10
  277. package/dist/utility/wrun/wrun-opra-stats.leaf.js +29 -10
  278. package/dist/utility/wrun/wrun-options-stop.util.d.ts +52 -0
  279. package/dist/utility/wrun/wrun-options-stop.util.js +123 -0
  280. package/dist/utility/wrun/wrun-overlay-drivers.util.d.ts +719 -0
  281. package/dist/utility/wrun/wrun-overlay-drivers.util.js +1180 -0
  282. package/dist/utility/wrun/wrun-overlay-lifecycle.lazy.d.ts +50 -0
  283. package/dist/utility/wrun/wrun-overlay-lifecycle.lazy.js +131 -0
  284. package/dist/utility/wrun/wrun-overlay-lifecycle.util.d.ts +118 -0
  285. package/dist/utility/wrun/wrun-overlay-lifecycle.util.js +466 -0
  286. package/dist/utility/wrun/wrun-overlay-metadata.util.d.ts +45 -0
  287. package/dist/utility/wrun/wrun-overlay-metadata.util.js +112 -0
  288. package/dist/utility/wrun/wrun-overlay-recovery.util.d.ts +114 -0
  289. package/dist/utility/wrun/wrun-overlay-recovery.util.js +971 -0
  290. package/dist/utility/wrun/wrun-overlay-run.util.d.ts +858 -0
  291. package/dist/utility/wrun/wrun-overlay-run.util.js +11013 -0
  292. package/dist/utility/wrun/wrun-panel-mount.lazy.d.ts +10 -0
  293. package/dist/utility/wrun/wrun-panel-mount.lazy.js +68 -0
  294. package/dist/utility/wrun/wrun-panel-mount.util.d.ts +392 -0
  295. package/dist/utility/wrun/wrun-panel-mount.util.js +2346 -0
  296. package/dist/utility/wrun/wrun-param-map.util.d.ts +19 -4
  297. package/dist/utility/wrun/wrun-param-map.util.js +40 -47
  298. package/dist/utility/wrun/wrun-param-values.util.d.ts +9 -3
  299. package/dist/utility/wrun/wrun-param-values.util.js +5 -5
  300. package/dist/utility/wrun/wrun-pause-dim.util.d.ts +52 -0
  301. package/dist/utility/wrun/wrun-pause-dim.util.js +153 -0
  302. package/dist/utility/wrun/wrun-plot-gate.types.d.ts +23 -0
  303. package/dist/utility/wrun/wrun-plot-gate.types.js +7 -0
  304. package/dist/utility/wrun/wrun-prefix-cohort.util.d.ts +93 -0
  305. package/dist/utility/wrun/wrun-prefix-cohort.util.js +484 -0
  306. package/dist/utility/wrun/wrun-prefix-lanes.util.d.ts +114 -0
  307. package/dist/utility/wrun/wrun-prefix-lanes.util.js +486 -0
  308. package/dist/utility/wrun/wrun-prefix-proof.util.d.ts +317 -0
  309. package/dist/utility/wrun/wrun-prefix-proof.util.js +630 -0
  310. package/dist/utility/wrun/wrun-refusal-surface.util.d.ts +73 -0
  311. package/dist/utility/wrun/wrun-refusal-surface.util.js +380 -0
  312. package/dist/utility/wrun/wrun-refusal-text.util.d.ts +15 -0
  313. package/dist/utility/wrun/wrun-refusal-text.util.js +40 -0
  314. package/dist/utility/wrun/wrun-replay-lane.util.d.ts +139 -0
  315. package/dist/utility/wrun/wrun-replay-lane.util.js +520 -0
  316. package/dist/utility/wrun/wrun-replay-rows.util.d.ts +21 -0
  317. package/dist/utility/wrun/wrun-replay-rows.util.js +172 -0
  318. package/dist/utility/wrun/wrun-row-source-factory.d.ts +53 -0
  319. package/dist/utility/wrun/wrun-row-source-factory.js +435 -0
  320. package/dist/utility/wrun/wrun-run-cells.util.d.ts +36 -0
  321. package/dist/utility/wrun/wrun-run-cells.util.js +46 -0
  322. package/dist/utility/wrun/wrun-run-interval-projection.types.d.ts +14 -0
  323. package/dist/utility/wrun/wrun-run-interval-projection.types.js +1 -0
  324. package/dist/utility/wrun/wrun-run-interval-session.util.d.ts +133 -0
  325. package/dist/utility/wrun/wrun-run-interval-session.util.js +121 -0
  326. package/dist/utility/wrun/wrun-run-interval.util.d.ts +98 -0
  327. package/dist/utility/wrun/wrun-run-interval.util.js +207 -0
  328. package/dist/utility/wrun/wrun-run-retained.util.d.ts +122 -0
  329. package/dist/utility/wrun/wrun-run-retained.util.js +255 -0
  330. package/dist/utility/wrun/wrun-sandbox-row-source.d.ts +184 -0
  331. package/dist/utility/wrun/wrun-sandbox-row-source.js +444 -0
  332. package/dist/utility/wrun/wrun-script-inputs.util.js +4 -4
  333. package/dist/utility/wrun/wrun-series-stream.util.d.ts +86 -0
  334. package/dist/utility/wrun/wrun-series-stream.util.js +537 -0
  335. package/dist/utility/wrun/wrun-sheet-remembered.util.d.ts +21 -0
  336. package/dist/utility/wrun/wrun-sheet-remembered.util.js +36 -0
  337. package/dist/utility/wrun/wrun-signal-sound-reasons.leaf.d.ts +7 -0
  338. package/dist/utility/wrun/wrun-signal-sound-reasons.leaf.js +12 -0
  339. package/dist/utility/wrun/wrun-socket-row-source.js +4 -2
  340. package/dist/utility/wrun/wrun-source-rows.util.d.ts +175 -3
  341. package/dist/utility/wrun/wrun-source-rows.util.js +294 -8
  342. package/dist/utility/wrun/wrun-stats-strip.util.d.ts +46 -0
  343. package/dist/utility/wrun/wrun-stats-strip.util.js +87 -0
  344. package/dist/utility/wrun/wrun-table-chrome.util.d.ts +163 -0
  345. package/dist/utility/wrun/wrun-table-chrome.util.js +557 -0
  346. package/dist/utility/wrun/wrun-text-params.util.d.ts +11 -6
  347. package/dist/utility/wrun/wrun-text-params.util.js +19 -30
  348. package/dist/utility/wrun/wrun-transient-rerun.util.d.ts +64 -0
  349. package/dist/utility/wrun/wrun-transient-rerun.util.js +317 -0
  350. package/dist/utility/wrun/wrun-twin-lookback.util.d.ts +10 -0
  351. package/dist/utility/wrun/wrun-twin-lookback.util.js +43 -0
  352. package/dist/utility/wrun/wrun-warmup-head-store.util.d.ts +41 -0
  353. package/dist/utility/wrun/wrun-warmup-head-store.util.js +120 -0
  354. package/dist/utility/wrun-alert-params.leaf.d.ts +24 -0
  355. package/dist/utility/wrun-alert-params.leaf.js +24 -0
  356. package/dist/utils/replay/replay-buffer-math.d.ts +148 -0
  357. package/dist/utils/replay/replay-buffer-math.js +684 -0
  358. package/dist/workers/wrun/wrun-abi-host.d.ts +190 -0
  359. package/dist/workers/wrun/wrun-abi-host.js +1201 -0
  360. package/dist/workers/wrun/wrun-engine-handler.d.ts +37 -0
  361. package/dist/workers/wrun/wrun-engine-handler.js +211 -0
  362. package/package.json +3 -3
package/README.md CHANGED
@@ -10,7 +10,7 @@ Peers, pinned exactly (install them beside the package):
10
10
 
11
11
  | Peer | Version | Why |
12
12
  | --- | --- | --- |
13
- | `@orangecharts/indicator-kit` | 0.86.3 | the shared host's types (`@orangecharts/indicator-kit/host`); the host module itself comes through the env |
13
+ | `@orangecharts/indicator-kit` | 0.87.0 | the shared host's types (`@orangecharts/indicator-kit/host`); the host module itself comes through the env |
14
14
  | `@orangecharts/orange-v2-pb-common` | 12.69.0 | the protocol enums the lanes, pins and venue rules read (`Exchange`, `Type`, `Category`), from 0.3.0 |
15
15
  | `dayjs` | 1.11.23 | sessions and trading days (the `utc`, `timezone`, `isoWeek` and `quarterOfYear` plugins) |
16
16
  | `lodash-es` | 4.18.1 | the color settings and the transforms, by per-function subpath |
@@ -25,7 +25,13 @@ import { WRUN_FRAME_MAX_SLOTS } from '@orangecharts/wrun-chart-host/utility/wrun
25
25
  At 0.3.0, 26 modules are reachable by subpath only (an export name of theirs resolves to another declaration in the
26
26
  entry): the lane files (each exports `lane`, `lanes` or `rowLane`), `utility/chart/om-widget.util`,
27
27
  `utility/wrun/wrun-frames`, `utility/wrun/wrun-pane-format.util` and `utility/wrun/wrun-style-words.util` among them.
28
- `src/index.ts` names the modules it joins.
28
+ At 0.4.0, 27: the panel mount `utility/wrun/wrun-panel-mount.util` joins them (its `retranslateWrunChildOverlays` and
29
+ `cutWrunBatchedChildRecords` are its door's names too; the entry serves the door's). At 0.5.0, 33: the lifecycle door
30
+ `utility/wrun/wrun-overlay-lifecycle.lazy`, the run pass `utility/wrun/wrun-overlay-run.util`, `replay/replayLadder`,
31
+ `utility/market-events/market-events.util` and `utility/wrun/wrun-overlay-identity.util` join them. The entry served
32
+ the last one at 0.4.0: from 0.5.0 its `isWrunDraftOverlaySettings` is the draft overlay module's (a draft ref, or a
33
+ draft script id without a package ref), so import the identity module's names by its subpath. `src/index.ts` names
34
+ the modules it joins.
29
35
 
30
36
  ## The host env (ports)
31
37
 
@@ -54,13 +60,22 @@ setWrunChartHostEnv({
54
60
  | `loadSharedHost()` | the hosted wire reader | the kit's host module, loaded once (a failed load is not cached) |
55
61
  | `sharedHost()` | the pack, frames, box segments, render select, the run result's strategy bytes | the loaded host module; before the load it throws `wrunChartHostUnloadedError()` (`wrun_chart_host_unloaded`) |
56
62
  | `diagnostics.publishCapNotice(batch)` | the cells cap notice | write each `batch.take()` notice as the Indicator's "Cells capped" row when ready, or `batch.drop()` |
57
- | `t`, `te` | reserved | a user-facing string by its locale key, and whether the key exists |
63
+ | `t`, `te` | the panel mount's legend words (`t`, from 0.4.0) | a user-facing string by its locale key, and whether the key exists |
58
64
  | `poolDexName(exchange, symbol)` | reserved | the pool's DEX name, if any |
59
- | `diagnostics.debug`, `diagnostics.publishCanvasCostNotice` | reserved | the debug ring; the canvas cost row |
65
+ | `diagnostics.debug` | the panel mount and its door (from 0.4.0) | the debug ring |
66
+ | `diagnostics.publishCanvasCostNotice` | reserved | the canvas cost row |
60
67
 
61
68
  0.3.0 adds the phase 1 contract: six namespaces (`chart`, `user`, `market`, `transport`, `run`, `clock`) and three
62
- `diagnostics` members, 42 in all, 22 of them read by 0.3.0 modules; a member a host has not adopted yet may throw by
63
- name. Their payload types and loader views are `host-ports.types`. The guide lists every member, what reads it and
69
+ `diagnostics` members, 42 in all, 22 of them read by 0.3.0 modules; 0.4.0's panel mount reads the 12 reserved until
70
+ 0.4.0 (the chart group and paint, the titan adapter's three, the paused paint, the packs, the plot gate notice, the
71
+ theme name, the display timezone and the door's `chart.loadPanelMountPorts`); a member a host has not adopted yet may
72
+ throw by name. 0.5.0 adds the phase 2 contract: 84 members and the `ui` and `engine` namespaces, which the live
73
+ session, the drivers, the engine and the executor read, and two optional members: `clock.watchHostSuspended` (a host
74
+ that parks its chart while the page stays visible reports it, and the package's visible deadlines pause) and
75
+ `chart.commonStore` (the go-to-date history flag the live tick reads in the caller's turn; without it every chart reads
76
+ as live). It retires
77
+ the three `run` loaders: they are optional at 0.5.0 (the package loads the lifecycle door, the refusal surface and the
78
+ series stream itself) and go at 0.6.0. Their payload types and loader views are `host-ports.types`. The guide lists every member, what reads it and
64
79
  what web binds it.
65
80
 
66
81
  A read before the set throws `wrun_chart_host_env_unset`. The env lives on the realm's global object under
@@ -84,6 +99,8 @@ What each published version holds. A host installs a version with the peers of i
84
99
 
85
100
  | Version | Peers | What changed |
86
101
  | --- | --- | --- |
102
+ | 0.5.0 | `@orangecharts/indicator-kit` 0.87.0, `@orangecharts/orange-v2-pb-common` 12.69.0, `dayjs` 1.11.23, `lodash-es` 4.18.1 | Phase 2: the live session (the live tick, intake, hidden-tab hold, coin lane live channels, series stream), the drivers and the heal ladder (the lifecycle door, `utility/wrun/wrun-overlay-lifecycle.lazy` by subpath, its runtime and the recovery ladders), the prefix runs, the engine (`workers/wrun/wrun-abi-host`, `workers/wrun/wrun-engine-handler`, the browser host), the host facts and the executor (`utility/wrun/wrun-overlay-run.util`, by subpath) with its row sources: 135 modules, 398 in all. The env gains the 84 phase 2 members, the `ui` and `engine` namespaces and the optional `clock.watchHostSuspended` and `chart.commonStore`; the three `run` loaders turn optional (gone at 0.6.0). The panel mount reads a host's planned pane heights on every cell and retranslates an unchanged child in place, keeping a reader's expanded pane through a retire. The entry no longer serves `utility/wrun/wrun-overlay-identity.util` (by subpath; above). The kit peer moves from 0.86.3 to 0.87.0 (`option_multiplier`); the other peers are unchanged. |
103
+ | 0.4.0 | `@orangecharts/indicator-kit` 0.86.3, `@orangecharts/orange-v2-pb-common` 12.69.0, `dayjs` 1.11.23, `lodash-es` 4.18.1 | Phase 1b: the panel mount (`utility/wrun/wrun-panel-mount.util`, by subpath) and its door (`utility/wrun/wrun-panel-mount.lazy`), the run interval rules (`utility/chart/indicator-run-interval.util`) with the builtin script snippets they type against, the pause dim and six leaves (the window owner and window geometry rules, the date-labelled interval rule, the HTML escape, the run interval projection and plot gate types): 11 modules, 262 in all. The mount reads the host through the env: the 12 members reserved until 0.4.0, `t` and `diagnostics.debug`. Peers unchanged. |
87
104
  | 0.3.0 | `@orangecharts/indicator-kit` 0.86.3, `@orangecharts/orange-v2-pb-common` 12.69.0, `dayjs` 1.11.23, `lodash-es` 4.18.1 | Three programs ship together. The settings templates: the nested entry `@orangecharts/wrun-chart-host/settings-templates`, one declared settings schema for every template (`TEMPLATE_SCHEMA_VERSION` 2). The phase 1 host contract: 42 env members (`host-env`) with their payload types and loader views (`host-ports.types`), 22 read by 0.3.0 modules, the rest reserved. Phase 1a's move: the lane layer (both lane registries, read through generated indexes, the lane files and planners), the row builder, legs and pins, the cloud row source and the main-grid stages, with what they read: 142 modules, 250 in all. The kit peer moves from 0.80.0 to 0.86.3 (leg streams and per-span levels) and the protocol enums package joins the peers. |
88
105
  | 0.2.0 | `@orangecharts/indicator-kit` 0.80.0, `dayjs` 1.11.23, `lodash-es` 4.18.1 | The kit peer moves from 0.78.1 to 0.80.0. Three modules join, 101 in all: `utility/wrun/wrun-symbol-code.util` (the symbol codec of the options source classes), `utility/wrun/wrun-row-market.util` (the market a table row or feed line is about) and `utility/wrun/wrun-failure-cause` (why a run failed, as one closed word). The 12 package commits since 0.1.0, listed below. Lodash by subpath: the color settings import `lodash-es/isEqual`, never the `lodash-es` root, so a bundler that does not shake trees keeps one lodash module, not the library (`tests/packages/wrun-chart-host/lodash-subpath.spec.ts` refuses a root import in the package). |
89
106
  | 0.1.0 | `@orangecharts/indicator-kit` 0.78.1, `dayjs` 1.11.23, `lodash-es` 4.18.1 | The first cut, packed from web 89fadab981: 98 modules, the wrun result reader and painter model with the host env. |
@@ -0,0 +1,8 @@
1
+ /**
2
+ * A venue's short display name (a leaf of constants/exchangeConstants.constants.ts; P2/inventory.md section 1.1):
3
+ * `formatEnhancedExchangeName`, the name the chart header writes for a prediction market (HYPERLIQUID_HIP4 reads
4
+ * "HL HIP4") and the venue pickers group by. The old module also loads the venue icons (bundler assets), the legend
5
+ * tooltip and the HTML escaper, which keep it out of the chart-host package; this leaf imports nothing and moves
6
+ * with the phase 2 closure. The old module imports it back and re-exports it.
7
+ */
8
+ export declare function formatEnhancedExchangeName(exchange: string): string;
@@ -0,0 +1,101 @@
1
+ /**
2
+ * A venue's short display name (a leaf of constants/exchangeConstants.constants.ts; P2/inventory.md section 1.1):
3
+ * `formatEnhancedExchangeName`, the name the chart header writes for a prediction market (HYPERLIQUID_HIP4 reads
4
+ * "HL HIP4") and the venue pickers group by. The old module also loads the venue icons (bundler assets), the legend
5
+ * tooltip and the HTML escaper, which keep it out of the chart-host package; this leaf imports nothing and moves
6
+ * with the phase 2 closure. The old module imports it back and re-exports it.
7
+ */
8
+ export function formatEnhancedExchangeName(exchange) {
9
+ if (exchange.toUpperCase() === 'SOLANA_ONCHAIN')
10
+ return 'Solana';
11
+ // The options feed's name is an acronym (Options Price Reporting Authority), never "Opra".
12
+ if (exchange.toUpperCase() === 'OPRA')
13
+ return 'OPRA';
14
+ // HIP3 exchange mapping
15
+ if (exchange.toLowerCase() === 'hyperliquid_hip3') {
16
+ return 'HL HIP3';
17
+ }
18
+ if (exchange.toLowerCase() === 'hyperliquid_hip4') {
19
+ return 'HL HIP4';
20
+ }
21
+ // Forex/Commodity exchange mappings
22
+ if (exchange.toLowerCase() === 'fx_otc') {
23
+ return 'FX OTC';
24
+ }
25
+ if (exchange.toLowerCase() === 'platts') {
26
+ return 'Platts';
27
+ }
28
+ if (exchange.toLowerCase().includes('okex')) {
29
+ exchange = exchange.toLowerCase().replace('okex', 'okx');
30
+ }
31
+ if (exchange.toLowerCase() === 'okx_swap' || exchange.toLowerCase() === 'okx_futures') {
32
+ return 'OKX Futs';
33
+ }
34
+ if (exchange.toLowerCase().includes('okx') && !exchange.toLowerCase().includes('opt')) {
35
+ const parts = exchange.split('_');
36
+ for (let i = 0; i < parts.length; i++) {
37
+ if (parts[i].toLowerCase() === 'okx') {
38
+ parts[i] = 'OKX';
39
+ }
40
+ }
41
+ exchange = parts.join('_');
42
+ }
43
+ if (exchange.toLowerCase() === 'gate_io') {
44
+ return 'Gate.io';
45
+ }
46
+ if (exchange.toLowerCase().includes('gate') &&
47
+ exchange.toLowerCase().includes('io') &&
48
+ (exchange.toLowerCase().includes('futures') || exchange.toLowerCase().includes('futs'))) {
49
+ return 'Gate.io Futs';
50
+ }
51
+ if (exchange.toLowerCase() === 'bybit' || exchange.toLowerCase().includes('bybit_')) {
52
+ if (exchange.toLowerCase() === 'bybit') {
53
+ return 'Bybit Futs';
54
+ }
55
+ else if (exchange.toLowerCase() === 'bybit_spot') {
56
+ return 'Bybit';
57
+ }
58
+ }
59
+ if (exchange.toLowerCase() === 'bitfinex_derivatives' || exchange.toLowerCase() === 'bitfinex_der') {
60
+ return 'Bitfinex Futs';
61
+ }
62
+ if (exchange.toLowerCase() === 'bitmex') {
63
+ return 'Bitmex Futs';
64
+ }
65
+ if (exchange.toLowerCase() === 'deribit') {
66
+ return 'Deribit Futs';
67
+ }
68
+ const formattedName = exchange
69
+ .split('_')
70
+ .map((word) => {
71
+ if (word.toLowerCase() === 'futures') {
72
+ return 'Futs';
73
+ }
74
+ if (word.toLowerCase() === 'derivatives') {
75
+ return 'Der';
76
+ }
77
+ if (word.toLowerCase() === 'options') {
78
+ return 'Opts';
79
+ }
80
+ if (word.toLowerCase() === 'okx') {
81
+ return 'OKX';
82
+ }
83
+ if (word.toLowerCase() === 'gate' && exchange.toLowerCase().includes('io')) {
84
+ return 'Gate';
85
+ }
86
+ if (word.toLowerCase() === 'io' && exchange.toLowerCase().includes('gate')) {
87
+ return '.io';
88
+ }
89
+ return word.charAt(0).toUpperCase() + word.slice(1).toLowerCase();
90
+ })
91
+ .join(' ')
92
+ .trim();
93
+ let result = formattedName.replace('Gate .io', 'Gate.io');
94
+ if (result === 'Gate.io' &&
95
+ (exchange.toLowerCase().includes('futures') ||
96
+ exchange.toLowerCase().includes('futs') ||
97
+ exchange.toLowerCase().includes('swap'))) {
98
+ result = 'Gate.io Futs';
99
+ }
100
+ return result;
101
+ }
@@ -0,0 +1,15 @@
1
+ /**
2
+ * The kScript data sources' interval restrictions (a constants module cut from constants/indicator.constants.ts;
3
+ * P2/inventory.md section 1.1): the rows the chart's fetch gate refuses a kScript data source on, which the wrun
4
+ * executor's tape check reads through `isKScriptDataRestrictedForInterval`
5
+ * (utility/chart/kscript-data-interval-restriction.leaf.ts).
6
+ * Constants only, no imports, so it moves into the chart-host package with the phase 2 closure; the indicator constants
7
+ * import and re-export every name. Each table is a `const` of a read-only type over a literal, never written (the
8
+ * phase 2 leaf-state guard's immutable form).
9
+ */
10
+ export interface IndicatorIntervalRestrictions {
11
+ [interval: string]: string[];
12
+ }
13
+ export declare const ALLOWED_1S_INDICATORS: readonly string[];
14
+ export declare const KSCRIPT_DATA_INTERVAL_RESTRICTIONS: Readonly<IndicatorIntervalRestrictions>;
15
+ export declare const ROLLED_INTERVAL_RESTRICTED_KSCRIPT_DATA: readonly string[];
@@ -0,0 +1,40 @@
1
+ /**
2
+ * The kScript data sources' interval restrictions (a constants module cut from constants/indicator.constants.ts;
3
+ * P2/inventory.md section 1.1): the rows the chart's fetch gate refuses a kScript data source on, which the wrun
4
+ * executor's tape check reads through `isKScriptDataRestrictedForInterval`
5
+ * (utility/chart/kscript-data-interval-restriction.leaf.ts).
6
+ * Constants only, no imports, so it moves into the chart-host package with the phase 2 closure; the indicator constants
7
+ * import and re-export every name. Each table is a `const` of a read-only type over a literal, never written (the
8
+ * phase 2 leaf-state guard's immutable form).
9
+ */
10
+ export const ALLOWED_1S_INDICATORS = [
11
+ 'CUMULATIVE_VOLUME_DELTA',
12
+ // Tape mode's core layer: the 1s book history fetch rides the gateway's
13
+ // per-user 1s entitlement (un-entitled tokens get a silently empty
14
+ // backfill while live columns still paint from the live socket).
15
+ 'ORDERBOOK_HEATMAP',
16
+ 'VOLUME_DELTA',
17
+ 'TECHNICAL_SCRIPT',
18
+ 'VISIBLE_RANGE_VOLUME_PROFILE',
19
+ 'SESSION_VOLUME_PROFILE',
20
+ 'DEVELOPING_SESSION_PROFILE',
21
+ 'DELTA_PROFILE',
22
+ 'VOLUME_FOOTPRINT',
23
+ 'HYPERLIQUID_ADDRESS',
24
+ // Weekly reports on a day aggregation whatever the interval (cftc-cot-request.util).
25
+ 'CFTC_COT_NET_POSITION',
26
+ // Relay rows at their own timestamps on every interval (feed-interval.util).
27
+ 'FEED',
28
+ ];
29
+ export const KSCRIPT_DATA_INTERVAL_RESTRICTIONS = {
30
+ '1m': ['BINANCE_TREASURY_BALANCE', 'ETF_PREMIUM_RATE', 'ETF_FLOW', 'LONG_SHORT_RATIO'],
31
+ '5m': ['BINANCE_TREASURY_BALANCE', 'ETF_PREMIUM_RATE', 'ETF_FLOW'],
32
+ '15m': ['BINANCE_TREASURY_BALANCE', 'ETF_FLOW'],
33
+ '30m': ['BINANCE_TREASURY_BALANCE', 'ETF_FLOW'],
34
+ '1h': ['BINANCE_TREASURY_BALANCE', 'ETF_FLOW'],
35
+ '4h': ['BINANCE_TREASURY_BALANCE', 'ETF_FLOW'],
36
+ '1w': ['ETF_HOLDING', 'ETF_FLOW'],
37
+ };
38
+ // The kScript data twin rides the same ETF_PREMIUM_RATE_AGG request as the native indicator, which the gateway
39
+ // refuses at every rolled preset (indicator.constants.ts `ROLLED_INTERVAL_RESTRICTED_INDICATORS`).
40
+ export const ROLLED_INTERVAL_RESTRICTED_KSCRIPT_DATA = ['ETF_PREMIUM_RATE'];
@@ -0,0 +1,19 @@
1
+ /**
2
+ * OPRA compliance display strings. LEGALLY EXACT, English-only by contract: never localized, never
3
+ * reworded, never "typo-fixed", never duplicated. Each string exists exactly once in the app source
4
+ * (this module); surfaces import it, and a translated sentence that carries it takes it as a
5
+ * parameter, so no locale bundle ever holds it. Byte fidelity is pinned by
6
+ * tests/constants/opra-compliance.constants.spec.ts (SHA-256 + length + a source-wide
7
+ * single-occurrence scan). Any edit here is a legal event: it ships with a refreshed checksum and
8
+ * explicit sign-off, never inside a refactor.
9
+ */
10
+ /**
11
+ * The delay notice. Source: the signed OPRA Vendor Agreement, Exhibit A section 14: the phrase must
12
+ * be conspicuously displayed on every screen that displays delayed OPRA data. Every surface showing
13
+ * OPRA numbers on the delayed tier carries it: the chain page subtitle, the chain's price pill, table
14
+ * marker, strike preview and index notice, the Flow Tape, the Terminal Options tab, the options
15
+ * overlay legends and the browser-run Indicator legend notes (option-venue-disclosure.util), the
16
+ * contract chart's delay chip and its card, the chart footer's source line, the watchlist panel and
17
+ * the watchlist cell tooltip, and the purchase page's live delayed price.
18
+ */
19
+ export declare const OPRA_DELAY_NOTICE = "OPRA data delayed 15 minutes";
@@ -0,0 +1,19 @@
1
+ /**
2
+ * OPRA compliance display strings. LEGALLY EXACT, English-only by contract: never localized, never
3
+ * reworded, never "typo-fixed", never duplicated. Each string exists exactly once in the app source
4
+ * (this module); surfaces import it, and a translated sentence that carries it takes it as a
5
+ * parameter, so no locale bundle ever holds it. Byte fidelity is pinned by
6
+ * tests/constants/opra-compliance.constants.spec.ts (SHA-256 + length + a source-wide
7
+ * single-occurrence scan). Any edit here is a legal event: it ships with a refreshed checksum and
8
+ * explicit sign-off, never inside a refactor.
9
+ */
10
+ /**
11
+ * The delay notice. Source: the signed OPRA Vendor Agreement, Exhibit A section 14: the phrase must
12
+ * be conspicuously displayed on every screen that displays delayed OPRA data. Every surface showing
13
+ * OPRA numbers on the delayed tier carries it: the chain page subtitle, the chain's price pill, table
14
+ * marker, strike preview and index notice, the Flow Tape, the Terminal Options tab, the options
15
+ * overlay legends and the browser-run Indicator legend notes (option-venue-disclosure.util), the
16
+ * contract chart's delay chip and its card, the chart footer's source line, the watchlist panel and
17
+ * the watchlist cell tooltip, and the purchase page's live delayed price.
18
+ */
19
+ export const OPRA_DELAY_NOTICE = 'OPRA data delayed 15 minutes';
@@ -0,0 +1,30 @@
1
+ import type { RailTf, ReplayStepTf } from '../interfaces/replay.interface.js';
2
+ /**
3
+ * Values were live-bisected on 2026-06-12. Re-measure with
4
+ * /tmp/replay-probe/probe-retention.mjs before changing these constants.
5
+ */
6
+ export declare const REPLAY_LADDER_EDGES_SEC: {
7
+ readonly tick: 171000;
8
+ readonly bookAgg: 900000;
9
+ readonly tradeAgg5m: 4500000;
10
+ readonly tradeAgg15m: 13500000;
11
+ readonly tradeAgg1h: 90000000;
12
+ readonly tradeAgg1d: 213900000;
13
+ };
14
+ export declare const RAIL_TFS: readonly ["1m", "5m", "15m", "1h", "1d"];
15
+ export declare const REPLAY_STEP_TFS: readonly ["1m", "5m", "10m", "15m", "30m", "1h", "2h", "3h", "4h", "1d"];
16
+ export declare const RAIL_TF_BUCKET_SEC: Record<RailTf, number>;
17
+ export declare const REPLAY_STEP_TF_BUCKET_SEC: Record<ReplayStepTf, number>;
18
+ export declare const RAIL_TF_EDGE_SEC: Record<RailTf, number>;
19
+ export declare const REPLAY_STEP_TF_EDGE_SEC: Record<ReplayStepTf, number>;
20
+ export declare const RAIL_TF_BOOK_EDGE_SEC: Record<RailTf, number>;
21
+ export declare const REPLAY_STEP_TF_BOOK_EDGE_SEC: Record<ReplayStepTf, number>;
22
+ export declare const REPLAY_FORWARD_BATCH = 1000;
23
+ export declare const REPLAY_PREFETCH_BARS = 200;
24
+ export declare const REPLAY_COARSE_FORWARD_BATCH: number;
25
+ export declare const HISTORY_BARS = 300;
26
+ export declare const REPLAY_FOLLOW_RIGHT_OFFSET_FRACTION = 0.5;
27
+ export declare const CANDLE_TICK_BACKFILL_SEC = 300;
28
+ export declare const FALLBACK_VIEW_BEHIND_MS: number;
29
+ export declare const MONDAY_BUCKET_ORIGIN_MS: number;
30
+ export declare const FOLLOW_SPAN_ECHO_TOLERANCE_BARS = 1.5;
@@ -0,0 +1,99 @@
1
+ /**
2
+ * The replay ladder constants (a leaf of constants/replay.constants.ts): the measured retention edges, the rail and
3
+ * step bucket and edge maps, and the forward-batch, history and follow numbers that the replay buffer math and the
4
+ * fidelity ladder read. Constants only, over the interval table and the replay types, so it moves into the chart-host
5
+ * package with the phase 2 closure (the executor reaches both readers): the old module imports
6
+ * `@orangecharts/chart-schema`, which is no peer of the package. The old module imports and re-exports every name.
7
+ */
8
+ import { Intervals } from './interval.constants.js';
9
+ const DAY_MS = Intervals.DAY;
10
+ /**
11
+ * Values were live-bisected on 2026-06-12. Re-measure with
12
+ * /tmp/replay-probe/probe-retention.mjs before changing these constants.
13
+ */
14
+ export const REPLAY_LADDER_EDGES_SEC = {
15
+ tick: 171_000,
16
+ bookAgg: 900_000,
17
+ tradeAgg5m: 4_500_000,
18
+ tradeAgg15m: 13_500_000,
19
+ tradeAgg1h: 90_000_000,
20
+ tradeAgg1d: 213_900_000,
21
+ };
22
+ export const RAIL_TFS = ['1m', '5m', '15m', '1h', '1d'];
23
+ export const REPLAY_STEP_TFS = [
24
+ '1m',
25
+ '5m',
26
+ '10m',
27
+ '15m',
28
+ '30m',
29
+ '1h',
30
+ '2h',
31
+ '3h',
32
+ '4h',
33
+ '1d',
34
+ ];
35
+ export const RAIL_TF_BUCKET_SEC = {
36
+ '1m': Intervals.MINUTE / Intervals.SECOND,
37
+ '5m': Intervals.MINUTE5 / Intervals.SECOND,
38
+ '15m': Intervals.MINUTE15 / Intervals.SECOND,
39
+ '1h': Intervals.HOUR / Intervals.SECOND,
40
+ '1d': Intervals.DAY / Intervals.SECOND,
41
+ };
42
+ export const REPLAY_STEP_TF_BUCKET_SEC = {
43
+ ...RAIL_TF_BUCKET_SEC,
44
+ '10m': (10 * Intervals.MINUTE) / Intervals.SECOND,
45
+ '30m': Intervals.MINUTE30 / Intervals.SECOND,
46
+ '2h': (2 * Intervals.HOUR) / Intervals.SECOND,
47
+ '3h': (3 * Intervals.HOUR) / Intervals.SECOND,
48
+ '4h': Intervals.HOUR4 / Intervals.SECOND,
49
+ };
50
+ export const RAIL_TF_EDGE_SEC = {
51
+ '1m': REPLAY_LADDER_EDGES_SEC.bookAgg,
52
+ '5m': REPLAY_LADDER_EDGES_SEC.tradeAgg5m,
53
+ '15m': REPLAY_LADDER_EDGES_SEC.tradeAgg15m,
54
+ '1h': REPLAY_LADDER_EDGES_SEC.tradeAgg1h,
55
+ '1d': REPLAY_LADDER_EDGES_SEC.tradeAgg1d,
56
+ };
57
+ // A step reaches only as deep as the rail its bars are built from. The gateway
58
+ // builds 30m bars from its 15m data, so 30m (candles and book) runs out with
59
+ // 15m, not with 1h (2026-10-07: a 30m Auto step on a January 1h chart had zero
60
+ // rows and the session could neither step nor play).
61
+ export const REPLAY_STEP_TF_EDGE_SEC = {
62
+ ...RAIL_TF_EDGE_SEC,
63
+ '10m': RAIL_TF_EDGE_SEC['5m'],
64
+ '30m': RAIL_TF_EDGE_SEC['15m'],
65
+ '2h': RAIL_TF_EDGE_SEC['1h'],
66
+ '3h': RAIL_TF_EDGE_SEC['1h'],
67
+ '4h': RAIL_TF_EDGE_SEC['1h'],
68
+ };
69
+ export const RAIL_TF_BOOK_EDGE_SEC = {
70
+ '1m': 900_000,
71
+ '5m': 4_500_000,
72
+ '15m': 13_400_000,
73
+ '1h': 90_000_000,
74
+ '1d': 207_446_400,
75
+ };
76
+ export const REPLAY_STEP_TF_BOOK_EDGE_SEC = {
77
+ ...RAIL_TF_BOOK_EDGE_SEC,
78
+ '10m': RAIL_TF_BOOK_EDGE_SEC['5m'],
79
+ '30m': RAIL_TF_BOOK_EDGE_SEC['15m'],
80
+ '2h': RAIL_TF_BOOK_EDGE_SEC['1h'],
81
+ '3h': RAIL_TF_BOOK_EDGE_SEC['1h'],
82
+ '4h': RAIL_TF_BOOK_EDGE_SEC['1h'],
83
+ };
84
+ export const REPLAY_FORWARD_BATCH = 1000;
85
+ export const REPLAY_PREFETCH_BARS = 200;
86
+ export const REPLAY_COARSE_FORWARD_BATCH = REPLAY_PREFETCH_BARS + 50;
87
+ export const HISTORY_BARS = 300;
88
+ // Fraction of the visible span kept AHEAD of the playhead while Follow frames the
89
+ // chart. 0.5 centers the forming candle so the action plays out mid-screen instead
90
+ // of hugging the price axis. Replay-only: live charts keep their own right offset.
91
+ export const REPLAY_FOLLOW_RIGHT_OFFSET_FRACTION = 0.5;
92
+ export const CANDLE_TICK_BACKFILL_SEC = 300; // 5 min of 1s candles before the anchor (forming context)
93
+ export const FALLBACK_VIEW_BEHIND_MS = HISTORY_BARS * Intervals.MINUTE;
94
+ export const MONDAY_BUCKET_ORIGIN_MS = -3 * DAY_MS;
95
+ // User-zoom detection slack, in chart-interval bars: a viewport span within
96
+ // this distance of the follow window replay itself applied is that window's
97
+ // echo (engine clamping and camera glides wobble the echo by up to a bar),
98
+ // not a user zoom. Real wheel zooms move the span by many bars per notch.
99
+ export const FOLLOW_SPAN_ECHO_TOLERANCE_BARS = 1.5;
@@ -0,0 +1,133 @@
1
+ /**
2
+ * kScript snippet helpers shared by every built-in template: the classic input set (source,
3
+ * timeframe, waitForClose), the candle and price series they read, the colour slot reader and the
4
+ * oscillator level / smoothing blocks. `technicalIndicatorScripts.constants.ts` (the classic
5
+ * built-ins) and `staples/*.constants.ts` (the TradingView staples) assemble their templates from
6
+ * these, so every built-in reads its inputs, candles and levels the same way. This module is
7
+ * i18n-free on purpose: the staple modules import it while the catalog module imports them, and a
8
+ * template module must never import the catalog.
9
+ */
10
+ /** A built-in's compute input values as an alert bakes them: the overlay's value, else the template default. */
11
+ export interface BuiltinInputReader {
12
+ num(name: string): number;
13
+ str(name: string): string;
14
+ }
15
+ /** Shape of a `BUILTIN_ALERT_CONTRACTS` entry (see the catalog module for the contract rules). */
16
+ export interface BuiltinAlertContract {
17
+ /**
18
+ * Rule-addressable output labels in DECLARATION ORDER, measured against the real alerts
19
+ * engine (compile + plot-series extraction). These are the identity anchors the server
20
+ * re-anchors rules to: they must match the engine's labels VERBATIM (including the
21
+ * double-space in 'Lower Band'), never a display guess.
22
+ */
23
+ outputs: readonly string[];
24
+ /**
25
+ * Input names that change the COMPUTED series (feed the math). Only these bake into the
26
+ * armable source: renderer-only inputs (colors, width, smooth) must not alter the alert's
27
+ * identity, or a cosmetic edit would orphan the armed badge and duplicate alerts on re-arm.
28
+ */
29
+ computeInputs: readonly string[];
30
+ /**
31
+ * Templates with a `timeframe` input: the CLOSED selected-timeframe bars the slowest output needs
32
+ * before it has a value, from the compute inputs. The alert engine keeps a fixed window of chart
33
+ * bars and recomputes it from scratch on every bar, so an alert on a selected timeframe declares
34
+ * this depth when it is baked (bakeBuiltinAlertSource); the parity specs pin each formula.
35
+ */
36
+ htfWarmup?: (inputs: BuiltinInputReader) => number;
37
+ }
38
+ /** Extra closed bars the oscillator smoothing (OSCILLATOR_SMOOTHING_INPUTS) adds to its oscillator's warm-up. */
39
+ export declare function oscillatorSmoothingWarmup(inputs: BuiltinInputReader): number;
40
+ export declare const CLASSIC_TIMEFRAME_INPUTS = "var timeframe = input(name=\"timeframe\", type=\"select\", defaultValue=\"chart\", options=[\"chart\", \"5m\", \"15m\", \"30m\", \"1h\", \"4h\", \"1D\", \"1W\"]);\nvar waitForClose = input(name=\"waitForClose\", type=\"boolean\", defaultValue=true);";
41
+ export declare const CLASSIC_PRICE_INPUTS = "var source = input(name=\"source\", type=\"select\", defaultValue=\"close\", options=[\"close\", \"open\", \"high\", \"low\"]);\nvar timeframe = input(name=\"timeframe\", type=\"select\", defaultValue=\"chart\", options=[\"chart\", \"5m\", \"15m\", \"30m\", \"1h\", \"4h\", \"1D\", \"1W\"]);\nvar waitForClose = input(name=\"waitForClose\", type=\"boolean\", defaultValue=true);";
42
+ export declare const CLASSIC_PRICE_SERIES = "timeseries data = ohlcv(symbol=currentSymbol, exchange=currentExchange);\ntimeseries price = timeframe == \"chart\" ? field(ohlcv(symbol=currentSymbol, exchange=currentExchange), source) : htf(field(ohlcv(symbol=currentSymbol, exchange=currentExchange), source), timeframe, {mode: waitForClose ? \"confirmed\" : \"developing\"});";
43
+ export declare const CLASSIC_CANDLE_ROW = "func candleValues(bars) {\n return [bars.open, bars.high, bars.low, bars.close, bars.volume];\n}";
44
+ export declare const CLASSIC_CANDLE_SERIES = "func candleValues(bars) {\n return [bars.open, bars.high, bars.low, bars.close, bars.volume];\n}\ntimeseries chartData = ohlcv(symbol=currentSymbol, exchange=currentExchange);\ntimeseries data = timeframe == \"chart\" ? [chartData.open, chartData.high, chartData.low, chartData.close, chartData.volume] : candleValues(htf(chartData, timeframe, {mode: waitForClose ? \"confirmed\" : \"developing\"}));";
45
+ export declare const CLASSIC_SELECTED_CANDLES = "timeseries data = ohlcv(symbol=currentSymbol, exchange=currentExchange);\ntimeseries price = timeframe == \"chart\" ? field(ohlcv(symbol=currentSymbol, exchange=currentExchange), source) : htf(field(ohlcv(symbol=currentSymbol, exchange=currentExchange), source), timeframe, {mode: waitForClose ? \"confirmed\" : \"developing\"});\nfunc candleValues(bars) {\n return [bars.open, bars.high, bars.low, bars.close, bars.volume];\n}\ntimeseries candles = timeframe == \"chart\" ? [data.open, data.high, data.low, data.close, data.volume] : candleValues(htf(data, timeframe, {mode: waitForClose ? \"confirmed\" : \"developing\"}));\ntimeseries selectedCandles = [candles.open, candles.high, candles.low, price, candles.volume];";
46
+ /**
47
+ * Reads slot `index` of a script's `colors` input as saved, alpha included. The chart completes
48
+ * every saved palette to the built-in's full slot list before a run (completeBuiltinPalette in
49
+ * builtin-script-theme-palette.util), so the first-slot fallback only covers a caller that hands a
50
+ * shorter one. Both branches read the input, so they share its colour type, which plot colour
51
+ * arrays require (a string-literal fallback needed an opacity() wrap, and opacity() forced full
52
+ * alpha and read most colour names as grey).
53
+ */
54
+ export declare function colorSlot(index: number): string;
55
+ /** Level inputs shared by the bounded oscillators. */
56
+ export declare function oscillatorLevelInputs(overbought: number, oversold: number): string;
57
+ /** Colour slot of the oscillator line on a bar: 0 inside the levels, 1 overbought, 2 oversold. */
58
+ export declare function oscillatorExtremeIndex(value: string): string;
59
+ /**
60
+ * Dashed overbought / oversold levels, a dotted midline, and the zone between them shaded in the
61
+ * oscillator's own colour. The zone is a box drawn on the last bar from the first bar to well past
62
+ * the last one: drawings carry no alert output and no legend entry, and the last-bar box rolls back
63
+ * and redraws on live ticks.
64
+ */
65
+ export declare function oscillatorLevelsScript(zoneColor: string, midline: number): string;
66
+ export declare const OSCILLATOR_SMOOTHING_INPUTS = "var smoothingType = input(name=\"smoothingType\", type=\"select\", defaultValue=\"None\", options=[\"None\", \"SMA\", \"SMA + Bollinger Bands\", \"EMA\", \"RMA\", \"WMA\", \"VWMA\"], group=\"Smoothing\");\nvar smoothingLength = input(name=\"smoothingLength\", type=\"number\", defaultValue=14, constraints={min: 1, step: 1}, group=\"Smoothing\");\nvar bbStdDev = input(name=\"bbStdDev\", type=\"number\", defaultValue=2, constraints={min: 0, step: 0.1}, group=\"Smoothing\");";
67
+ export declare function oscillatorSmoothingScript(value: string, label: string, width: string, color: string): string;
68
+ /**
69
+ * Window and step functions over a history array (oldest first). The window functions read the
70
+ * LAST `p` entries and return na unless all of them are finite, like the strict builtins (sma, wma,
71
+ * stdev, highest, lowest); htfSum skips na and accepts a short window, like sum(). The step
72
+ * functions mirror the engine's seeding (the plain average of the first `p` finite values) and its
73
+ * exact update arithmetic, so a converted template matches the builtin bit for bit.
74
+ */
75
+ export declare const HTF_WINDOW_FUNCS = "func htfAverage(values, p) {\n if (values.length < p) {\n return na;\n }\n var total = 0;\n for (var k = values.length - p; k < values.length; k = k + 1) {\n if (isna(values[k])) {\n return na;\n }\n total = total + values[k];\n }\n return total / p;\n}\nfunc htfWeightedAverage(values, p) {\n if (values.length < p) {\n return na;\n }\n var total = 0;\n var start = values.length - p;\n for (var k = 0; k < p; k = k + 1) {\n if (isna(values[start + k])) {\n return na;\n }\n total = total + values[start + k] * (k + 1);\n }\n return total / (p * (p + 1) / 2);\n}\nfunc htfVolumeWeightedAverage(values, volumes, p) {\n if (values.length < p || volumes.length < p) {\n return na;\n }\n var numerator = 0;\n var denominator = 0;\n for (var k = 0; k < p; k = k + 1) {\n var value = values[values.length - p + k];\n var volume = volumes[volumes.length - p + k];\n if (isna(value) || isna(volume)) {\n return na;\n }\n numerator = numerator + value * volume;\n denominator = denominator + volume;\n }\n return denominator == 0 ? na : numerator / denominator;\n}\nfunc htfStdev(values, p) {\n var mean = htfAverage(values, p);\n if (isna(mean)) {\n return na;\n }\n var squares = 0;\n for (var k = values.length - p; k < values.length; k = k + 1) {\n var diff = values[k] - mean;\n squares = squares + diff * diff;\n }\n return sqrt(squares / p);\n}\nfunc htfHighest(values, p) {\n if (values.length < p) {\n return na;\n }\n var best = na;\n for (var k = values.length - p; k < values.length; k = k + 1) {\n if (isna(values[k])) {\n return na;\n }\n if (isna(best) || values[k] > best) {\n best = values[k];\n }\n }\n return best;\n}\nfunc htfLowest(values, p) {\n if (values.length < p) {\n return na;\n }\n var best = na;\n for (var k = values.length - p; k < values.length; k = k + 1) {\n if (isna(values[k])) {\n return na;\n }\n if (isna(best) || values[k] < best) {\n best = values[k];\n }\n }\n return best;\n}\nfunc htfHighestOffset(values, p) {\n if (values.length < p) {\n return na;\n }\n var best = na;\n var at = 0;\n for (var k = values.length - p; k < values.length; k = k + 1) {\n if (isna(values[k])) {\n return na;\n }\n if (isna(best) || values[k] >= best) {\n best = values[k];\n at = k;\n }\n }\n return at - (values.length - 1);\n}\nfunc htfLowestOffset(values, p) {\n if (values.length < p) {\n return na;\n }\n var best = na;\n var at = 0;\n for (var k = values.length - p; k < values.length; k = k + 1) {\n if (isna(values[k])) {\n return na;\n }\n if (isna(best) || values[k] <= best) {\n best = values[k];\n at = k;\n }\n }\n return at - (values.length - 1);\n}\nfunc htfSum(values, p) {\n var total = 0;\n for (var k = max(0, values.length - p); k < values.length; k = k + 1) {\n if (!isna(values[k])) {\n total = total + values[k];\n }\n }\n return total;\n}\nfunc htfValueBack(values, n) {\n return values.length > n ? values[values.length - 1 - n] : na;\n}\nfunc htfEmaNext(previous, count, seedSum, value, p) {\n if (isna(value) || count + 1 < p) {\n return na;\n }\n if (count + 1 == p) {\n return (seedSum + value) / p;\n }\n var alpha = 2 / (p + 1);\n return value * alpha + previous * (1 - alpha);\n}\nfunc htfRmaNext(previous, count, seedSum, value, p) {\n if (isna(value) || count + 1 < p) {\n return na;\n }\n if (count + 1 == p) {\n return (seedSum + value) / p;\n }\n return (previous * (p - 1) + value) / p;\n}\nfunc htfRsiOf(gain, loss) {\n if (isna(gain) || isna(loss)) {\n return na;\n }\n return loss == 0 ? 100 : 100 - 100 / (1 + gain / loss);\n}";
76
+ /**
77
+ * The selected timeframe's closed and forming candles, materialized ONCE at init (a direct htf()
78
+ * of the source runs in init; the "1Y" placeholder only keeps the calls valid in chart mode, which
79
+ * never reads them), and `htfClosed`: true on the chart bar right after a selected-timeframe bar
80
+ * closed. Rolling tokens compare the engine's own epoch-floor bucket of consecutive chart bars;
81
+ * calendar tokens (1D / 1W) fall back to "the closed candle changed". Requires the `timeframe`
82
+ * input (CLASSIC_TIMEFRAME_INPUTS).
83
+ */
84
+ export declare const HTF_SELECTED_TIMEFRAME = "func htfAverage(values, p) {\n if (values.length < p) {\n return na;\n }\n var total = 0;\n for (var k = values.length - p; k < values.length; k = k + 1) {\n if (isna(values[k])) {\n return na;\n }\n total = total + values[k];\n }\n return total / p;\n}\nfunc htfWeightedAverage(values, p) {\n if (values.length < p) {\n return na;\n }\n var total = 0;\n var start = values.length - p;\n for (var k = 0; k < p; k = k + 1) {\n if (isna(values[start + k])) {\n return na;\n }\n total = total + values[start + k] * (k + 1);\n }\n return total / (p * (p + 1) / 2);\n}\nfunc htfVolumeWeightedAverage(values, volumes, p) {\n if (values.length < p || volumes.length < p) {\n return na;\n }\n var numerator = 0;\n var denominator = 0;\n for (var k = 0; k < p; k = k + 1) {\n var value = values[values.length - p + k];\n var volume = volumes[volumes.length - p + k];\n if (isna(value) || isna(volume)) {\n return na;\n }\n numerator = numerator + value * volume;\n denominator = denominator + volume;\n }\n return denominator == 0 ? na : numerator / denominator;\n}\nfunc htfStdev(values, p) {\n var mean = htfAverage(values, p);\n if (isna(mean)) {\n return na;\n }\n var squares = 0;\n for (var k = values.length - p; k < values.length; k = k + 1) {\n var diff = values[k] - mean;\n squares = squares + diff * diff;\n }\n return sqrt(squares / p);\n}\nfunc htfHighest(values, p) {\n if (values.length < p) {\n return na;\n }\n var best = na;\n for (var k = values.length - p; k < values.length; k = k + 1) {\n if (isna(values[k])) {\n return na;\n }\n if (isna(best) || values[k] > best) {\n best = values[k];\n }\n }\n return best;\n}\nfunc htfLowest(values, p) {\n if (values.length < p) {\n return na;\n }\n var best = na;\n for (var k = values.length - p; k < values.length; k = k + 1) {\n if (isna(values[k])) {\n return na;\n }\n if (isna(best) || values[k] < best) {\n best = values[k];\n }\n }\n return best;\n}\nfunc htfHighestOffset(values, p) {\n if (values.length < p) {\n return na;\n }\n var best = na;\n var at = 0;\n for (var k = values.length - p; k < values.length; k = k + 1) {\n if (isna(values[k])) {\n return na;\n }\n if (isna(best) || values[k] >= best) {\n best = values[k];\n at = k;\n }\n }\n return at - (values.length - 1);\n}\nfunc htfLowestOffset(values, p) {\n if (values.length < p) {\n return na;\n }\n var best = na;\n var at = 0;\n for (var k = values.length - p; k < values.length; k = k + 1) {\n if (isna(values[k])) {\n return na;\n }\n if (isna(best) || values[k] <= best) {\n best = values[k];\n at = k;\n }\n }\n return at - (values.length - 1);\n}\nfunc htfSum(values, p) {\n var total = 0;\n for (var k = max(0, values.length - p); k < values.length; k = k + 1) {\n if (!isna(values[k])) {\n total = total + values[k];\n }\n }\n return total;\n}\nfunc htfValueBack(values, n) {\n return values.length > n ? values[values.length - 1 - n] : na;\n}\nfunc htfEmaNext(previous, count, seedSum, value, p) {\n if (isna(value) || count + 1 < p) {\n return na;\n }\n if (count + 1 == p) {\n return (seedSum + value) / p;\n }\n var alpha = 2 / (p + 1);\n return value * alpha + previous * (1 - alpha);\n}\nfunc htfRmaNext(previous, count, seedSum, value, p) {\n if (isna(value) || count + 1 < p) {\n return na;\n }\n if (count + 1 == p) {\n return (seedSum + value) / p;\n }\n return (previous * (p - 1) + value) / p;\n}\nfunc htfRsiOf(gain, loss) {\n if (isna(gain) || isna(loss)) {\n return na;\n }\n return loss == 0 ? 100 : 100 - 100 / (1 + gain / loss);\n}\ntimeseries htfBars = ohlcv(symbol=currentSymbol, exchange=currentExchange);\ntimeseries htfClosedCandle = htf(htfBars, timeframe == \"chart\" ? \"1Y\" : timeframe);\ntimeseries htfFormingCandle = htf(htfBars, timeframe == \"chart\" ? \"1Y\" : timeframe, {mode: \"developing\"});\nvar htfMs = timeframe == \"1m\" ? 60000 : timeframe == \"3m\" ? 180000 : timeframe == \"5m\" ? 300000 : timeframe == \"15m\" ? 900000 : timeframe == \"30m\" ? 1800000 : timeframe == \"1h\" ? 3600000 : timeframe == \"2h\" ? 7200000 : timeframe == \"4h\" ? 14400000 : timeframe == \"6h\" ? 21600000 : timeframe == \"8h\" ? 28800000 : timeframe == \"12h\" ? 43200000 : 0;\nvar htfBucketChanged = htfMs > 0 && barIndex > 0 && floor(htfBars.time[0] / htfMs) != floor(htfBars.time[1] / htfMs);\nvar htfCandleChanged = isna(htfClosedCandle.close[1]) || htfClosedCandle.close[0] != htfClosedCandle.close[1] || htfClosedCandle.open[0] != htfClosedCandle.open[1] || htfClosedCandle.high[0] != htfClosedCandle.high[1] || htfClosedCandle.low[0] != htfClosedCandle.low[1] || htfClosedCandle.volume[0] != htfClosedCandle.volume[1];\nvar htfClosed = timeframe != \"chart\" && !isna(htfClosedCandle.close[0]) && (htfMs > 0 ? htfBucketChanged : htfCandleChanged);";
85
+ /**
86
+ * Candle templates: `data` is the chart's own candles in every mode (chart mode reads it exactly as
87
+ * CLASSIC_CANDLE_SERIES did), and the selected timeframe is read from htfClosedCandle /
88
+ * htfFormingCandle (`.high[0]`, `.volume[0]`, ...). Replaces CLASSIC_CANDLE_SERIES.
89
+ */
90
+ export declare const HTF_CANDLE_SERIES = "timeseries chartData = ohlcv(symbol=currentSymbol, exchange=currentExchange);\ntimeseries data = [chartData.open, chartData.high, chartData.low, chartData.close, chartData.volume];\nfunc htfAverage(values, p) {\n if (values.length < p) {\n return na;\n }\n var total = 0;\n for (var k = values.length - p; k < values.length; k = k + 1) {\n if (isna(values[k])) {\n return na;\n }\n total = total + values[k];\n }\n return total / p;\n}\nfunc htfWeightedAverage(values, p) {\n if (values.length < p) {\n return na;\n }\n var total = 0;\n var start = values.length - p;\n for (var k = 0; k < p; k = k + 1) {\n if (isna(values[start + k])) {\n return na;\n }\n total = total + values[start + k] * (k + 1);\n }\n return total / (p * (p + 1) / 2);\n}\nfunc htfVolumeWeightedAverage(values, volumes, p) {\n if (values.length < p || volumes.length < p) {\n return na;\n }\n var numerator = 0;\n var denominator = 0;\n for (var k = 0; k < p; k = k + 1) {\n var value = values[values.length - p + k];\n var volume = volumes[volumes.length - p + k];\n if (isna(value) || isna(volume)) {\n return na;\n }\n numerator = numerator + value * volume;\n denominator = denominator + volume;\n }\n return denominator == 0 ? na : numerator / denominator;\n}\nfunc htfStdev(values, p) {\n var mean = htfAverage(values, p);\n if (isna(mean)) {\n return na;\n }\n var squares = 0;\n for (var k = values.length - p; k < values.length; k = k + 1) {\n var diff = values[k] - mean;\n squares = squares + diff * diff;\n }\n return sqrt(squares / p);\n}\nfunc htfHighest(values, p) {\n if (values.length < p) {\n return na;\n }\n var best = na;\n for (var k = values.length - p; k < values.length; k = k + 1) {\n if (isna(values[k])) {\n return na;\n }\n if (isna(best) || values[k] > best) {\n best = values[k];\n }\n }\n return best;\n}\nfunc htfLowest(values, p) {\n if (values.length < p) {\n return na;\n }\n var best = na;\n for (var k = values.length - p; k < values.length; k = k + 1) {\n if (isna(values[k])) {\n return na;\n }\n if (isna(best) || values[k] < best) {\n best = values[k];\n }\n }\n return best;\n}\nfunc htfHighestOffset(values, p) {\n if (values.length < p) {\n return na;\n }\n var best = na;\n var at = 0;\n for (var k = values.length - p; k < values.length; k = k + 1) {\n if (isna(values[k])) {\n return na;\n }\n if (isna(best) || values[k] >= best) {\n best = values[k];\n at = k;\n }\n }\n return at - (values.length - 1);\n}\nfunc htfLowestOffset(values, p) {\n if (values.length < p) {\n return na;\n }\n var best = na;\n var at = 0;\n for (var k = values.length - p; k < values.length; k = k + 1) {\n if (isna(values[k])) {\n return na;\n }\n if (isna(best) || values[k] <= best) {\n best = values[k];\n at = k;\n }\n }\n return at - (values.length - 1);\n}\nfunc htfSum(values, p) {\n var total = 0;\n for (var k = max(0, values.length - p); k < values.length; k = k + 1) {\n if (!isna(values[k])) {\n total = total + values[k];\n }\n }\n return total;\n}\nfunc htfValueBack(values, n) {\n return values.length > n ? values[values.length - 1 - n] : na;\n}\nfunc htfEmaNext(previous, count, seedSum, value, p) {\n if (isna(value) || count + 1 < p) {\n return na;\n }\n if (count + 1 == p) {\n return (seedSum + value) / p;\n }\n var alpha = 2 / (p + 1);\n return value * alpha + previous * (1 - alpha);\n}\nfunc htfRmaNext(previous, count, seedSum, value, p) {\n if (isna(value) || count + 1 < p) {\n return na;\n }\n if (count + 1 == p) {\n return (seedSum + value) / p;\n }\n return (previous * (p - 1) + value) / p;\n}\nfunc htfRsiOf(gain, loss) {\n if (isna(gain) || isna(loss)) {\n return na;\n }\n return loss == 0 ? 100 : 100 - 100 / (1 + gain / loss);\n}\ntimeseries htfBars = ohlcv(symbol=currentSymbol, exchange=currentExchange);\ntimeseries htfClosedCandle = htf(htfBars, timeframe == \"chart\" ? \"1Y\" : timeframe);\ntimeseries htfFormingCandle = htf(htfBars, timeframe == \"chart\" ? \"1Y\" : timeframe, {mode: \"developing\"});\nvar htfMs = timeframe == \"1m\" ? 60000 : timeframe == \"3m\" ? 180000 : timeframe == \"5m\" ? 300000 : timeframe == \"15m\" ? 900000 : timeframe == \"30m\" ? 1800000 : timeframe == \"1h\" ? 3600000 : timeframe == \"2h\" ? 7200000 : timeframe == \"4h\" ? 14400000 : timeframe == \"6h\" ? 21600000 : timeframe == \"8h\" ? 28800000 : timeframe == \"12h\" ? 43200000 : 0;\nvar htfBucketChanged = htfMs > 0 && barIndex > 0 && floor(htfBars.time[0] / htfMs) != floor(htfBars.time[1] / htfMs);\nvar htfCandleChanged = isna(htfClosedCandle.close[1]) || htfClosedCandle.close[0] != htfClosedCandle.close[1] || htfClosedCandle.open[0] != htfClosedCandle.open[1] || htfClosedCandle.high[0] != htfClosedCandle.high[1] || htfClosedCandle.low[0] != htfClosedCandle.low[1] || htfClosedCandle.volume[0] != htfClosedCandle.volume[1];\nvar htfClosed = timeframe != \"chart\" && !isna(htfClosedCandle.close[0]) && (htfMs > 0 ? htfBucketChanged : htfCandleChanged);";
91
+ /**
92
+ * Price templates: `data` and `price` as CLASSIC_PRICE_SERIES declares them in chart mode, plus
93
+ * the selected price read from the SELECTED candle (open / high / low / close of the closed and of
94
+ * the forming selected-timeframe bar). Requires CLASSIC_PRICE_INPUTS. Replaces CLASSIC_PRICE_SERIES.
95
+ */
96
+ export declare const HTF_PRICE_SERIES = "timeseries data = ohlcv(symbol=currentSymbol, exchange=currentExchange);\ntimeseries price = field(ohlcv(symbol=currentSymbol, exchange=currentExchange), source);\nfunc htfAverage(values, p) {\n if (values.length < p) {\n return na;\n }\n var total = 0;\n for (var k = values.length - p; k < values.length; k = k + 1) {\n if (isna(values[k])) {\n return na;\n }\n total = total + values[k];\n }\n return total / p;\n}\nfunc htfWeightedAverage(values, p) {\n if (values.length < p) {\n return na;\n }\n var total = 0;\n var start = values.length - p;\n for (var k = 0; k < p; k = k + 1) {\n if (isna(values[start + k])) {\n return na;\n }\n total = total + values[start + k] * (k + 1);\n }\n return total / (p * (p + 1) / 2);\n}\nfunc htfVolumeWeightedAverage(values, volumes, p) {\n if (values.length < p || volumes.length < p) {\n return na;\n }\n var numerator = 0;\n var denominator = 0;\n for (var k = 0; k < p; k = k + 1) {\n var value = values[values.length - p + k];\n var volume = volumes[volumes.length - p + k];\n if (isna(value) || isna(volume)) {\n return na;\n }\n numerator = numerator + value * volume;\n denominator = denominator + volume;\n }\n return denominator == 0 ? na : numerator / denominator;\n}\nfunc htfStdev(values, p) {\n var mean = htfAverage(values, p);\n if (isna(mean)) {\n return na;\n }\n var squares = 0;\n for (var k = values.length - p; k < values.length; k = k + 1) {\n var diff = values[k] - mean;\n squares = squares + diff * diff;\n }\n return sqrt(squares / p);\n}\nfunc htfHighest(values, p) {\n if (values.length < p) {\n return na;\n }\n var best = na;\n for (var k = values.length - p; k < values.length; k = k + 1) {\n if (isna(values[k])) {\n return na;\n }\n if (isna(best) || values[k] > best) {\n best = values[k];\n }\n }\n return best;\n}\nfunc htfLowest(values, p) {\n if (values.length < p) {\n return na;\n }\n var best = na;\n for (var k = values.length - p; k < values.length; k = k + 1) {\n if (isna(values[k])) {\n return na;\n }\n if (isna(best) || values[k] < best) {\n best = values[k];\n }\n }\n return best;\n}\nfunc htfHighestOffset(values, p) {\n if (values.length < p) {\n return na;\n }\n var best = na;\n var at = 0;\n for (var k = values.length - p; k < values.length; k = k + 1) {\n if (isna(values[k])) {\n return na;\n }\n if (isna(best) || values[k] >= best) {\n best = values[k];\n at = k;\n }\n }\n return at - (values.length - 1);\n}\nfunc htfLowestOffset(values, p) {\n if (values.length < p) {\n return na;\n }\n var best = na;\n var at = 0;\n for (var k = values.length - p; k < values.length; k = k + 1) {\n if (isna(values[k])) {\n return na;\n }\n if (isna(best) || values[k] <= best) {\n best = values[k];\n at = k;\n }\n }\n return at - (values.length - 1);\n}\nfunc htfSum(values, p) {\n var total = 0;\n for (var k = max(0, values.length - p); k < values.length; k = k + 1) {\n if (!isna(values[k])) {\n total = total + values[k];\n }\n }\n return total;\n}\nfunc htfValueBack(values, n) {\n return values.length > n ? values[values.length - 1 - n] : na;\n}\nfunc htfEmaNext(previous, count, seedSum, value, p) {\n if (isna(value) || count + 1 < p) {\n return na;\n }\n if (count + 1 == p) {\n return (seedSum + value) / p;\n }\n var alpha = 2 / (p + 1);\n return value * alpha + previous * (1 - alpha);\n}\nfunc htfRmaNext(previous, count, seedSum, value, p) {\n if (isna(value) || count + 1 < p) {\n return na;\n }\n if (count + 1 == p) {\n return (seedSum + value) / p;\n }\n return (previous * (p - 1) + value) / p;\n}\nfunc htfRsiOf(gain, loss) {\n if (isna(gain) || isna(loss)) {\n return na;\n }\n return loss == 0 ? 100 : 100 - 100 / (1 + gain / loss);\n}\ntimeseries htfBars = ohlcv(symbol=currentSymbol, exchange=currentExchange);\ntimeseries htfClosedCandle = htf(htfBars, timeframe == \"chart\" ? \"1Y\" : timeframe);\ntimeseries htfFormingCandle = htf(htfBars, timeframe == \"chart\" ? \"1Y\" : timeframe, {mode: \"developing\"});\nvar htfMs = timeframe == \"1m\" ? 60000 : timeframe == \"3m\" ? 180000 : timeframe == \"5m\" ? 300000 : timeframe == \"15m\" ? 900000 : timeframe == \"30m\" ? 1800000 : timeframe == \"1h\" ? 3600000 : timeframe == \"2h\" ? 7200000 : timeframe == \"4h\" ? 14400000 : timeframe == \"6h\" ? 21600000 : timeframe == \"8h\" ? 28800000 : timeframe == \"12h\" ? 43200000 : 0;\nvar htfBucketChanged = htfMs > 0 && barIndex > 0 && floor(htfBars.time[0] / htfMs) != floor(htfBars.time[1] / htfMs);\nvar htfCandleChanged = isna(htfClosedCandle.close[1]) || htfClosedCandle.close[0] != htfClosedCandle.close[1] || htfClosedCandle.open[0] != htfClosedCandle.open[1] || htfClosedCandle.high[0] != htfClosedCandle.high[1] || htfClosedCandle.low[0] != htfClosedCandle.low[1] || htfClosedCandle.volume[0] != htfClosedCandle.volume[1];\nvar htfClosed = timeframe != \"chart\" && !isna(htfClosedCandle.close[0]) && (htfMs > 0 ? htfBucketChanged : htfCandleChanged);\nvar htfClosedPrice = source == \"open\" ? htfClosedCandle.open[0] : source == \"high\" ? htfClosedCandle.high[0] : source == \"low\" ? htfClosedCandle.low[0] : htfClosedCandle.close[0];\nvar htfFormingPrice = source == \"open\" ? htfFormingCandle.open[0] : source == \"high\" ? htfFormingCandle.high[0] : source == \"low\" ? htfFormingCandle.low[0] : htfFormingCandle.close[0];";
97
+ /**
98
+ * OHLCV templates that use the selected price as close: `selectedCandles` as CLASSIC_SELECTED_CANDLES
99
+ * declares it in chart mode; the selected timeframe reads htfClosedCandle / htfFormingCandle with
100
+ * htfClosedPrice / htfFormingPrice as the close. Replaces CLASSIC_SELECTED_CANDLES.
101
+ */
102
+ export declare const HTF_SELECTED_CANDLES = "timeseries data = ohlcv(symbol=currentSymbol, exchange=currentExchange);\ntimeseries price = field(ohlcv(symbol=currentSymbol, exchange=currentExchange), source);\nfunc htfAverage(values, p) {\n if (values.length < p) {\n return na;\n }\n var total = 0;\n for (var k = values.length - p; k < values.length; k = k + 1) {\n if (isna(values[k])) {\n return na;\n }\n total = total + values[k];\n }\n return total / p;\n}\nfunc htfWeightedAverage(values, p) {\n if (values.length < p) {\n return na;\n }\n var total = 0;\n var start = values.length - p;\n for (var k = 0; k < p; k = k + 1) {\n if (isna(values[start + k])) {\n return na;\n }\n total = total + values[start + k] * (k + 1);\n }\n return total / (p * (p + 1) / 2);\n}\nfunc htfVolumeWeightedAverage(values, volumes, p) {\n if (values.length < p || volumes.length < p) {\n return na;\n }\n var numerator = 0;\n var denominator = 0;\n for (var k = 0; k < p; k = k + 1) {\n var value = values[values.length - p + k];\n var volume = volumes[volumes.length - p + k];\n if (isna(value) || isna(volume)) {\n return na;\n }\n numerator = numerator + value * volume;\n denominator = denominator + volume;\n }\n return denominator == 0 ? na : numerator / denominator;\n}\nfunc htfStdev(values, p) {\n var mean = htfAverage(values, p);\n if (isna(mean)) {\n return na;\n }\n var squares = 0;\n for (var k = values.length - p; k < values.length; k = k + 1) {\n var diff = values[k] - mean;\n squares = squares + diff * diff;\n }\n return sqrt(squares / p);\n}\nfunc htfHighest(values, p) {\n if (values.length < p) {\n return na;\n }\n var best = na;\n for (var k = values.length - p; k < values.length; k = k + 1) {\n if (isna(values[k])) {\n return na;\n }\n if (isna(best) || values[k] > best) {\n best = values[k];\n }\n }\n return best;\n}\nfunc htfLowest(values, p) {\n if (values.length < p) {\n return na;\n }\n var best = na;\n for (var k = values.length - p; k < values.length; k = k + 1) {\n if (isna(values[k])) {\n return na;\n }\n if (isna(best) || values[k] < best) {\n best = values[k];\n }\n }\n return best;\n}\nfunc htfHighestOffset(values, p) {\n if (values.length < p) {\n return na;\n }\n var best = na;\n var at = 0;\n for (var k = values.length - p; k < values.length; k = k + 1) {\n if (isna(values[k])) {\n return na;\n }\n if (isna(best) || values[k] >= best) {\n best = values[k];\n at = k;\n }\n }\n return at - (values.length - 1);\n}\nfunc htfLowestOffset(values, p) {\n if (values.length < p) {\n return na;\n }\n var best = na;\n var at = 0;\n for (var k = values.length - p; k < values.length; k = k + 1) {\n if (isna(values[k])) {\n return na;\n }\n if (isna(best) || values[k] <= best) {\n best = values[k];\n at = k;\n }\n }\n return at - (values.length - 1);\n}\nfunc htfSum(values, p) {\n var total = 0;\n for (var k = max(0, values.length - p); k < values.length; k = k + 1) {\n if (!isna(values[k])) {\n total = total + values[k];\n }\n }\n return total;\n}\nfunc htfValueBack(values, n) {\n return values.length > n ? values[values.length - 1 - n] : na;\n}\nfunc htfEmaNext(previous, count, seedSum, value, p) {\n if (isna(value) || count + 1 < p) {\n return na;\n }\n if (count + 1 == p) {\n return (seedSum + value) / p;\n }\n var alpha = 2 / (p + 1);\n return value * alpha + previous * (1 - alpha);\n}\nfunc htfRmaNext(previous, count, seedSum, value, p) {\n if (isna(value) || count + 1 < p) {\n return na;\n }\n if (count + 1 == p) {\n return (seedSum + value) / p;\n }\n return (previous * (p - 1) + value) / p;\n}\nfunc htfRsiOf(gain, loss) {\n if (isna(gain) || isna(loss)) {\n return na;\n }\n return loss == 0 ? 100 : 100 - 100 / (1 + gain / loss);\n}\ntimeseries htfBars = ohlcv(symbol=currentSymbol, exchange=currentExchange);\ntimeseries htfClosedCandle = htf(htfBars, timeframe == \"chart\" ? \"1Y\" : timeframe);\ntimeseries htfFormingCandle = htf(htfBars, timeframe == \"chart\" ? \"1Y\" : timeframe, {mode: \"developing\"});\nvar htfMs = timeframe == \"1m\" ? 60000 : timeframe == \"3m\" ? 180000 : timeframe == \"5m\" ? 300000 : timeframe == \"15m\" ? 900000 : timeframe == \"30m\" ? 1800000 : timeframe == \"1h\" ? 3600000 : timeframe == \"2h\" ? 7200000 : timeframe == \"4h\" ? 14400000 : timeframe == \"6h\" ? 21600000 : timeframe == \"8h\" ? 28800000 : timeframe == \"12h\" ? 43200000 : 0;\nvar htfBucketChanged = htfMs > 0 && barIndex > 0 && floor(htfBars.time[0] / htfMs) != floor(htfBars.time[1] / htfMs);\nvar htfCandleChanged = isna(htfClosedCandle.close[1]) || htfClosedCandle.close[0] != htfClosedCandle.close[1] || htfClosedCandle.open[0] != htfClosedCandle.open[1] || htfClosedCandle.high[0] != htfClosedCandle.high[1] || htfClosedCandle.low[0] != htfClosedCandle.low[1] || htfClosedCandle.volume[0] != htfClosedCandle.volume[1];\nvar htfClosed = timeframe != \"chart\" && !isna(htfClosedCandle.close[0]) && (htfMs > 0 ? htfBucketChanged : htfCandleChanged);\nvar htfClosedPrice = source == \"open\" ? htfClosedCandle.open[0] : source == \"high\" ? htfClosedCandle.high[0] : source == \"low\" ? htfClosedCandle.low[0] : htfClosedCandle.close[0];\nvar htfFormingPrice = source == \"open\" ? htfFormingCandle.open[0] : source == \"high\" ? htfFormingCandle.high[0] : source == \"low\" ? htfFormingCandle.low[0] : htfFormingCandle.close[0];\ntimeseries selectedCandles = [data.open, data.high, data.low, price, data.volume];";
103
+ /**
104
+ * A persist history of `closedValue`, appended once per closed selected-timeframe bar (na values
105
+ * are skipped, so a derived value's warm-up leaves no hole) and capped at `cap` entries, oldest
106
+ * first. `cap` is a kScript expression (`period`, `period + 1`, `slowPeriod`). An offset history
107
+ * passes `keepNa`: one entry per closed bar, na included, so `htfValueBack(history, offset)` counts
108
+ * selected-timeframe bars like `series[offset]` and an undefined value stays undefined instead of
109
+ * repeating the bar before it.
110
+ */
111
+ export declare function htfHistory(name: string, closedValue: string, cap: string | number, keepNa?: boolean): string;
112
+ /**
113
+ * The values a window reads: the closed history alone when waitForClose is on, the history plus
114
+ * `formingValue` (the forming selected-timeframe bar) when it is off.
115
+ */
116
+ export declare function htfWindow(history: string, formingValue: string): string;
117
+ /**
118
+ * Recursive smoothing (EMA or RMA / Wilder) over closed selected-timeframe values. Declares the
119
+ * persist state (`<name>Closed`, `<name>Count`, `<name>Seed`), steps it once per closed bar with
120
+ * `closedValue`, and declares `var <name>`: the committed value when waitForClose is on, otherwise
121
+ * a provisional step with `formingValue` that is never committed. `closedValue` must be finite once
122
+ * it starts (leading na only), like the builtins' own seeding. Chain them by feeding one state's
123
+ * `<name>Closed` / `<name>` into the next (MACD's signal line, ATR from a true range).
124
+ */
125
+ export declare function htfSmoothedState(name: string, kind: 'ema' | 'rma', closedValue: string, formingValue: string, period: string | number): string;
126
+ /**
127
+ * oscillatorSmoothingScript for a converted oscillator: chart mode smooths `value` with the
128
+ * builtins exactly as before; the selected timeframe smooths the oscillator's own closed values
129
+ * (`closedValue`, read on the bar a selected-timeframe bar closed) plus `formingValue` when
130
+ * waitForClose is off, weighted by the selected timeframe's volume for VWMA. Requires
131
+ * OSCILLATOR_SMOOTHING_INPUTS and one of the HTF_*_SERIES blocks.
132
+ */
133
+ export declare function htfOscillatorSmoothingScript(value: string, closedValue: string, formingValue: string, label: string, width: string, color: string): string;