@invinite-org/chartlang-runtime 1.1.1 → 1.3.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 (294) hide show
  1. package/CHANGELOG.md +307 -0
  2. package/dist/barPoint.d.ts +20 -0
  3. package/dist/barPoint.d.ts.map +1 -0
  4. package/dist/barPoint.js +72 -0
  5. package/dist/barPoint.js.map +1 -0
  6. package/dist/bufferSnapshot.d.ts +102 -0
  7. package/dist/bufferSnapshot.d.ts.map +1 -0
  8. package/dist/bufferSnapshot.js +119 -0
  9. package/dist/bufferSnapshot.js.map +1 -0
  10. package/dist/buildComputeContext.d.ts.map +1 -1
  11. package/dist/buildComputeContext.js +6 -1
  12. package/dist/buildComputeContext.js.map +1 -1
  13. package/dist/createScriptRunner.d.ts +6 -3
  14. package/dist/createScriptRunner.d.ts.map +1 -1
  15. package/dist/createScriptRunner.js +65 -11
  16. package/dist/createScriptRunner.js.map +1 -1
  17. package/dist/dep/DepRunner.d.ts +7 -0
  18. package/dist/dep/DepRunner.d.ts.map +1 -1
  19. package/dist/dep/DepRunner.js +4 -0
  20. package/dist/dep/DepRunner.js.map +1 -1
  21. package/dist/emit/barcolor.d.ts +44 -0
  22. package/dist/emit/barcolor.d.ts.map +1 -0
  23. package/dist/emit/barcolor.js +40 -0
  24. package/dist/emit/barcolor.js.map +1 -0
  25. package/dist/emit/bgcolor.d.ts +44 -0
  26. package/dist/emit/bgcolor.d.ts.map +1 -0
  27. package/dist/emit/bgcolor.js +45 -0
  28. package/dist/emit/bgcolor.js.map +1 -0
  29. package/dist/emit/draw/boxes/fillBetween.d.ts +45 -0
  30. package/dist/emit/draw/boxes/fillBetween.d.ts.map +1 -0
  31. package/dist/emit/draw/boxes/fillBetween.js +36 -0
  32. package/dist/emit/draw/boxes/fillBetween.js.map +1 -0
  33. package/dist/emit/draw/handle.d.ts +9 -0
  34. package/dist/emit/draw/handle.d.ts.map +1 -1
  35. package/dist/emit/draw/handle.js +65 -10
  36. package/dist/emit/draw/handle.js.map +1 -1
  37. package/dist/emit/draw/namespace.d.ts +4 -3
  38. package/dist/emit/draw/namespace.d.ts.map +1 -1
  39. package/dist/emit/draw/namespace.js +6 -3
  40. package/dist/emit/draw/namespace.js.map +1 -1
  41. package/dist/emit/index.d.ts +2 -0
  42. package/dist/emit/index.d.ts.map +1 -1
  43. package/dist/emit/index.js +2 -0
  44. package/dist/emit/index.js.map +1 -1
  45. package/dist/emit/plot.d.ts +30 -1
  46. package/dist/emit/plot.d.ts.map +1 -1
  47. package/dist/emit/plot.js +45 -1
  48. package/dist/emit/plot.js.map +1 -1
  49. package/dist/execution/dispose.d.ts.map +1 -1
  50. package/dist/execution/dispose.js +18 -0
  51. package/dist/execution/dispose.js.map +1 -1
  52. package/dist/execution/runComputeStep.d.ts.map +1 -1
  53. package/dist/execution/runComputeStep.js +12 -1
  54. package/dist/execution/runComputeStep.js.map +1 -1
  55. package/dist/index.d.ts +1 -1
  56. package/dist/index.d.ts.map +1 -1
  57. package/dist/index.js +1 -1
  58. package/dist/index.js.map +1 -1
  59. package/dist/inputs/resolveInputs.js +1 -0
  60. package/dist/inputs/resolveInputs.js.map +1 -1
  61. package/dist/persistentStateStore.runtime.d.ts.map +1 -1
  62. package/dist/persistentStateStore.runtime.js +26 -7
  63. package/dist/persistentStateStore.runtime.js.map +1 -1
  64. package/dist/primitives.d.ts +1 -1
  65. package/dist/primitives.d.ts.map +1 -1
  66. package/dist/primitives.js +7 -1
  67. package/dist/primitives.js.map +1 -1
  68. package/dist/request/index.d.ts +2 -1
  69. package/dist/request/index.d.ts.map +1 -1
  70. package/dist/request/index.js +2 -1
  71. package/dist/request/index.js.map +1 -1
  72. package/dist/request/lowerTf.d.ts.map +1 -1
  73. package/dist/request/lowerTf.js +6 -0
  74. package/dist/request/lowerTf.js.map +1 -1
  75. package/dist/request/requestNamespace.d.ts.map +1 -1
  76. package/dist/request/requestNamespace.js +30 -3
  77. package/dist/request/requestNamespace.js.map +1 -1
  78. package/dist/request/security.d.ts +40 -4
  79. package/dist/request/security.d.ts.map +1 -1
  80. package/dist/request/security.js +114 -40
  81. package/dist/request/security.js.map +1 -1
  82. package/dist/request/securityExprRunner.d.ts +137 -0
  83. package/dist/request/securityExprRunner.d.ts.map +1 -0
  84. package/dist/request/securityExprRunner.js +253 -0
  85. package/dist/request/securityExprRunner.js.map +1 -0
  86. package/dist/request/streamBars.d.ts +14 -1
  87. package/dist/request/streamBars.d.ts.map +1 -1
  88. package/dist/request/streamBars.js +39 -1
  89. package/dist/request/streamBars.js.map +1 -1
  90. package/dist/ringBuffer.d.ts +19 -0
  91. package/dist/ringBuffer.d.ts.map +1 -1
  92. package/dist/ringBuffer.js +23 -0
  93. package/dist/ringBuffer.js.map +1 -1
  94. package/dist/runtimeContext.d.ts +90 -5
  95. package/dist/runtimeContext.d.ts.map +1 -1
  96. package/dist/runtimeContext.js.map +1 -1
  97. package/dist/seriesView.d.ts +42 -17
  98. package/dist/seriesView.d.ts.map +1 -1
  99. package/dist/seriesView.js +65 -42
  100. package/dist/seriesView.js.map +1 -1
  101. package/dist/state/arrayPersistence.d.ts +48 -0
  102. package/dist/state/arrayPersistence.d.ts.map +1 -0
  103. package/dist/state/arrayPersistence.js +88 -0
  104. package/dist/state/arrayPersistence.js.map +1 -0
  105. package/dist/state/arrayStateSlot.d.ts +78 -0
  106. package/dist/state/arrayStateSlot.d.ts.map +1 -0
  107. package/dist/state/arrayStateSlot.js +116 -0
  108. package/dist/state/arrayStateSlot.js.map +1 -0
  109. package/dist/state/index.d.ts +4 -1
  110. package/dist/state/index.d.ts.map +1 -1
  111. package/dist/state/index.js +4 -1
  112. package/dist/state/index.js.map +1 -1
  113. package/dist/state/lifecycle.d.ts +68 -0
  114. package/dist/state/lifecycle.d.ts.map +1 -1
  115. package/dist/state/lifecycle.js +89 -0
  116. package/dist/state/lifecycle.js.map +1 -1
  117. package/dist/state/seriesPersistence.d.ts +48 -0
  118. package/dist/state/seriesPersistence.d.ts.map +1 -0
  119. package/dist/state/seriesPersistence.js +87 -0
  120. package/dist/state/seriesPersistence.js.map +1 -0
  121. package/dist/state/seriesSlot.d.ts +105 -0
  122. package/dist/state/seriesSlot.d.ts.map +1 -0
  123. package/dist/state/seriesSlot.js +123 -0
  124. package/dist/state/seriesSlot.js.map +1 -0
  125. package/dist/state/stateNamespace.d.ts.map +1 -1
  126. package/dist/state/stateNamespace.js +55 -0
  127. package/dist/state/stateNamespace.js.map +1 -1
  128. package/dist/streamState.d.ts +25 -19
  129. package/dist/streamState.d.ts.map +1 -1
  130. package/dist/streamState.js +40 -66
  131. package/dist/streamState.js.map +1 -1
  132. package/dist/ta/adx.d.ts +3 -2
  133. package/dist/ta/adx.d.ts.map +1 -1
  134. package/dist/ta/adx.js +3 -2
  135. package/dist/ta/adx.js.map +1 -1
  136. package/dist/ta/alma.d.ts +6 -4
  137. package/dist/ta/alma.d.ts.map +1 -1
  138. package/dist/ta/alma.js +19 -6
  139. package/dist/ta/alma.js.map +1 -1
  140. package/dist/ta/atr.d.ts +3 -2
  141. package/dist/ta/atr.d.ts.map +1 -1
  142. package/dist/ta/atr.js +3 -2
  143. package/dist/ta/atr.js.map +1 -1
  144. package/dist/ta/bb.d.ts +3 -2
  145. package/dist/ta/bb.d.ts.map +1 -1
  146. package/dist/ta/bb.js +3 -2
  147. package/dist/ta/bb.js.map +1 -1
  148. package/dist/ta/chaikinOsc.d.ts +3 -2
  149. package/dist/ta/chaikinOsc.d.ts.map +1 -1
  150. package/dist/ta/chaikinOsc.js +3 -2
  151. package/dist/ta/chaikinOsc.js.map +1 -1
  152. package/dist/ta/crossover.d.ts +3 -2
  153. package/dist/ta/crossover.d.ts.map +1 -1
  154. package/dist/ta/crossover.js +3 -2
  155. package/dist/ta/crossover.js.map +1 -1
  156. package/dist/ta/crossunder.d.ts +3 -2
  157. package/dist/ta/crossunder.d.ts.map +1 -1
  158. package/dist/ta/crossunder.js +3 -2
  159. package/dist/ta/crossunder.js.map +1 -1
  160. package/dist/ta/dmi.d.ts +4 -3
  161. package/dist/ta/dmi.d.ts.map +1 -1
  162. package/dist/ta/dmi.js +4 -3
  163. package/dist/ta/dmi.js.map +1 -1
  164. package/dist/ta/ema.d.ts +3 -2
  165. package/dist/ta/ema.d.ts.map +1 -1
  166. package/dist/ta/ema.js +3 -2
  167. package/dist/ta/ema.js.map +1 -1
  168. package/dist/ta/eom.d.ts +3 -1
  169. package/dist/ta/eom.d.ts.map +1 -1
  170. package/dist/ta/eom.js +3 -1
  171. package/dist/ta/eom.js.map +1 -1
  172. package/dist/ta/highestbars.d.ts +25 -0
  173. package/dist/ta/highestbars.d.ts.map +1 -0
  174. package/dist/ta/highestbars.js +106 -0
  175. package/dist/ta/highestbars.js.map +1 -0
  176. package/dist/ta/historicalVolatility.d.ts +3 -2
  177. package/dist/ta/historicalVolatility.d.ts.map +1 -1
  178. package/dist/ta/historicalVolatility.js +3 -2
  179. package/dist/ta/historicalVolatility.js.map +1 -1
  180. package/dist/ta/ichimoku.d.ts +3 -1
  181. package/dist/ta/ichimoku.d.ts.map +1 -1
  182. package/dist/ta/ichimoku.js +3 -1
  183. package/dist/ta/ichimoku.js.map +1 -1
  184. package/dist/ta/lowestbars.d.ts +25 -0
  185. package/dist/ta/lowestbars.d.ts.map +1 -0
  186. package/dist/ta/lowestbars.js +102 -0
  187. package/dist/ta/lowestbars.js.map +1 -0
  188. package/dist/ta/macd.d.ts +3 -2
  189. package/dist/ta/macd.d.ts.map +1 -1
  190. package/dist/ta/macd.js +3 -2
  191. package/dist/ta/macd.js.map +1 -1
  192. package/dist/ta/massIndex.d.ts +3 -2
  193. package/dist/ta/massIndex.d.ts.map +1 -1
  194. package/dist/ta/massIndex.js +3 -2
  195. package/dist/ta/massIndex.js.map +1 -1
  196. package/dist/ta/mfi.d.ts +3 -1
  197. package/dist/ta/mfi.d.ts.map +1 -1
  198. package/dist/ta/mfi.js +3 -1
  199. package/dist/ta/mfi.js.map +1 -1
  200. package/dist/ta/netVolume.d.ts +3 -1
  201. package/dist/ta/netVolume.d.ts.map +1 -1
  202. package/dist/ta/netVolume.js +3 -1
  203. package/dist/ta/netVolume.js.map +1 -1
  204. package/dist/ta/nvi.d.ts +3 -1
  205. package/dist/ta/nvi.d.ts.map +1 -1
  206. package/dist/ta/nvi.js +3 -1
  207. package/dist/ta/nvi.js.map +1 -1
  208. package/dist/ta/persistence.d.ts.map +1 -1
  209. package/dist/ta/persistence.js +1 -40
  210. package/dist/ta/persistence.js.map +1 -1
  211. package/dist/ta/ppo.d.ts +3 -2
  212. package/dist/ta/ppo.d.ts.map +1 -1
  213. package/dist/ta/ppo.js +3 -2
  214. package/dist/ta/ppo.js.map +1 -1
  215. package/dist/ta/pvi.d.ts +3 -1
  216. package/dist/ta/pvi.d.ts.map +1 -1
  217. package/dist/ta/pvi.js +3 -1
  218. package/dist/ta/pvi.js.map +1 -1
  219. package/dist/ta/pvo.d.ts +3 -1
  220. package/dist/ta/pvo.d.ts.map +1 -1
  221. package/dist/ta/pvo.js +3 -1
  222. package/dist/ta/pvo.js.map +1 -1
  223. package/dist/ta/pvt.d.ts +3 -1
  224. package/dist/ta/pvt.d.ts.map +1 -1
  225. package/dist/ta/pvt.js +3 -1
  226. package/dist/ta/pvt.js.map +1 -1
  227. package/dist/ta/registry.d.ts +7 -1
  228. package/dist/ta/registry.d.ts.map +1 -1
  229. package/dist/ta/registry.js +4 -0
  230. package/dist/ta/registry.js.map +1 -1
  231. package/dist/ta/rsi.d.ts +3 -2
  232. package/dist/ta/rsi.d.ts.map +1 -1
  233. package/dist/ta/rsi.js +3 -2
  234. package/dist/ta/rsi.js.map +1 -1
  235. package/dist/ta/rvi.d.ts +3 -2
  236. package/dist/ta/rvi.d.ts.map +1 -1
  237. package/dist/ta/rvi.js +3 -2
  238. package/dist/ta/rvi.js.map +1 -1
  239. package/dist/ta/sessionVolumeProfile.d.ts.map +1 -1
  240. package/dist/ta/sessionVolumeProfile.js +1 -17
  241. package/dist/ta/sessionVolumeProfile.js.map +1 -1
  242. package/dist/ta/sma.d.ts +6 -3
  243. package/dist/ta/sma.d.ts.map +1 -1
  244. package/dist/ta/sma.js +6 -3
  245. package/dist/ta/sma.js.map +1 -1
  246. package/dist/ta/stdev.d.ts +3 -2
  247. package/dist/ta/stdev.d.ts.map +1 -1
  248. package/dist/ta/stdev.js +3 -2
  249. package/dist/ta/stdev.js.map +1 -1
  250. package/dist/ta/trendStrengthIndex.d.ts +3 -2
  251. package/dist/ta/trendStrengthIndex.d.ts.map +1 -1
  252. package/dist/ta/trendStrengthIndex.js +3 -2
  253. package/dist/ta/trendStrengthIndex.js.map +1 -1
  254. package/dist/ta/trix.d.ts +4 -3
  255. package/dist/ta/trix.d.ts.map +1 -1
  256. package/dist/ta/trix.js +4 -3
  257. package/dist/ta/trix.js.map +1 -1
  258. package/dist/ta/vortex.d.ts +3 -2
  259. package/dist/ta/vortex.d.ts.map +1 -1
  260. package/dist/ta/vortex.js +3 -2
  261. package/dist/ta/vortex.js.map +1 -1
  262. package/dist/time-accessors/civil.d.ts +73 -0
  263. package/dist/time-accessors/civil.d.ts.map +1 -0
  264. package/dist/time-accessors/civil.js +105 -0
  265. package/dist/time-accessors/civil.js.map +1 -0
  266. package/dist/time-accessors/index.d.ts +8 -0
  267. package/dist/time-accessors/index.d.ts.map +1 -0
  268. package/dist/time-accessors/index.js +9 -0
  269. package/dist/time-accessors/index.js.map +1 -0
  270. package/dist/time-accessors/sessionAccessors.d.ts +50 -0
  271. package/dist/time-accessors/sessionAccessors.d.ts.map +1 -0
  272. package/dist/time-accessors/sessionAccessors.js +79 -0
  273. package/dist/time-accessors/sessionAccessors.js.map +1 -0
  274. package/dist/time-accessors/sessionWindow.d.ts +17 -0
  275. package/dist/time-accessors/sessionWindow.d.ts.map +1 -0
  276. package/dist/time-accessors/sessionWindow.js +41 -0
  277. package/dist/time-accessors/sessionWindow.js.map +1 -0
  278. package/dist/time-accessors/timeAccessors.d.ts +54 -0
  279. package/dist/time-accessors/timeAccessors.d.ts.map +1 -0
  280. package/dist/time-accessors/timeAccessors.js +132 -0
  281. package/dist/time-accessors/timeAccessors.js.map +1 -0
  282. package/dist/time-accessors/tzDiagnostic.d.ts +17 -0
  283. package/dist/time-accessors/tzDiagnostic.d.ts.map +1 -0
  284. package/dist/time-accessors/tzDiagnostic.js +34 -0
  285. package/dist/time-accessors/tzDiagnostic.js.map +1 -0
  286. package/dist/time-accessors/tzOffset.d.ts +31 -0
  287. package/dist/time-accessors/tzOffset.d.ts.map +1 -0
  288. package/dist/time-accessors/tzOffset.js +67 -0
  289. package/dist/time-accessors/tzOffset.js.map +1 -0
  290. package/package.json +3 -3
  291. package/dist/ta/lib/applyOffset.d.ts +0 -19
  292. package/dist/ta/lib/applyOffset.d.ts.map +0 -1
  293. package/dist/ta/lib/applyOffset.js +0 -38
  294. package/dist/ta/lib/applyOffset.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"registry.js","sourceRoot":"","sources":["../../src/ta/registry.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,+DAA+D;AAsI/D,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAC;AAC7B,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,EAAE,EAAE,M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E,IAAI,EAAE,MAAM,EAAW,CAAC;KACpD,CAAC;CACL,CAAC,CAAC;AAEH;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,EAAE,GAAuB,WAAW,CAAC","sourcesContent":["// Copyright (c) 2026 Invinite. Licensed under the MIT License.\n// See the LICENSE file in the repo root for full license text.\n\nimport type {\n AdlOpts,\n AdrOpts,\n AdxOpts,\n AlmaOpts,\n AnchoredVolumeProfileOpts,\n AnchoredVolumeProfileResult,\n AnchoredVwapOpts,\n AoOpts,\n AroonOpts,\n AroonOscOpts,\n AroonResult,\n AtrOpts,\n BarssinceOpts,\n BbOpts,\n BbPercentBOpts,\n BbResult,\n BbwOpts,\n BopOpts,\n CciOpts,\n ChaikinOscOpts,\n ChandeKrollStopOpts,\n ChandeKrollStopResult,\n ChandelierOpts,\n ChandelierResult,\n ChangeOpts,\n ChopOpts,\n CmfOpts,\n CmoOpts,\n ConnorsRsiOpts,\n CoppockOpts,\n CrossoverOpts,\n CrossunderOpts,\n DemaOpts,\n DmiOpts,\n DmiResult,\n DonchianOpts,\n DonchianResult,\n DpoOpts,\n EmaOpts,\n EnvelopeOpts,\n EnvelopeResult,\n EomOpts,\n FisherOpts,\n FisherResult,\n FixedRangeVolumeProfileOpts,\n FixedRangeVolumeProfileResult,\n HighestOpts,\n HmaOpts,\n HvOpts,\n IchimokuOpts,\n IchimokuResult,\n KamaOpts,\n KeltnerOpts,\n KeltnerResult,\n KlingerOpts,\n KlingerResult,\n KstOpts,\n KstResult,\n LowestOpts,\n LsmaOpts,\n MaRibbonOpts,\n MaRibbonResult,\n MacdOpts,\n MacdResult,\n MassIndexOpts,\n McginleyOpts,\n MedianOpts,\n MfiOpts,\n MomentumOpts,\n NetVolumeOpts,\n NviOpts,\n ObvOpts,\n PivotsHighLowOpts,\n PivotsHighLowResult,\n PivotsStandardOpts,\n PivotsStandardResult,\n PmoOpts,\n PmoResult,\n PpoOpts,\n PpoResult,\n PsarOpts,\n PsarResult,\n PviOpts,\n PvoOpts,\n PvoResult,\n PvtOpts,\n RocOpts,\n RsiOpts,\n RvgiOpts,\n RvgiResult,\n RviOpts,\n Series,\n SessionVolumeProfileOpts,\n SessionVolumeProfileResult,\n SmaOpts,\n SmiOpts,\n SmiResult,\n SmmaOpts,\n StdevOpts,\n StochOpts,\n StochResult,\n StochRsiOpts,\n StochRsiResult,\n SupertrendOpts,\n SupertrendResult,\n TemaOpts,\n TrendStrengthIndexOpts,\n TrixOpts,\n TrixResult,\n TsiOpts,\n TsiResult,\n UlcerIndexOpts,\n UltimateOscOpts,\n ValuewhenOpts,\n VisibleRangeVolumeProfileOpts,\n VisibleRangeVolumeProfileResult,\n VolOpts,\n VolatilityStopOpts,\n VolatilityStopResult,\n VortexOpts,\n VortexResult,\n VwapOpts,\n VwmaOpts,\n WilliamsFractalOpts,\n WilliamsFractalResult,\n WilliamsROpts,\n WmaOpts,\n ZigZagOpts,\n ZigZagResult,\n} from \"@invinite-org/chartlang-core\";\n\nimport { adl } from \"./adl.js\";\nimport { adr } from \"./adr.js\";\nimport { adx } from \"./adx.js\";\nimport { alma } from \"./alma.js\";\nimport { anchoredVolumeProfile } from \"./anchoredVolumeProfile.js\";\nimport { anchoredVwap } from \"./anchoredVwap.js\";\nimport { ao } from \"./ao.js\";\nimport { aroon } from \"./aroon.js\";\nimport { aroonOsc } from \"./aroonOsc.js\";\nimport { atr } from \"./atr.js\";\nimport { barssince } from \"./barssince.js\";\nimport { bb } from \"./bb.js\";\nimport { bbPercentB } from \"./bbPercentB.js\";\nimport { bbw } from \"./bbw.js\";\nimport { bop } from \"./bop.js\";\nimport { cci } from \"./cci.js\";\nimport { chaikinOsc } from \"./chaikinOsc.js\";\nimport { chandeKrollStop } from \"./chandeKrollStop.js\";\nimport { chandelier } from \"./chandelier.js\";\nimport { change } from \"./change.js\";\nimport { chop } from \"./chop.js\";\nimport { cmf } from \"./cmf.js\";\nimport { cmo } from \"./cmo.js\";\nimport { connorsRsi } from \"./connorsRsi.js\";\nimport { coppock } from \"./coppock.js\";\nimport { crossover } from \"./crossover.js\";\nimport { crossunder } from \"./crossunder.js\";\nimport { dema } from \"./dema.js\";\nimport { dmi } from \"./dmi.js\";\nimport { donchian } from \"./donchian.js\";\nimport { dpo } from \"./dpo.js\";\nimport { ema } from \"./ema.js\";\nimport { envelope } from \"./envelope.js\";\nimport { eom } from \"./eom.js\";\nimport { fisher } from \"./fisher.js\";\nimport { fixedRangeVolumeProfile } from \"./fixedRangeVolumeProfile.js\";\nimport { highest } from \"./highest.js\";\nimport { historicalVolatility } from \"./historicalVolatility.js\";\nimport { hma } from \"./hma.js\";\nimport { ichimoku } from \"./ichimoku.js\";\nimport { kama } from \"./kama.js\";\nimport { keltner } from \"./keltner.js\";\nimport { klinger } from \"./klinger.js\";\nimport { kst } from \"./kst.js\";\nimport type { ScalarOrSeries } from \"./lib/sourceValue.js\";\nimport { lowest } from \"./lowest.js\";\nimport { lsma } from \"./lsma.js\";\nimport { maRibbon } from \"./maRibbon.js\";\nimport { macd } from \"./macd.js\";\nimport { massIndex } from \"./massIndex.js\";\nimport { mcginley } from \"./mcginley.js\";\nimport { median } from \"./median.js\";\nimport { mfi } from \"./mfi.js\";\nimport { momentum } from \"./momentum.js\";\nimport { netVolume } from \"./netVolume.js\";\nimport { nvi } from \"./nvi.js\";\nimport { nz } from \"./nz.js\";\nimport { obv } from \"./obv.js\";\nimport { pivotsHighLow } from \"./pivotsHighLow.js\";\nimport { pivotsStandard } from \"./pivotsStandard.js\";\nimport { pmo } from \"./pmo.js\";\nimport { ppo } from \"./ppo.js\";\nimport { psar } from \"./psar.js\";\nimport { pvi } from \"./pvi.js\";\nimport { pvo } from \"./pvo.js\";\nimport { pvt } from \"./pvt.js\";\nimport { roc } from \"./roc.js\";\nimport { rsi } from \"./rsi.js\";\nimport { rvgi } from \"./rvgi.js\";\nimport { rvi } from \"./rvi.js\";\nimport { sessionVolumeProfile } from \"./sessionVolumeProfile.js\";\nimport { sma } from \"./sma.js\";\nimport { smi } from \"./smi.js\";\nimport { smma } from \"./smma.js\";\nimport { stdev } from \"./stdev.js\";\nimport { stoch } from \"./stoch.js\";\nimport { stochRsi } from \"./stochRsi.js\";\nimport { supertrend } from \"./supertrend.js\";\nimport { tema } from \"./tema.js\";\nimport { trendStrengthIndex } from \"./trendStrengthIndex.js\";\nimport { trix } from \"./trix.js\";\nimport { tsi } from \"./tsi.js\";\nimport { ulcerIndex } from \"./ulcerIndex.js\";\nimport { ultimateOsc } from \"./ultimateOsc.js\";\nimport { valuewhen } from \"./valuewhen.js\";\nimport { visibleRangeVolumeProfile } from \"./visibleRangeVolumeProfile.js\";\nimport { vol } from \"./vol.js\";\nimport { volatilityStop } from \"./volatilityStop.js\";\nimport { vortex } from \"./vortex.js\";\nimport { vwap } from \"./vwap.js\";\nimport { vwma } from \"./vwma.js\";\nimport { williamsFractal } from \"./williamsFractal.js\";\nimport { williamsR } from \"./williamsR.js\";\nimport { wma } from \"./wma.js\";\nimport { zigZag } from \"./zigZag.js\";\n\n/**\n * The runtime-facing surface of the `ta` namespace. Each method takes\n * a compiler-injected `slotId` as its first argument, then the user-\n * facing arguments core's `TaNamespace` types. The compiler (Task 2)\n * inlines the slot id as a string literal at every callsite so the\n * runtime can look up its per-callsite hidden state in\n * `RuntimeContext.stream.taSlots`. Script authors never see the slot\n * arg — they import `ta` and call `ta.ema(close, 20)`; the bundled\n * output becomes `runtime.ta.ema(\"slot-id\", close, 20)`.\n *\n * @formula N/A — type surface, see per-primitive JSDoc\n * @since 0.1\n * @stable\n * @example\n * // import type { RuntimeTaNamespace } from \"@invinite-org/chartlang-runtime\";\n * // const fn: RuntimeTaNamespace[\"ema\"] = (slotId, src, length) =>\n * // ({ current: NaN, length: 0 }) as never;\n */\nexport type RuntimeTaNamespace = {\n sma(slotId: string, source: ScalarOrSeries, length: number, opts?: SmaOpts): Series<number>;\n ema(slotId: string, source: ScalarOrSeries, length: number, opts?: EmaOpts): Series<number>;\n stdev(slotId: string, source: ScalarOrSeries, length: number, opts?: StdevOpts): Series<number>;\n bb(slotId: string, source: ScalarOrSeries, length: number, opts?: BbOpts): BbResult;\n rsi(slotId: string, source: ScalarOrSeries, length: number, opts?: RsiOpts): Series<number>;\n macd(slotId: string, source: ScalarOrSeries, opts?: MacdOpts): MacdResult;\n atr(slotId: string, length: number, opts?: AtrOpts): Series<number>;\n crossover(\n slotId: string,\n a: ScalarOrSeries,\n b: ScalarOrSeries,\n opts?: CrossoverOpts,\n ): Series<boolean>;\n crossunder(\n slotId: string,\n a: ScalarOrSeries,\n b: ScalarOrSeries,\n opts?: CrossunderOpts,\n ): Series<boolean>;\n nz(value: number, replacement?: number): number;\n highest(\n slotId: string,\n source: ScalarOrSeries,\n length: number,\n opts?: HighestOpts,\n ): Series<number>;\n lowest(\n slotId: string,\n source: ScalarOrSeries,\n length: number,\n opts?: LowestOpts,\n ): Series<number>;\n change(slotId: string, source: ScalarOrSeries, opts?: ChangeOpts): Series<number>;\n valuewhen(\n slotId: string,\n condition: Series<boolean>,\n source: ScalarOrSeries,\n occurrence?: number,\n opts?: ValuewhenOpts,\n ): Series<number>;\n barssince(slotId: string, condition: Series<boolean>, opts?: BarssinceOpts): Series<number>;\n wma(slotId: string, source: ScalarOrSeries, length: number, opts?: WmaOpts): Series<number>;\n vwma(slotId: string, source: ScalarOrSeries, length: number, opts?: VwmaOpts): Series<number>;\n hma(slotId: string, source: ScalarOrSeries, length: number, opts?: HmaOpts): Series<number>;\n smma(slotId: string, source: ScalarOrSeries, length: number, opts?: SmmaOpts): Series<number>;\n dema(slotId: string, source: ScalarOrSeries, length: number, opts?: DemaOpts): Series<number>;\n tema(slotId: string, source: ScalarOrSeries, length: number, opts?: TemaOpts): Series<number>;\n kama(slotId: string, source: ScalarOrSeries, opts?: KamaOpts): Series<number>;\n alma(slotId: string, source: ScalarOrSeries, length: number, opts?: AlmaOpts): Series<number>;\n lsma(slotId: string, source: ScalarOrSeries, length: number, opts?: LsmaOpts): Series<number>;\n mcginley(\n slotId: string,\n source: ScalarOrSeries,\n length: number,\n opts?: McginleyOpts,\n ): Series<number>;\n maRibbon(slotId: string, source: ScalarOrSeries, opts?: MaRibbonOpts): MaRibbonResult;\n ao(slotId: string, opts?: AoOpts): Series<number>;\n cmo(slotId: string, source: ScalarOrSeries, length: number, opts?: CmoOpts): Series<number>;\n momentum(\n slotId: string,\n source: ScalarOrSeries,\n length: number,\n opts?: MomentumOpts,\n ): Series<number>;\n roc(slotId: string, source: ScalarOrSeries, length: number, opts?: RocOpts): Series<number>;\n pmo(slotId: string, source: ScalarOrSeries, opts?: PmoOpts): PmoResult;\n smi(slotId: string, opts?: SmiOpts): SmiResult;\n tsi(slotId: string, source: ScalarOrSeries, opts?: TsiOpts): TsiResult;\n cci(slotId: string, source: ScalarOrSeries, length: number, opts?: CciOpts): Series<number>;\n stoch(slotId: string, opts?: StochOpts): StochResult;\n williamsR(slotId: string, length: number, opts?: WilliamsROpts): Series<number>;\n stochRsi(slotId: string, source: ScalarOrSeries, opts?: StochRsiOpts): StochRsiResult;\n ultimateOsc(slotId: string, opts?: UltimateOscOpts): Series<number>;\n coppock(slotId: string, source: ScalarOrSeries, opts?: CoppockOpts): Series<number>;\n ppo(slotId: string, source: ScalarOrSeries, opts?: PpoOpts): PpoResult;\n dpo(slotId: string, source: ScalarOrSeries, length: number, opts?: DpoOpts): Series<number>;\n connorsRsi(slotId: string, source: ScalarOrSeries, opts?: ConnorsRsiOpts): Series<number>;\n kst(slotId: string, source: ScalarOrSeries, opts?: KstOpts): KstResult;\n fisher(slotId: string, length: number, opts?: FisherOpts): FisherResult;\n klinger(slotId: string, opts?: KlingerOpts): KlingerResult;\n rvgi(slotId: string, opts?: RvgiOpts): RvgiResult;\n aroon(slotId: string, length: number, opts?: AroonOpts): AroonResult;\n aroonOsc(slotId: string, length: number, opts?: AroonOscOpts): Series<number>;\n vol(slotId: string, opts?: VolOpts): Series<number>;\n vwap(slotId: string, opts?: VwapOpts): Series<number>;\n anchoredVwap(slotId: string, anchorTime: number, opts?: AnchoredVwapOpts): Series<number>;\n anchoredVolumeProfile(\n slotId: string,\n opts: AnchoredVolumeProfileOpts,\n ): AnchoredVolumeProfileResult;\n fixedRangeVolumeProfile(\n slotId: string,\n opts: FixedRangeVolumeProfileOpts,\n ): FixedRangeVolumeProfileResult;\n sessionVolumeProfile(\n slotId: string,\n opts?: SessionVolumeProfileOpts,\n ): SessionVolumeProfileResult;\n visibleRangeVolumeProfile(\n slotId: string,\n opts?: VisibleRangeVolumeProfileOpts,\n ): VisibleRangeVolumeProfileResult;\n obv(slotId: string, opts?: ObvOpts): Series<number>;\n adl(slotId: string, opts?: AdlOpts): Series<number>;\n bop(slotId: string, opts?: BopOpts): Series<number>;\n cmf(slotId: string, length: number, opts?: CmfOpts): Series<number>;\n chaikinOsc(slotId: string, opts?: ChaikinOscOpts): Series<number>;\n mfi(slotId: string, length: number, opts?: MfiOpts): Series<number>;\n netVolume(slotId: string, opts?: NetVolumeOpts): Series<number>;\n pvo(slotId: string, opts?: PvoOpts): PvoResult;\n pvt(slotId: string, opts?: PvtOpts): Series<number>;\n eom(slotId: string, length: number, opts?: EomOpts): Series<number>;\n nvi(slotId: string, opts?: NviOpts): Series<number>;\n pvi(slotId: string, opts?: PviOpts): Series<number>;\n bbPercentB(\n slotId: string,\n source: ScalarOrSeries,\n length: number,\n opts?: BbPercentBOpts,\n ): Series<number>;\n bbw(slotId: string, source: ScalarOrSeries, length: number, opts?: BbwOpts): Series<number>;\n donchian(slotId: string, length: number, opts?: DonchianOpts): DonchianResult;\n keltner(slotId: string, opts?: KeltnerOpts): KeltnerResult;\n envelope(slotId: string, source: ScalarOrSeries, opts?: EnvelopeOpts): EnvelopeResult;\n chop(slotId: string, length: number, opts?: ChopOpts): Series<number>;\n median(\n slotId: string,\n source: ScalarOrSeries,\n length: number,\n opts?: MedianOpts,\n ): Series<number>;\n adr(slotId: string, opts?: AdrOpts): Series<number>;\n ulcerIndex(\n slotId: string,\n source: ScalarOrSeries,\n length: number,\n opts?: UlcerIndexOpts,\n ): Series<number>;\n historicalVolatility(\n slotId: string,\n source: ScalarOrSeries,\n length: number,\n opts?: HvOpts,\n ): Series<number>;\n rvi(slotId: string, source: ScalarOrSeries, length: number, opts?: RviOpts): Series<number>;\n massIndex(slotId: string, opts?: MassIndexOpts): Series<number>;\n psar(slotId: string, opts?: PsarOpts): PsarResult;\n supertrend(slotId: string, opts?: SupertrendOpts): SupertrendResult;\n chandelier(slotId: string, opts?: ChandelierOpts): ChandelierResult;\n chandeKrollStop(slotId: string, opts?: ChandeKrollStopOpts): ChandeKrollStopResult;\n williamsFractal(slotId: string, opts?: WilliamsFractalOpts): WilliamsFractalResult;\n zigZag(slotId: string, opts?: ZigZagOpts): ZigZagResult;\n pivotsHighLow(slotId: string, opts?: PivotsHighLowOpts): PivotsHighLowResult;\n pivotsStandard(slotId: string, opts?: PivotsStandardOpts): PivotsStandardResult;\n volatilityStop(slotId: string, opts?: VolatilityStopOpts): VolatilityStopResult;\n adx(slotId: string, length: number, opts?: AdxOpts): Series<number>;\n dmi(slotId: string, length: number, opts?: DmiOpts): DmiResult;\n trix(slotId: string, source: ScalarOrSeries, length: number, opts?: TrixOpts): TrixResult;\n vortex(slotId: string, length: number, opts?: VortexOpts): VortexResult;\n trendStrengthIndex(\n slotId: string,\n source: ScalarOrSeries,\n length: number,\n opts?: TrendStrengthIndexOpts,\n ): Series<number>;\n ichimoku(slotId: string, opts?: IchimokuOpts): IchimokuResult;\n};\n\n/**\n * Frozen registry of every Phase-1 + Phase-2 `ta.*` primitive. Wave-5\n * cardinality grows as each parallel task lands; the final Phase-2\n * count is verified at closeout (Task 30). Phase-1 ships 9; cross-\n * functional Task 5 adds 6; Task 6 adds 4 MA ports (`wma`, `vwma`,\n * `hma`, `smma`); Task 9 adds 3 oscillators; Task 13 adds 4 momentum;\n * Task 15 adds 2 trend.\n *\n * @formula N/A — frozen registry, see per-primitive JSDoc\n * @since 0.1\n * @stable\n * @example\n * // import { TA_REGISTRY } from \"@invinite-org/chartlang-runtime\";\n * // const keys = Object.keys(TA_REGISTRY);\n */\nexport const TA_REGISTRY = Object.freeze({\n sma,\n ema,\n stdev,\n bb,\n rsi,\n macd,\n atr,\n crossover,\n crossunder,\n nz,\n highest,\n lowest,\n change,\n valuewhen,\n barssince,\n wma,\n vwma,\n hma,\n smma,\n dema,\n tema,\n kama,\n alma,\n lsma,\n mcginley,\n maRibbon,\n ao,\n cmo,\n momentum,\n roc,\n pmo,\n smi,\n tsi,\n cci,\n stoch,\n williamsR,\n stochRsi,\n ultimateOsc,\n coppock,\n ppo,\n dpo,\n connorsRsi,\n kst,\n fisher,\n klinger,\n rvgi,\n aroon,\n aroonOsc,\n vol,\n vwap,\n anchoredVwap,\n anchoredVolumeProfile,\n fixedRangeVolumeProfile,\n sessionVolumeProfile,\n visibleRangeVolumeProfile,\n obv,\n adl,\n bop,\n cmf,\n chaikinOsc,\n mfi,\n netVolume,\n pvo,\n pvt,\n eom,\n nvi,\n pvi,\n bbPercentB,\n bbw,\n donchian,\n keltner,\n envelope,\n chop,\n median,\n adr,\n ulcerIndex,\n historicalVolatility,\n rvi,\n massIndex,\n psar,\n supertrend,\n chandelier,\n chandeKrollStop,\n williamsFractal,\n zigZag,\n pivotsHighLow,\n pivotsStandard,\n volatilityStop,\n adx,\n dmi,\n trix,\n vortex,\n trendStrengthIndex,\n ichimoku,\n} as const);\n\n/**\n * Y-domain hint a primitive can advertise. `\"auto\"` is the default —\n * the renderer fits the visible-window data range. `\"fixed\"` pins the\n * range to a `[min, max]` interval (bounded oscillators like Stoch /\n * Williams %R).\n *\n * @formula N/A — metadata type, see consumer renderers\n * @since 0.2\n * @stable\n * @example\n * // const stochYDomain: YDomainSpec = { kind: \"fixed\", min: 0, max: 100 };\n */\nexport type YDomainSpec = Readonly<{ kind: \"auto\" } | { kind: \"fixed\"; min: number; max: number }>;\n\n/**\n * Per-primitive metadata layer the registry surfaces for renderers\n * (pane layout, legend ordering, y-axis scaling). Every field is\n * optional — primitives that don't advertise metadata default to\n * `primarySeriesKey = \"default\"` and `yDomain = { kind: \"auto\" }` in\n * the consumer. Phase-2 Task 9 introduces this surface; future\n * bounded oscillators (`stochRsi`, `ultimateOsc`) populate it\n * verbatim.\n *\n * @formula N/A — metadata type, see consumer renderers\n * @since 0.2\n * @stable\n * @example\n * // const meta: PrimitiveMetadata = {\n * // primarySeriesKey: \"k\",\n * // visibleSeriesKeys: [\"k\", \"d\"],\n * // yDomain: { kind: \"fixed\", min: 0, max: 100 },\n * // };\n */\nexport type PrimitiveMetadata = Readonly<{\n primarySeriesKey?: string;\n visibleSeriesKeys?: ReadonlyArray<string>;\n yDomain?: YDomainSpec;\n}>;\n\n/**\n * Frozen metadata table keyed by `TA_REGISTRY` id. Only primitives\n * with a non-default metadata payload appear. `ta.stoch` records its\n * `[0, 100]` range + `primarySeriesKey: \"k\"` + the visible-series\n * order for the legend. `ta.williamsR` records its `[-100, 0]` range.\n * Phase-1 entries + the cross-functional Task-5 entries are\n * unannotated.\n *\n * @formula N/A — frozen metadata table, see per-primitive `PrimitiveMetadata`\n * @since 0.2\n * @stable\n * @example\n * // import { TA_REGISTRY_METADATA } from \"@invinite-org/chartlang-runtime\";\n * // const stochMeta = TA_REGISTRY_METADATA.stoch;\n */\nexport const TA_REGISTRY_METADATA: Readonly<\n Partial<Record<keyof typeof TA_REGISTRY, PrimitiveMetadata>>\n> = Object.freeze({\n stoch: Object.freeze({\n primarySeriesKey: \"k\",\n visibleSeriesKeys: Object.freeze([\"k\", \"d\"]) as ReadonlyArray<string>,\n yDomain: Object.freeze({ kind: \"fixed\", min: 0, max: 100 } as const),\n }),\n williamsR: Object.freeze({\n yDomain: Object.freeze({ kind: \"fixed\", min: -100, max: 0 } as const),\n }),\n stochRsi: Object.freeze({\n primarySeriesKey: \"k\",\n visibleSeriesKeys: Object.freeze([\"k\", \"d\"]) as ReadonlyArray<string>,\n yDomain: Object.freeze({ kind: \"fixed\", min: 0, max: 100 } as const),\n }),\n ultimateOsc: Object.freeze({\n yDomain: Object.freeze({ kind: \"fixed\", min: 0, max: 100 } as const),\n }),\n ppo: Object.freeze({\n primarySeriesKey: \"ppo\",\n visibleSeriesKeys: Object.freeze([\"ppo\", \"signal\", \"hist\"]) as ReadonlyArray<string>,\n yDomain: Object.freeze({ kind: \"auto\" } as const),\n }),\n pvo: Object.freeze({\n primarySeriesKey: \"pvo\",\n visibleSeriesKeys: Object.freeze([\"pvo\", \"signal\", \"hist\"]) as ReadonlyArray<string>,\n yDomain: Object.freeze({ kind: \"auto\" } as const),\n }),\n sessionVolumeProfile: Object.freeze({\n primarySeriesKey: \"poc\",\n visibleSeriesKeys: Object.freeze([\"poc\", \"valHigh\", \"valLow\"]) as ReadonlyArray<string>,\n yDomain: Object.freeze({ kind: \"auto\" } as const),\n }),\n fixedRangeVolumeProfile: Object.freeze({\n primarySeriesKey: \"poc\",\n visibleSeriesKeys: Object.freeze([\"poc\", \"valHigh\", \"valLow\"]) as ReadonlyArray<string>,\n yDomain: Object.freeze({ kind: \"auto\" } as const),\n }),\n connorsRsi: Object.freeze({\n yDomain: Object.freeze({ kind: \"fixed\", min: 0, max: 100 } as const),\n }),\n pmo: Object.freeze({\n primarySeriesKey: \"pmo\",\n visibleSeriesKeys: Object.freeze([\"pmo\", \"signal\"]) as ReadonlyArray<string>,\n yDomain: Object.freeze({ kind: \"auto\" } as const),\n }),\n smi: Object.freeze({\n primarySeriesKey: \"smi\",\n visibleSeriesKeys: Object.freeze([\"smi\", \"signal\"]) as ReadonlyArray<string>,\n yDomain: Object.freeze({ kind: \"fixed\", min: -100, max: 100 } as const),\n }),\n tsi: Object.freeze({\n primarySeriesKey: \"tsi\",\n visibleSeriesKeys: Object.freeze([\"tsi\", \"signal\"]) as ReadonlyArray<string>,\n yDomain: Object.freeze({ kind: \"auto\" } as const),\n }),\n kst: Object.freeze({\n primarySeriesKey: \"kst\",\n visibleSeriesKeys: Object.freeze([\"kst\", \"signal\"]) as ReadonlyArray<string>,\n yDomain: Object.freeze({ kind: \"auto\" } as const),\n }),\n fisher: Object.freeze({\n primarySeriesKey: \"fisher\",\n visibleSeriesKeys: Object.freeze([\"fisher\", \"trigger\"]) as ReadonlyArray<string>,\n yDomain: Object.freeze({ kind: \"auto\" } as const),\n }),\n klinger: Object.freeze({\n primarySeriesKey: \"klinger\",\n visibleSeriesKeys: Object.freeze([\"klinger\", \"signal\"]) as ReadonlyArray<string>,\n yDomain: Object.freeze({ kind: \"auto\" } as const),\n }),\n rvgi: Object.freeze({\n primarySeriesKey: \"rvgi\",\n visibleSeriesKeys: Object.freeze([\"rvgi\", \"signal\"]) as ReadonlyArray<string>,\n yDomain: Object.freeze({ kind: \"auto\" } as const),\n }),\n anchoredVolumeProfile: Object.freeze({\n primarySeriesKey: \"poc\",\n visibleSeriesKeys: Object.freeze([\"poc\", \"valHigh\", \"valLow\"]) as ReadonlyArray<string>,\n yDomain: Object.freeze({ kind: \"auto\" } as const),\n }),\n aroon: Object.freeze({\n primarySeriesKey: \"up\",\n visibleSeriesKeys: Object.freeze([\"up\", \"down\"]) as ReadonlyArray<string>,\n yDomain: Object.freeze({ kind: \"fixed\", min: 0, max: 100 } as const),\n }),\n aroonOsc: Object.freeze({\n yDomain: Object.freeze({ kind: \"fixed\", min: -100, max: 100 } as const),\n }),\n donchian: Object.freeze({\n primarySeriesKey: \"middle\",\n visibleSeriesKeys: Object.freeze([\"upper\", \"middle\", \"lower\"]) as ReadonlyArray<string>,\n yDomain: Object.freeze({ kind: \"auto\" } as const),\n }),\n keltner: Object.freeze({\n primarySeriesKey: \"middle\",\n visibleSeriesKeys: Object.freeze([\"upper\", \"middle\", \"lower\"]) as ReadonlyArray<string>,\n yDomain: Object.freeze({ kind: \"auto\" } as const),\n }),\n envelope: Object.freeze({\n primarySeriesKey: \"middle\",\n visibleSeriesKeys: Object.freeze([\"upper\", \"middle\", \"lower\"]) as ReadonlyArray<string>,\n yDomain: Object.freeze({ kind: \"auto\" } as const),\n }),\n chop: Object.freeze({\n yDomain: Object.freeze({ kind: \"fixed\", min: 0, max: 100 } as const),\n }),\n psar: Object.freeze({\n primarySeriesKey: \"sar\",\n visibleSeriesKeys: Object.freeze([\"sar\", \"direction\"]) as ReadonlyArray<string>,\n yDomain: Object.freeze({ kind: \"auto\" } as const),\n }),\n supertrend: Object.freeze({\n primarySeriesKey: \"line\",\n visibleSeriesKeys: Object.freeze([\"line\", \"direction\"]) as ReadonlyArray<string>,\n yDomain: Object.freeze({ kind: \"auto\" } as const),\n }),\n chandelier: Object.freeze({\n primarySeriesKey: \"long\",\n visibleSeriesKeys: Object.freeze([\"long\", \"short\"]) as ReadonlyArray<string>,\n yDomain: Object.freeze({ kind: \"auto\" } as const),\n }),\n chandeKrollStop: Object.freeze({\n primarySeriesKey: \"long\",\n visibleSeriesKeys: Object.freeze([\"long\", \"short\"]) as ReadonlyArray<string>,\n yDomain: Object.freeze({ kind: \"auto\" } as const),\n }),\n williamsFractal: Object.freeze({\n primarySeriesKey: \"up\",\n visibleSeriesKeys: Object.freeze([\"up\", \"down\"]) as ReadonlyArray<string>,\n yDomain: Object.freeze({ kind: \"auto\" } as const),\n }),\n zigZag: Object.freeze({\n primarySeriesKey: \"value\",\n visibleSeriesKeys: Object.freeze([\"value\", \"direction\"]) as ReadonlyArray<string>,\n yDomain: Object.freeze({ kind: \"auto\" } as const),\n }),\n pivotsHighLow: Object.freeze({\n primarySeriesKey: \"high\",\n visibleSeriesKeys: Object.freeze([\"high\", \"low\"]) as ReadonlyArray<string>,\n yDomain: Object.freeze({ kind: \"auto\" } as const),\n }),\n pivotsStandard: Object.freeze({\n primarySeriesKey: \"pp\",\n visibleSeriesKeys: Object.freeze([\n \"pp\",\n \"r1\",\n \"s1\",\n \"r2\",\n \"s2\",\n \"r3\",\n \"s3\",\n ]) as ReadonlyArray<string>,\n yDomain: Object.freeze({ kind: \"auto\" } as const),\n }),\n volatilityStop: Object.freeze({\n primarySeriesKey: \"value\",\n visibleSeriesKeys: Object.freeze([\"value\", \"direction\"]) as ReadonlyArray<string>,\n yDomain: Object.freeze({ kind: \"auto\" } as const),\n }),\n maRibbon: Object.freeze({\n primarySeriesKey: \"ma_50\",\n visibleSeriesKeys: Object.freeze([\n \"ma_10\",\n \"ma_20\",\n \"ma_30\",\n \"ma_40\",\n \"ma_50\",\n ]) as ReadonlyArray<string>,\n yDomain: Object.freeze({ kind: \"auto\" } as const),\n }),\n adx: Object.freeze({\n yDomain: Object.freeze({ kind: \"fixed\", min: 0, max: 100 } as const),\n }),\n dmi: Object.freeze({\n primarySeriesKey: \"plusDi\",\n visibleSeriesKeys: Object.freeze([\"plusDi\", \"minusDi\"]) as ReadonlyArray<string>,\n yDomain: Object.freeze({ kind: \"fixed\", min: 0, max: 100 } as const),\n }),\n trix: Object.freeze({\n primarySeriesKey: \"trix\",\n visibleSeriesKeys: Object.freeze([\"trix\", \"signal\"]) as ReadonlyArray<string>,\n yDomain: Object.freeze({ kind: \"auto\" } as const),\n }),\n vortex: Object.freeze({\n primarySeriesKey: \"plus\",\n visibleSeriesKeys: Object.freeze([\"plus\", \"minus\"]) as ReadonlyArray<string>,\n yDomain: Object.freeze({ kind: \"auto\" } as const),\n }),\n trendStrengthIndex: Object.freeze({\n yDomain: Object.freeze({ kind: \"fixed\", min: -1, max: 1 } as const),\n }),\n ichimoku: Object.freeze({\n primarySeriesKey: \"tenkan\",\n visibleSeriesKeys: Object.freeze([\n \"tenkan\",\n \"kijun\",\n \"senkouA\",\n \"senkouB\",\n \"chikou\",\n ]) as ReadonlyArray<string>,\n yDomain: Object.freeze({ kind: \"auto\" } as const),\n }),\n});\n\n/**\n * The script-facing `ta` constant the compiler binds against. Equal\n * by identity to {@link TA_REGISTRY}; typed as the slot-aware\n * {@link RuntimeTaNamespace} so downstream consumers (the host-worker\n * boot, the conformance harness) get the runtime signature.\n *\n * @formula N/A — script-facing namespace, see per-primitive JSDoc\n * @since 0.1\n * @stable\n * @example\n * // import { ta } from \"@invinite-org/chartlang-runtime\";\n * // const out = ta.ema(\"slot-id\", { current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AChB,gBAAgB,EAAE,MAAM;QACxB,iBAAiB,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,QAAQ,CAAC,CAA0B;QAC7E,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,MAAM,EAAW,CAAC;KACpD,CAAC;IACF,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC;QAClB,gBAAgB,EAAE,MAAM;QACxB,iBAAiB,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,OAAO,CAAC,CAA0B;QAC5E,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,MAAM,EAAW,CAAC;KACpD,CAAC;IACF,kBAAkB,EAAE,MAAM,CAAC,MAAM,CAAC;QAC9B,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAW,CAAC;KACtE,CAAC;IACF,QAAQ,EAAE,MAAM,CAAC,MAAM,CAAC;QACpB,gBAAgB,EAAE,QAAQ;QAC1B,iBAAiB,EAAE,MAAM,CAAC,MAAM,CAAC;YAC7B,QAAQ;YACR,OAAO;YACP,SAAS;YACT,SAAS;YACT,QAAQ;SACX,CAA0B;QAC3B,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,MAAM,EAAW,CAAC;KACpD,CAAC;CACL,CAAC,CAAC;AAEH;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,EAAE,GAAuB,WAAW,CAAC","sourcesContent":["// Copyright (c) 2026 Invinite. Licensed under the MIT License.\n// See the LICENSE file in the repo root for full license text.\n\nimport type {\n AdlOpts,\n AdrOpts,\n AdxOpts,\n AlmaOpts,\n AnchoredVolumeProfileOpts,\n AnchoredVolumeProfileResult,\n AnchoredVwapOpts,\n AoOpts,\n AroonOpts,\n AroonOscOpts,\n AroonResult,\n AtrOpts,\n BarssinceOpts,\n BbOpts,\n BbPercentBOpts,\n BbResult,\n BbwOpts,\n BopOpts,\n CciOpts,\n ChaikinOscOpts,\n ChandeKrollStopOpts,\n ChandeKrollStopResult,\n ChandelierOpts,\n ChandelierResult,\n ChangeOpts,\n ChopOpts,\n CmfOpts,\n CmoOpts,\n ConnorsRsiOpts,\n CoppockOpts,\n CrossoverOpts,\n CrossunderOpts,\n DemaOpts,\n DmiOpts,\n DmiResult,\n DonchianOpts,\n DonchianResult,\n DpoOpts,\n EmaOpts,\n EnvelopeOpts,\n EnvelopeResult,\n EomOpts,\n FisherOpts,\n FisherResult,\n FixedRangeVolumeProfileOpts,\n FixedRangeVolumeProfileResult,\n HighestOpts,\n HighestbarsOpts,\n HmaOpts,\n HvOpts,\n IchimokuOpts,\n IchimokuResult,\n KamaOpts,\n KeltnerOpts,\n KeltnerResult,\n KlingerOpts,\n KlingerResult,\n KstOpts,\n KstResult,\n LowestOpts,\n LowestbarsOpts,\n LsmaOpts,\n MaRibbonOpts,\n MaRibbonResult,\n MacdOpts,\n MacdResult,\n MassIndexOpts,\n McginleyOpts,\n MedianOpts,\n MfiOpts,\n MomentumOpts,\n NetVolumeOpts,\n NviOpts,\n ObvOpts,\n PivotsHighLowOpts,\n PivotsHighLowResult,\n PivotsStandardOpts,\n PivotsStandardResult,\n PmoOpts,\n PmoResult,\n PpoOpts,\n PpoResult,\n PsarOpts,\n PsarResult,\n PviOpts,\n PvoOpts,\n PvoResult,\n PvtOpts,\n RocOpts,\n RsiOpts,\n RvgiOpts,\n RvgiResult,\n RviOpts,\n Series,\n SessionVolumeProfileOpts,\n SessionVolumeProfileResult,\n SmaOpts,\n SmiOpts,\n SmiResult,\n SmmaOpts,\n StdevOpts,\n StochOpts,\n StochResult,\n StochRsiOpts,\n StochRsiResult,\n SupertrendOpts,\n SupertrendResult,\n TemaOpts,\n TrendStrengthIndexOpts,\n TrixOpts,\n TrixResult,\n TsiOpts,\n TsiResult,\n UlcerIndexOpts,\n UltimateOscOpts,\n ValuewhenOpts,\n VisibleRangeVolumeProfileOpts,\n VisibleRangeVolumeProfileResult,\n VolOpts,\n VolatilityStopOpts,\n VolatilityStopResult,\n VortexOpts,\n VortexResult,\n VwapOpts,\n VwmaOpts,\n WilliamsFractalOpts,\n WilliamsFractalResult,\n WilliamsROpts,\n WmaOpts,\n ZigZagOpts,\n ZigZagResult,\n} from \"@invinite-org/chartlang-core\";\n\nimport { adl } from \"./adl.js\";\nimport { adr } from \"./adr.js\";\nimport { adx } from \"./adx.js\";\nimport { alma } from \"./alma.js\";\nimport { anchoredVolumeProfile } from \"./anchoredVolumeProfile.js\";\nimport { anchoredVwap } from \"./anchoredVwap.js\";\nimport { ao } from \"./ao.js\";\nimport { aroon } from \"./aroon.js\";\nimport { aroonOsc } from \"./aroonOsc.js\";\nimport { atr } from \"./atr.js\";\nimport { barssince } from \"./barssince.js\";\nimport { bb } from \"./bb.js\";\nimport { bbPercentB } from \"./bbPercentB.js\";\nimport { bbw } from \"./bbw.js\";\nimport { bop } from \"./bop.js\";\nimport { cci } from \"./cci.js\";\nimport { chaikinOsc } from \"./chaikinOsc.js\";\nimport { chandeKrollStop } from \"./chandeKrollStop.js\";\nimport { chandelier } from \"./chandelier.js\";\nimport { change } from \"./change.js\";\nimport { chop } from \"./chop.js\";\nimport { cmf } from \"./cmf.js\";\nimport { cmo } from \"./cmo.js\";\nimport { connorsRsi } from \"./connorsRsi.js\";\nimport { coppock } from \"./coppock.js\";\nimport { crossover } from \"./crossover.js\";\nimport { crossunder } from \"./crossunder.js\";\nimport { dema } from \"./dema.js\";\nimport { dmi } from \"./dmi.js\";\nimport { donchian } from \"./donchian.js\";\nimport { dpo } from \"./dpo.js\";\nimport { ema } from \"./ema.js\";\nimport { envelope } from \"./envelope.js\";\nimport { eom } from \"./eom.js\";\nimport { fisher } from \"./fisher.js\";\nimport { fixedRangeVolumeProfile } from \"./fixedRangeVolumeProfile.js\";\nimport { highest } from \"./highest.js\";\nimport { highestbars } from \"./highestbars.js\";\nimport { historicalVolatility } from \"./historicalVolatility.js\";\nimport { hma } from \"./hma.js\";\nimport { ichimoku } from \"./ichimoku.js\";\nimport { kama } from \"./kama.js\";\nimport { keltner } from \"./keltner.js\";\nimport { klinger } from \"./klinger.js\";\nimport { kst } from \"./kst.js\";\nimport type { ScalarOrSeries } from \"./lib/sourceValue.js\";\nimport { lowest } from \"./lowest.js\";\nimport { lowestbars } from \"./lowestbars.js\";\nimport { lsma } from \"./lsma.js\";\nimport { maRibbon } from \"./maRibbon.js\";\nimport { macd } from \"./macd.js\";\nimport { massIndex } from \"./massIndex.js\";\nimport { mcginley } from \"./mcginley.js\";\nimport { median } from \"./median.js\";\nimport { mfi } from \"./mfi.js\";\nimport { momentum } from \"./momentum.js\";\nimport { netVolume } from \"./netVolume.js\";\nimport { nvi } from \"./nvi.js\";\nimport { nz } from \"./nz.js\";\nimport { obv } from \"./obv.js\";\nimport { pivotsHighLow } from \"./pivotsHighLow.js\";\nimport { pivotsStandard } from \"./pivotsStandard.js\";\nimport { pmo } from \"./pmo.js\";\nimport { ppo } from \"./ppo.js\";\nimport { psar } from \"./psar.js\";\nimport { pvi } from \"./pvi.js\";\nimport { pvo } from \"./pvo.js\";\nimport { pvt } from \"./pvt.js\";\nimport { roc } from \"./roc.js\";\nimport { rsi } from \"./rsi.js\";\nimport { rvgi } from \"./rvgi.js\";\nimport { rvi } from \"./rvi.js\";\nimport { sessionVolumeProfile } from \"./sessionVolumeProfile.js\";\nimport { sma } from \"./sma.js\";\nimport { smi } from \"./smi.js\";\nimport { smma } from \"./smma.js\";\nimport { stdev } from \"./stdev.js\";\nimport { stoch } from \"./stoch.js\";\nimport { stochRsi } from \"./stochRsi.js\";\nimport { supertrend } from \"./supertrend.js\";\nimport { tema } from \"./tema.js\";\nimport { trendStrengthIndex } from \"./trendStrengthIndex.js\";\nimport { trix } from \"./trix.js\";\nimport { tsi } from \"./tsi.js\";\nimport { ulcerIndex } from \"./ulcerIndex.js\";\nimport { ultimateOsc } from \"./ultimateOsc.js\";\nimport { valuewhen } from \"./valuewhen.js\";\nimport { visibleRangeVolumeProfile } from \"./visibleRangeVolumeProfile.js\";\nimport { vol } from \"./vol.js\";\nimport { volatilityStop } from \"./volatilityStop.js\";\nimport { vortex } from \"./vortex.js\";\nimport { vwap } from \"./vwap.js\";\nimport { vwma } from \"./vwma.js\";\nimport { williamsFractal } from \"./williamsFractal.js\";\nimport { williamsR } from \"./williamsR.js\";\nimport { wma } from \"./wma.js\";\nimport { zigZag } from \"./zigZag.js\";\n\n/**\n * The runtime-facing surface of the `ta` namespace. Each method takes\n * a compiler-injected `slotId` as its first argument, then the user-\n * facing arguments core's `TaNamespace` types. The compiler (Task 2)\n * inlines the slot id as a string literal at every callsite so the\n * runtime can look up its per-callsite hidden state in\n * `RuntimeContext.stream.taSlots`. Script authors never see the slot\n * arg — they import `ta` and call `ta.ema(close, 20)`; the bundled\n * output becomes `runtime.ta.ema(\"slot-id\", close, 20)`.\n *\n * @formula N/A — type surface, see per-primitive JSDoc\n * @since 0.1\n * @stable\n * @example\n * // import type { RuntimeTaNamespace } from \"@invinite-org/chartlang-runtime\";\n * // const fn: RuntimeTaNamespace[\"ema\"] = (slotId, src, length) =>\n * // ({ current: NaN, length: 0 }) as never;\n */\nexport type RuntimeTaNamespace = {\n sma(slotId: string, source: ScalarOrSeries, length: number, opts?: SmaOpts): Series<number>;\n ema(slotId: string, source: ScalarOrSeries, length: number, opts?: EmaOpts): Series<number>;\n stdev(slotId: string, source: ScalarOrSeries, length: number, opts?: StdevOpts): Series<number>;\n bb(slotId: string, source: ScalarOrSeries, length: number, opts?: BbOpts): BbResult;\n rsi(slotId: string, source: ScalarOrSeries, length: number, opts?: RsiOpts): Series<number>;\n macd(slotId: string, source: ScalarOrSeries, opts?: MacdOpts): MacdResult;\n atr(slotId: string, length: number, opts?: AtrOpts): Series<number>;\n crossover(\n slotId: string,\n a: ScalarOrSeries,\n b: ScalarOrSeries,\n opts?: CrossoverOpts,\n ): Series<boolean>;\n crossunder(\n slotId: string,\n a: ScalarOrSeries,\n b: ScalarOrSeries,\n opts?: CrossunderOpts,\n ): Series<boolean>;\n nz(value: number, replacement?: number): number;\n highest(\n slotId: string,\n source: ScalarOrSeries,\n length: number,\n opts?: HighestOpts,\n ): Series<number>;\n lowest(\n slotId: string,\n source: ScalarOrSeries,\n length: number,\n opts?: LowestOpts,\n ): Series<number>;\n highestbars(\n slotId: string,\n source: ScalarOrSeries,\n length: number,\n opts?: HighestbarsOpts,\n ): Series<number>;\n lowestbars(\n slotId: string,\n source: ScalarOrSeries,\n length: number,\n opts?: LowestbarsOpts,\n ): Series<number>;\n change(slotId: string, source: ScalarOrSeries, opts?: ChangeOpts): Series<number>;\n valuewhen(\n slotId: string,\n condition: Series<boolean>,\n source: ScalarOrSeries,\n occurrence?: number,\n opts?: ValuewhenOpts,\n ): Series<number>;\n barssince(slotId: string, condition: Series<boolean>, opts?: BarssinceOpts): Series<number>;\n wma(slotId: string, source: ScalarOrSeries, length: number, opts?: WmaOpts): Series<number>;\n vwma(slotId: string, source: ScalarOrSeries, length: number, opts?: VwmaOpts): Series<number>;\n hma(slotId: string, source: ScalarOrSeries, length: number, opts?: HmaOpts): Series<number>;\n smma(slotId: string, source: ScalarOrSeries, length: number, opts?: SmmaOpts): Series<number>;\n dema(slotId: string, source: ScalarOrSeries, length: number, opts?: DemaOpts): Series<number>;\n tema(slotId: string, source: ScalarOrSeries, length: number, opts?: TemaOpts): Series<number>;\n kama(slotId: string, source: ScalarOrSeries, opts?: KamaOpts): Series<number>;\n alma(slotId: string, source: ScalarOrSeries, length: number, opts?: AlmaOpts): Series<number>;\n lsma(slotId: string, source: ScalarOrSeries, length: number, opts?: LsmaOpts): Series<number>;\n mcginley(\n slotId: string,\n source: ScalarOrSeries,\n length: number,\n opts?: McginleyOpts,\n ): Series<number>;\n maRibbon(slotId: string, source: ScalarOrSeries, opts?: MaRibbonOpts): MaRibbonResult;\n ao(slotId: string, opts?: AoOpts): Series<number>;\n cmo(slotId: string, source: ScalarOrSeries, length: number, opts?: CmoOpts): Series<number>;\n momentum(\n slotId: string,\n source: ScalarOrSeries,\n length: number,\n opts?: MomentumOpts,\n ): Series<number>;\n roc(slotId: string, source: ScalarOrSeries, length: number, opts?: RocOpts): Series<number>;\n pmo(slotId: string, source: ScalarOrSeries, opts?: PmoOpts): PmoResult;\n smi(slotId: string, opts?: SmiOpts): SmiResult;\n tsi(slotId: string, source: ScalarOrSeries, opts?: TsiOpts): TsiResult;\n cci(slotId: string, source: ScalarOrSeries, length: number, opts?: CciOpts): Series<number>;\n stoch(slotId: string, opts?: StochOpts): StochResult;\n williamsR(slotId: string, length: number, opts?: WilliamsROpts): Series<number>;\n stochRsi(slotId: string, source: ScalarOrSeries, opts?: StochRsiOpts): StochRsiResult;\n ultimateOsc(slotId: string, opts?: UltimateOscOpts): Series<number>;\n coppock(slotId: string, source: ScalarOrSeries, opts?: CoppockOpts): Series<number>;\n ppo(slotId: string, source: ScalarOrSeries, opts?: PpoOpts): PpoResult;\n dpo(slotId: string, source: ScalarOrSeries, length: number, opts?: DpoOpts): Series<number>;\n connorsRsi(slotId: string, source: ScalarOrSeries, opts?: ConnorsRsiOpts): Series<number>;\n kst(slotId: string, source: ScalarOrSeries, opts?: KstOpts): KstResult;\n fisher(slotId: string, length: number, opts?: FisherOpts): FisherResult;\n klinger(slotId: string, opts?: KlingerOpts): KlingerResult;\n rvgi(slotId: string, opts?: RvgiOpts): RvgiResult;\n aroon(slotId: string, length: number, opts?: AroonOpts): AroonResult;\n aroonOsc(slotId: string, length: number, opts?: AroonOscOpts): Series<number>;\n vol(slotId: string, opts?: VolOpts): Series<number>;\n vwap(slotId: string, opts?: VwapOpts): Series<number>;\n anchoredVwap(slotId: string, anchorTime: number, opts?: AnchoredVwapOpts): Series<number>;\n anchoredVolumeProfile(\n slotId: string,\n opts: AnchoredVolumeProfileOpts,\n ): AnchoredVolumeProfileResult;\n fixedRangeVolumeProfile(\n slotId: string,\n opts: FixedRangeVolumeProfileOpts,\n ): FixedRangeVolumeProfileResult;\n sessionVolumeProfile(\n slotId: string,\n opts?: SessionVolumeProfileOpts,\n ): SessionVolumeProfileResult;\n visibleRangeVolumeProfile(\n slotId: string,\n opts?: VisibleRangeVolumeProfileOpts,\n ): VisibleRangeVolumeProfileResult;\n obv(slotId: string, opts?: ObvOpts): Series<number>;\n adl(slotId: string, opts?: AdlOpts): Series<number>;\n bop(slotId: string, opts?: BopOpts): Series<number>;\n cmf(slotId: string, length: number, opts?: CmfOpts): Series<number>;\n chaikinOsc(slotId: string, opts?: ChaikinOscOpts): Series<number>;\n mfi(slotId: string, length: number, opts?: MfiOpts): Series<number>;\n netVolume(slotId: string, opts?: NetVolumeOpts): Series<number>;\n pvo(slotId: string, opts?: PvoOpts): PvoResult;\n pvt(slotId: string, opts?: PvtOpts): Series<number>;\n eom(slotId: string, length: number, opts?: EomOpts): Series<number>;\n nvi(slotId: string, opts?: NviOpts): Series<number>;\n pvi(slotId: string, opts?: PviOpts): Series<number>;\n bbPercentB(\n slotId: string,\n source: ScalarOrSeries,\n length: number,\n opts?: BbPercentBOpts,\n ): Series<number>;\n bbw(slotId: string, source: ScalarOrSeries, length: number, opts?: BbwOpts): Series<number>;\n donchian(slotId: string, length: number, opts?: DonchianOpts): DonchianResult;\n keltner(slotId: string, opts?: KeltnerOpts): KeltnerResult;\n envelope(slotId: string, source: ScalarOrSeries, opts?: EnvelopeOpts): EnvelopeResult;\n chop(slotId: string, length: number, opts?: ChopOpts): Series<number>;\n median(\n slotId: string,\n source: ScalarOrSeries,\n length: number,\n opts?: MedianOpts,\n ): Series<number>;\n adr(slotId: string, opts?: AdrOpts): Series<number>;\n ulcerIndex(\n slotId: string,\n source: ScalarOrSeries,\n length: number,\n opts?: UlcerIndexOpts,\n ): Series<number>;\n historicalVolatility(\n slotId: string,\n source: ScalarOrSeries,\n length: number,\n opts?: HvOpts,\n ): Series<number>;\n rvi(slotId: string, source: ScalarOrSeries, length: number, opts?: RviOpts): Series<number>;\n massIndex(slotId: string, opts?: MassIndexOpts): Series<number>;\n psar(slotId: string, opts?: PsarOpts): PsarResult;\n supertrend(slotId: string, opts?: SupertrendOpts): SupertrendResult;\n chandelier(slotId: string, opts?: ChandelierOpts): ChandelierResult;\n chandeKrollStop(slotId: string, opts?: ChandeKrollStopOpts): ChandeKrollStopResult;\n williamsFractal(slotId: string, opts?: WilliamsFractalOpts): WilliamsFractalResult;\n zigZag(slotId: string, opts?: ZigZagOpts): ZigZagResult;\n pivotsHighLow(slotId: string, opts?: PivotsHighLowOpts): PivotsHighLowResult;\n pivotsStandard(slotId: string, opts?: PivotsStandardOpts): PivotsStandardResult;\n volatilityStop(slotId: string, opts?: VolatilityStopOpts): VolatilityStopResult;\n adx(slotId: string, length: number, opts?: AdxOpts): Series<number>;\n dmi(slotId: string, length: number, opts?: DmiOpts): DmiResult;\n trix(slotId: string, source: ScalarOrSeries, length: number, opts?: TrixOpts): TrixResult;\n vortex(slotId: string, length: number, opts?: VortexOpts): VortexResult;\n trendStrengthIndex(\n slotId: string,\n source: ScalarOrSeries,\n length: number,\n opts?: TrendStrengthIndexOpts,\n ): Series<number>;\n ichimoku(slotId: string, opts?: IchimokuOpts): IchimokuResult;\n};\n\n/**\n * Frozen registry of every Phase-1 + Phase-2 `ta.*` primitive. Wave-5\n * cardinality grows as each parallel task lands; the final Phase-2\n * count is verified at closeout (Task 30). Phase-1 ships 9; cross-\n * functional Task 5 adds 6; Task 6 adds 4 MA ports (`wma`, `vwma`,\n * `hma`, `smma`); Task 9 adds 3 oscillators; Task 13 adds 4 momentum;\n * Task 15 adds 2 trend.\n *\n * @formula N/A — frozen registry, see per-primitive JSDoc\n * @since 0.1\n * @stable\n * @example\n * // import { TA_REGISTRY } from \"@invinite-org/chartlang-runtime\";\n * // const keys = Object.keys(TA_REGISTRY);\n */\nexport const TA_REGISTRY = Object.freeze({\n sma,\n ema,\n stdev,\n bb,\n rsi,\n macd,\n atr,\n crossover,\n crossunder,\n nz,\n highest,\n lowest,\n highestbars,\n lowestbars,\n change,\n valuewhen,\n barssince,\n wma,\n vwma,\n hma,\n smma,\n dema,\n tema,\n kama,\n alma,\n lsma,\n mcginley,\n maRibbon,\n ao,\n cmo,\n momentum,\n roc,\n pmo,\n smi,\n tsi,\n cci,\n stoch,\n williamsR,\n stochRsi,\n ultimateOsc,\n coppock,\n ppo,\n dpo,\n connorsRsi,\n kst,\n fisher,\n klinger,\n rvgi,\n aroon,\n aroonOsc,\n vol,\n vwap,\n anchoredVwap,\n anchoredVolumeProfile,\n fixedRangeVolumeProfile,\n sessionVolumeProfile,\n visibleRangeVolumeProfile,\n obv,\n adl,\n bop,\n cmf,\n chaikinOsc,\n mfi,\n netVolume,\n pvo,\n pvt,\n eom,\n nvi,\n pvi,\n bbPercentB,\n bbw,\n donchian,\n keltner,\n envelope,\n chop,\n median,\n adr,\n ulcerIndex,\n historicalVolatility,\n rvi,\n massIndex,\n psar,\n supertrend,\n chandelier,\n chandeKrollStop,\n williamsFractal,\n zigZag,\n pivotsHighLow,\n pivotsStandard,\n volatilityStop,\n adx,\n dmi,\n trix,\n vortex,\n trendStrengthIndex,\n ichimoku,\n} as const);\n\n/**\n * Y-domain hint a primitive can advertise. `\"auto\"` is the default —\n * the renderer fits the visible-window data range. `\"fixed\"` pins the\n * range to a `[min, max]` interval (bounded oscillators like Stoch /\n * Williams %R).\n *\n * @formula N/A — metadata type, see consumer renderers\n * @since 0.2\n * @stable\n * @example\n * // const stochYDomain: YDomainSpec = { kind: \"fixed\", min: 0, max: 100 };\n */\nexport type YDomainSpec = Readonly<{ kind: \"auto\" } | { kind: \"fixed\"; min: number; max: number }>;\n\n/**\n * Per-primitive metadata layer the registry surfaces for renderers\n * (pane layout, legend ordering, y-axis scaling). Every field is\n * optional — primitives that don't advertise metadata default to\n * `primarySeriesKey = \"default\"` and `yDomain = { kind: \"auto\" }` in\n * the consumer. Phase-2 Task 9 introduces this surface; future\n * bounded oscillators (`stochRsi`, `ultimateOsc`) populate it\n * verbatim.\n *\n * @formula N/A — metadata type, see consumer renderers\n * @since 0.2\n * @stable\n * @example\n * // const meta: PrimitiveMetadata = {\n * // primarySeriesKey: \"k\",\n * // visibleSeriesKeys: [\"k\", \"d\"],\n * // yDomain: { kind: \"fixed\", min: 0, max: 100 },\n * // };\n */\nexport type PrimitiveMetadata = Readonly<{\n primarySeriesKey?: string;\n visibleSeriesKeys?: ReadonlyArray<string>;\n yDomain?: YDomainSpec;\n}>;\n\n/**\n * Frozen metadata table keyed by `TA_REGISTRY` id. Only primitives\n * with a non-default metadata payload appear. `ta.stoch` records its\n * `[0, 100]` range + `primarySeriesKey: \"k\"` + the visible-series\n * order for the legend. `ta.williamsR` records its `[-100, 0]` range.\n * Phase-1 entries + the cross-functional Task-5 entries are\n * unannotated.\n *\n * @formula N/A — frozen metadata table, see per-primitive `PrimitiveMetadata`\n * @since 0.2\n * @stable\n * @example\n * // import { TA_REGISTRY_METADATA } from \"@invinite-org/chartlang-runtime\";\n * // const stochMeta = TA_REGISTRY_METADATA.stoch;\n */\nexport const TA_REGISTRY_METADATA: Readonly<\n Partial<Record<keyof typeof TA_REGISTRY, PrimitiveMetadata>>\n> = Object.freeze({\n stoch: Object.freeze({\n primarySeriesKey: \"k\",\n visibleSeriesKeys: Object.freeze([\"k\", \"d\"]) as ReadonlyArray<string>,\n yDomain: Object.freeze({ kind: \"fixed\", min: 0, max: 100 } as const),\n }),\n williamsR: Object.freeze({\n yDomain: Object.freeze({ kind: \"fixed\", min: -100, max: 0 } as const),\n }),\n stochRsi: Object.freeze({\n primarySeriesKey: \"k\",\n visibleSeriesKeys: Object.freeze([\"k\", \"d\"]) as ReadonlyArray<string>,\n yDomain: Object.freeze({ kind: \"fixed\", min: 0, max: 100 } as const),\n }),\n ultimateOsc: Object.freeze({\n yDomain: Object.freeze({ kind: \"fixed\", min: 0, max: 100 } as const),\n }),\n ppo: Object.freeze({\n primarySeriesKey: \"ppo\",\n visibleSeriesKeys: Object.freeze([\"ppo\", \"signal\", \"hist\"]) as ReadonlyArray<string>,\n yDomain: Object.freeze({ kind: \"auto\" } as const),\n }),\n pvo: Object.freeze({\n primarySeriesKey: \"pvo\",\n visibleSeriesKeys: Object.freeze([\"pvo\", \"signal\", \"hist\"]) as ReadonlyArray<string>,\n yDomain: Object.freeze({ kind: \"auto\" } as const),\n }),\n sessionVolumeProfile: Object.freeze({\n primarySeriesKey: \"poc\",\n visibleSeriesKeys: Object.freeze([\"poc\", \"valHigh\", \"valLow\"]) as ReadonlyArray<string>,\n yDomain: Object.freeze({ kind: \"auto\" } as const),\n }),\n fixedRangeVolumeProfile: Object.freeze({\n primarySeriesKey: \"poc\",\n visibleSeriesKeys: Object.freeze([\"poc\", \"valHigh\", \"valLow\"]) as ReadonlyArray<string>,\n yDomain: Object.freeze({ kind: \"auto\" } as const),\n }),\n connorsRsi: Object.freeze({\n yDomain: Object.freeze({ kind: \"fixed\", min: 0, max: 100 } as const),\n }),\n pmo: Object.freeze({\n primarySeriesKey: \"pmo\",\n visibleSeriesKeys: Object.freeze([\"pmo\", \"signal\"]) as ReadonlyArray<string>,\n yDomain: Object.freeze({ kind: \"auto\" } as const),\n }),\n smi: Object.freeze({\n primarySeriesKey: \"smi\",\n visibleSeriesKeys: Object.freeze([\"smi\", \"signal\"]) as ReadonlyArray<string>,\n yDomain: Object.freeze({ kind: \"fixed\", min: -100, max: 100 } as const),\n }),\n tsi: Object.freeze({\n primarySeriesKey: \"tsi\",\n visibleSeriesKeys: Object.freeze([\"tsi\", \"signal\"]) as ReadonlyArray<string>,\n yDomain: Object.freeze({ kind: \"auto\" } as const),\n }),\n kst: Object.freeze({\n primarySeriesKey: \"kst\",\n visibleSeriesKeys: Object.freeze([\"kst\", \"signal\"]) as ReadonlyArray<string>,\n yDomain: Object.freeze({ kind: \"auto\" } as const),\n }),\n fisher: Object.freeze({\n primarySeriesKey: \"fisher\",\n visibleSeriesKeys: Object.freeze([\"fisher\", \"trigger\"]) as ReadonlyArray<string>,\n yDomain: Object.freeze({ kind: \"auto\" } as const),\n }),\n klinger: Object.freeze({\n primarySeriesKey: \"klinger\",\n visibleSeriesKeys: Object.freeze([\"klinger\", \"signal\"]) as ReadonlyArray<string>,\n yDomain: Object.freeze({ kind: \"auto\" } as const),\n }),\n rvgi: Object.freeze({\n primarySeriesKey: \"rvgi\",\n visibleSeriesKeys: Object.freeze([\"rvgi\", \"signal\"]) as ReadonlyArray<string>,\n yDomain: Object.freeze({ kind: \"auto\" } as const),\n }),\n anchoredVolumeProfile: Object.freeze({\n primarySeriesKey: \"poc\",\n visibleSeriesKeys: Object.freeze([\"poc\", \"valHigh\", \"valLow\"]) as ReadonlyArray<string>,\n yDomain: Object.freeze({ kind: \"auto\" } as const),\n }),\n aroon: Object.freeze({\n primarySeriesKey: \"up\",\n visibleSeriesKeys: Object.freeze([\"up\", \"down\"]) as ReadonlyArray<string>,\n yDomain: Object.freeze({ kind: \"fixed\", min: 0, max: 100 } as const),\n }),\n aroonOsc: Object.freeze({\n yDomain: Object.freeze({ kind: \"fixed\", min: -100, max: 100 } as const),\n }),\n donchian: Object.freeze({\n primarySeriesKey: \"middle\",\n visibleSeriesKeys: Object.freeze([\"upper\", \"middle\", \"lower\"]) as ReadonlyArray<string>,\n yDomain: Object.freeze({ kind: \"auto\" } as const),\n }),\n keltner: Object.freeze({\n primarySeriesKey: \"middle\",\n visibleSeriesKeys: Object.freeze([\"upper\", \"middle\", \"lower\"]) as ReadonlyArray<string>,\n yDomain: Object.freeze({ kind: \"auto\" } as const),\n }),\n envelope: Object.freeze({\n primarySeriesKey: \"middle\",\n visibleSeriesKeys: Object.freeze([\"upper\", \"middle\", \"lower\"]) as ReadonlyArray<string>,\n yDomain: Object.freeze({ kind: \"auto\" } as const),\n }),\n chop: Object.freeze({\n yDomain: Object.freeze({ kind: \"fixed\", min: 0, max: 100 } as const),\n }),\n psar: Object.freeze({\n primarySeriesKey: \"sar\",\n visibleSeriesKeys: Object.freeze([\"sar\", \"direction\"]) as ReadonlyArray<string>,\n yDomain: Object.freeze({ kind: \"auto\" } as const),\n }),\n supertrend: Object.freeze({\n primarySeriesKey: \"line\",\n visibleSeriesKeys: Object.freeze([\"line\", \"direction\"]) as ReadonlyArray<string>,\n yDomain: Object.freeze({ kind: \"auto\" } as const),\n }),\n chandelier: Object.freeze({\n primarySeriesKey: \"long\",\n visibleSeriesKeys: Object.freeze([\"long\", \"short\"]) as ReadonlyArray<string>,\n yDomain: Object.freeze({ kind: \"auto\" } as const),\n }),\n chandeKrollStop: Object.freeze({\n primarySeriesKey: \"long\",\n visibleSeriesKeys: Object.freeze([\"long\", \"short\"]) as ReadonlyArray<string>,\n yDomain: Object.freeze({ kind: \"auto\" } as const),\n }),\n williamsFractal: Object.freeze({\n primarySeriesKey: \"up\",\n visibleSeriesKeys: Object.freeze([\"up\", \"down\"]) as ReadonlyArray<string>,\n yDomain: Object.freeze({ kind: \"auto\" } as const),\n }),\n zigZag: Object.freeze({\n primarySeriesKey: \"value\",\n visibleSeriesKeys: Object.freeze([\"value\", \"direction\"]) as ReadonlyArray<string>,\n yDomain: Object.freeze({ kind: \"auto\" } as const),\n }),\n pivotsHighLow: Object.freeze({\n primarySeriesKey: \"high\",\n visibleSeriesKeys: Object.freeze([\"high\", \"low\"]) as ReadonlyArray<string>,\n yDomain: Object.freeze({ kind: \"auto\" } as const),\n }),\n pivotsStandard: Object.freeze({\n primarySeriesKey: \"pp\",\n visibleSeriesKeys: Object.freeze([\n \"pp\",\n \"r1\",\n \"s1\",\n \"r2\",\n \"s2\",\n \"r3\",\n \"s3\",\n ]) as ReadonlyArray<string>,\n yDomain: Object.freeze({ kind: \"auto\" } as const),\n }),\n volatilityStop: Object.freeze({\n primarySeriesKey: \"value\",\n visibleSeriesKeys: Object.freeze([\"value\", \"direction\"]) as ReadonlyArray<string>,\n yDomain: Object.freeze({ kind: \"auto\" } as const),\n }),\n maRibbon: Object.freeze({\n primarySeriesKey: \"ma_50\",\n visibleSeriesKeys: Object.freeze([\n \"ma_10\",\n \"ma_20\",\n \"ma_30\",\n \"ma_40\",\n \"ma_50\",\n ]) as ReadonlyArray<string>,\n yDomain: Object.freeze({ kind: \"auto\" } as const),\n }),\n adx: Object.freeze({\n yDomain: Object.freeze({ kind: \"fixed\", min: 0, max: 100 } as const),\n }),\n dmi: Object.freeze({\n primarySeriesKey: \"plusDi\",\n visibleSeriesKeys: Object.freeze([\"plusDi\", \"minusDi\"]) as ReadonlyArray<string>,\n yDomain: Object.freeze({ kind: \"fixed\", min: 0, max: 100 } as const),\n }),\n trix: Object.freeze({\n primarySeriesKey: \"trix\",\n visibleSeriesKeys: Object.freeze([\"trix\", \"signal\"]) as ReadonlyArray<string>,\n yDomain: Object.freeze({ kind: \"auto\" } as const),\n }),\n vortex: Object.freeze({\n primarySeriesKey: \"plus\",\n visibleSeriesKeys: Object.freeze([\"plus\", \"minus\"]) as ReadonlyArray<string>,\n yDomain: Object.freeze({ kind: \"auto\" } as const),\n }),\n trendStrengthIndex: Object.freeze({\n yDomain: Object.freeze({ kind: \"fixed\", min: -1, max: 1 } as const),\n }),\n ichimoku: Object.freeze({\n primarySeriesKey: \"tenkan\",\n visibleSeriesKeys: Object.freeze([\n \"tenkan\",\n \"kijun\",\n \"senkouA\",\n \"senkouB\",\n \"chikou\",\n ]) as ReadonlyArray<string>,\n yDomain: Object.freeze({ kind: \"auto\" } as const),\n }),\n});\n\n/**\n * The script-facing `ta` constant the compiler binds against. Equal\n * by identity to {@link TA_REGISTRY}; typed as the slot-aware\n * {@link RuntimeTaNamespace} so downstream consumers (the host-worker\n * boot, the conformance harness) get the runtime signature.\n *\n * @formula N/A — script-facing namespace, see per-primitive JSDoc\n * @since 0.1\n * @stable\n * @example\n * // import { ta } from \"@invinite-org/chartlang-runtime\";\n * // const out = ta.ema(\"slot-id\", { current: 12 }, 20);\n */\nexport const ta: RuntimeTaNamespace = TA_REGISTRY;\n"]}
package/dist/ta/rsi.d.ts CHANGED
@@ -15,8 +15,9 @@ import { type ScalarOrSeries } from "./lib/sourceValue.js";
15
15
  * @since 0.1
16
16
  * @stable
17
17
  *
18
- * `opts.offset` shifts the returned series so `series.current` reads
19
- * the value `offset` bars ago.
18
+ * `opts.offset` is a presentation display shift carried to the plot
19
+ * emission as `xShift` (`+n` right / future, `−n` left / past); the
20
+ * series value is unshifted.
20
21
  *
21
22
  * @example
22
23
  * // import { ta } from "@invinite-org/chartlang-runtime";
@@ -1 +1 @@
1
- {"version":3,"file":"rsi.d.ts","sourceRoot":"","sources":["../../src/ta/rsi.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AAMpE,OAAO,EAAE,KAAK,cAAc,EAAmB,MAAM,sBAAsB,CAAC;AAsI5E;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,GAAG,CACf,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,cAAc,EACtB,MAAM,EAAE,MAAM,EACd,IAAI,CAAC,EAAE,OAAO,GACf,MAAM,CAAC,MAAM,CAAC,CAchB"}
1
+ {"version":3,"file":"rsi.d.ts","sourceRoot":"","sources":["../../src/ta/rsi.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AAMpE,OAAO,EAAE,KAAK,cAAc,EAAmB,MAAM,sBAAsB,CAAC;AAsI5E;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,GAAG,CACf,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,cAAc,EACtB,MAAM,EAAE,MAAM,EACd,IAAI,CAAC,EAAE,OAAO,GACf,MAAM,CAAC,MAAM,CAAC,CAchB"}
package/dist/ta/rsi.js CHANGED
@@ -138,8 +138,9 @@ function tickValue(slot, src) {
138
138
  * @since 0.1
139
139
  * @stable
140
140
  *
141
- * `opts.offset` shifts the returned series so `series.current` reads
142
- * the value `offset` bars ago.
141
+ * `opts.offset` is a presentation display shift carried to the plot
142
+ * emission as `xShift` (`+n` right / future, `−n` left / past); the
143
+ * series value is unshifted.
143
144
  *
144
145
  * @example
145
146
  * // import { ta } from "@invinite-org/chartlang-runtime";
@@ -1 +1 @@
1
- {"version":3,"file":"rsi.js","sourceRoot":"","sources":["../../src/ta/rsi.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,+DAA+D;AAC/D,EAAE;AACF,sEAAsE;AACtE,mEAAmE;AACnE,qEAAqE;AACrE,gBAAgB;AAChB,qEAAqE;AACrE,4DAA4D;AAC5D,yBAAyB;AAIzB,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,sBAAsB,EAAuB,MAAM,sBAAsB,CAAC;AACnF,OAAO,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AACzE,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAuB,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAoB5E,SAAS,MAAM;IACX,MAAM,GAAG,GAAG,sBAAsB,CAAC,OAAO,CAAC;IAC3C,IAAI,GAAG,KAAK,IAAI,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAC;IACnE,CAAC;IACD,OAAO,GAAG,CAAC;AACf,CAAC;AAED,SAAS,QAAQ,CAAC,MAAc,EAAE,QAAgB;IAC9C,MAAM,SAAS,GAAG,IAAI,iBAAiB,CAAC,QAAQ,CAAC,CAAC;IAClD,OAAO;QACH,IAAI,EAAE,QAAQ;QACd,SAAS;QACT,MAAM,EAAE,cAAc,CAAS,SAAS,CAAC;QACzC,MAAM;QACN,WAAW,EAAE,CAAC;QACd,WAAW,EAAE,CAAC;QACd,SAAS,EAAE,CAAC;QACZ,OAAO,EAAE,MAAM,CAAC,GAAG;QACnB,OAAO,EAAE,MAAM,CAAC,GAAG;QACnB,OAAO,EAAE,MAAM,CAAC,GAAG;QACnB,aAAa,E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CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,UAAU,GAAG,CACf,MAAc,EACd,MAAsB,EACtB,MAAc,EACd,IAAc;IAEd,MAAM,GAAG,GAAG,MAAM,EAAE,CAAC;IACrB,IAAI,IAAI,GAAG,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAwB,CAAC;IACjE,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QACrB,IAAI,GAAG,QAAQ,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;QACzD,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IACzC,CAAC;IACD,MAAM,GAAG,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC;IACpC,IAAI,GAAG,CAAC,MAAM,EAAE,CAAC;QACb,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,SAAS,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,CAAC;IACrD,CAAC;SAAM,CAAC;QACJ,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,UAAU,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,CAAC;IACjD,CAAC;IACD,OAAO,aAAa,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,IAAI,CAAC,CAAC,CAAC;AAClD,CAAC","sourcesContent":["// Copyright (c) 2026 Invinite. Licensed under the MIT License.\n// See the LICENSE file in the repo root for full license text.\n//\n// Ported from invinite/src/components/trading-chart/indicators/rsi.ts\n// (commit d2d1043c1b039f66d2f3674526d303d31cf2f1e0, © Invinite).\n// Re-licensed MIT for chartlang. The math is the reference, the code\n// style is not.\n// Structural choices (callsite-id slot, Series<T> proxy, replaceHead\n// mode) follow chartlang's primitive shape — NOT invinite's\n// IndicatorPlugin shape.\n\nimport type { RsiOpts, Series } from \"@invinite-org/chartlang-core\";\n\nimport { Float64RingBuffer } from \"../ringBuffer.js\";\nimport { ACTIVE_RUNTIME_CONTEXT, type RuntimeContext } from \"../runtimeContext.js\";\nimport { makeSeriesView, makeShiftedSeriesView } from \"../seriesView.js\";\nimport { wilderStep } from \"./lib/wilderSmoothing.js\";\nimport { type ScalarOrSeries, readSourceValue } from \"./lib/sourceValue.js\";\n\ntype RsiSlot = {\n readonly kind: \"ta.rsi\";\n readonly outBuffer: Float64RingBuffer;\n readonly series: Series<number>;\n readonly length: number;\n seedGainSum: number;\n seedLossSum: number;\n /** Number of diffs (= closed bars − 1) seen so far. */\n diffCount: number;\n avgGain: number;\n avgLoss: number;\n prevSrc: number;\n /** Source value as of the prior closed bar — used by tick-mode replay. */\n prevClosedSrc: number;\n /** Per-offset Series-view cache; see `sma.ts` for the convention. */\n readonly shiftedViews: Map<number, Series<number>>;\n};\n\nfunction getCtx(): RuntimeContext {\n const ctx = ACTIVE_RUNTIME_CONTEXT.current;\n if (ctx === null) {\n throw new Error(\"ta.rsi called outside an active script step\");\n }\n return ctx;\n}\n\nfunction initSlot(length: number, capacity: number): RsiSlot {\n const outBuffer = new Float64RingBuffer(capacity);\n return {\n kind: \"ta.rsi\",\n outBuffer,\n series: makeSeriesView<number>(outBuffer),\n length,\n seedGainSum: 0,\n seedLossSum: 0,\n diffCount: 0,\n avgGain: Number.NaN,\n avgLoss: Number.NaN,\n prevSrc: Number.NaN,\n prevClosedSrc: Number.NaN,\n shiftedViews: new Map(),\n };\n}\n\nfunction viewForOffset(slot: RsiSlot, offset: number): Series<number> {\n if (offset === 0) return slot.series;\n let view = slot.shiftedViews.get(offset);\n if (view === undefined) {\n view = makeShiftedSeriesView<number>(slot.outBuffer, offset);\n slot.shiftedViews.set(offset, view);\n }\n return view;\n}\n\nfunction rsiFromAvgs(avgGain: number, avgLoss: number): number {\n if (avgLoss === 0) return 100;\n return 100 - 100 / (1 + avgGain / avgLoss);\n}\n\nfunction closeValue(slot: RsiSlot, src: number): number {\n if (!Number.isFinite(src)) {\n // Skip the diff; hold prior values forward.\n if (Number.isFinite(slot.avgGain) && Number.isFinite(slot.avgLoss)) {\n return rsiFromAvgs(slot.avgGain, slot.avgLoss);\n }\n return Number.NaN;\n }\n if (!Number.isFinite(slot.prevSrc)) {\n slot.prevSrc = src;\n slot.prevClosedSrc = src;\n return Number.NaN;\n }\n const diff = src - slot.prevSrc;\n const gain = diff > 0 ? diff : 0;\n const loss = diff < 0 ? -diff : 0;\n slot.prevClosedSrc = slot.prevSrc;\n slot.prevSrc = src;\n slot.diffCount += 1;\n\n if (slot.diffCount < slot.length) {\n slot.seedGainSum += gain;\n slot.seedLossSum += loss;\n return Number.NaN;\n }\n if (slot.diffCount === slot.length) {\n slot.seedGainSum += gain;\n slot.seedLossSum += loss;\n slot.avgGain = slot.seedGainSum / slot.length;\n slot.avgLoss = slot.seedLossSum / slot.length;\n return rsiFromAvgs(slot.avgGain, slot.avgLoss);\n }\n slot.avgGain = wilderStep(slot.avgGain, gain, slot.length);\n slot.avgLoss = wilderStep(slot.avgLoss, loss, slot.length);\n return rsiFromAvgs(slot.avgGain, slot.avgLoss);\n}\n\nfunction tickValue(slot: RsiSlot, src: number): number {\n if (!Number.isFinite(src) || !Number.isFinite(slot.prevClosedSrc)) {\n if (Number.isFinite(slot.avgGain) && Number.isFinite(slot.avgLoss)) {\n return rsiFromAvgs(slot.avgGain, slot.avgLoss);\n }\n return Number.NaN;\n }\n // Replay the most recent diff using the (frozen) prior closed avgs.\n // We need pre-update avgs: at close we already overwrote `avgGain` /\n // `avgLoss`. So we reverse the Wilder step to recover them.\n if (slot.diffCount < slot.length) {\n // During seeding: simulate the seed completing with this tick.\n const diff = src - slot.prevClosedSrc;\n const gain = diff > 0 ? diff : 0;\n const loss = diff < 0 ? -diff : 0;\n const provisionalCount = slot.diffCount + 1;\n if (provisionalCount < slot.length) return Number.NaN;\n const provGain = (slot.seedGainSum + gain) / slot.length;\n const provLoss = (slot.seedLossSum + loss) / slot.length;\n return rsiFromAvgs(provGain, provLoss);\n }\n // Post-warmup: reverse the most recent Wilder step to get the prior-\n // close avgs, then apply this tick's diff against those.\n const diffClosed = slot.prevSrc - slot.prevClosedSrc;\n const closedGain = diffClosed > 0 ? diffClosed : 0;\n const closedLoss = diffClosed < 0 ? -diffClosed : 0;\n const priorAvgGain = (slot.avgGain * slot.length - closedGain) / (slot.length - 1);\n const priorAvgLoss = (slot.avgLoss * slot.length - closedLoss) / (slot.length - 1);\n const diff = src - slot.prevClosedSrc;\n const gain = diff > 0 ? diff : 0;\n const loss = diff < 0 ? -diff : 0;\n const provGain = wilderStep(priorAvgGain, gain, slot.length);\n const provLoss = wilderStep(priorAvgLoss, loss, slot.length);\n return rsiFromAvgs(provGain, provLoss);\n}\n\n/**\n * Wilder's Relative Strength Index. Output range `[0, 100]`. First\n * `length` bars NaN (no diff for bar 0, then a seed window of\n * `length` diffs). Output is `100 − 100 / (1 + RS)` with\n * `RS = avgGain / avgLoss`; `avgLoss = 0` → RSI = 100.\n *\n * @formula diff[t] = source[t] − source[t − 1] ;\n * seed at bar `length` = simple mean of first `length` diffs ;\n * avgGain[t] = (avgGain[t − 1] · (length − 1) + gain[t]) / length ;\n * same for avgLoss ;\n * RSI = 100 − 100 / (1 + avgGain / avgLoss)\n * @warmup length\n * @since 0.1\n * @stable\n *\n * `opts.offset` shifts the returned series so `series.current` reads\n * the value `offset` bars ago.\n *\n * @example\n * // import { ta } from \"@invinite-org/chartlang-runtime\";\n * // const r = ta.rsi(\"slot\", bar.close, 14);\n * // const head = r.current;\n * // const lagged = ta.rsi(\"slot2\", bar.close, 14, { offset: 5 });\n */\nexport function rsi(\n slotId: string,\n source: ScalarOrSeries,\n length: number,\n opts?: RsiOpts,\n): Series<number> {\n const ctx = getCtx();\n let slot = ctx.stream.taSlots.get(slotId) as RsiSlot | undefined;\n if (slot === undefined) {\n slot = initSlot(length, ctx.stream.ohlcv.close.capacity);\n ctx.stream.taSlots.set(slotId, slot);\n }\n const src = readSourceValue(source);\n if (ctx.isTick) {\n slot.outBuffer.replaceHead(tickValue(slot, src));\n } else {\n slot.outBuffer.append(closeValue(slot, src));\n }\n return viewForOffset(slot, opts?.offset ?? 0);\n}\n"]}
1
+ {"version":3,"file":"rsi.js","sourceRoot":"","sources":["../../src/ta/rsi.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,+DAA+D;AAC/D,EAAE;AACF,sEAAsE;AACtE,mEAAmE;AACnE,qEAAqE;AACrE,gBAAgB;AAChB,qEAAqE;AACrE,4DAA4D;AAC5D,yBAAyB;AAIzB,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,sBAAsB,EAAuB,MAAM,sBAAsB,CAAC;AACnF,OAAO,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AACzE,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAuB,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAoB5E,SAAS,MAAM;IACX,MAAM,GAAG,GAAG,sBAAsB,CAAC,OAAO,CAAC;IAC3C,IAAI,GAAG,KAAK,IAAI,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAC;IACnE,CAAC;IACD,OAAO,GAAG,CAAC;AACf,CAAC;AAED,SAAS,QAAQ,CAAC,MAAc,EAAE,QAAgB;IAC9C,MAAM,SAAS,GAAG,IAAI,iBAAiB,CAAC,QAAQ,CAAC,CAAC;IAClD,OAAO;QACH,IAAI,EAAE,QAAQ;QACd,SAAS;QACT,MAAM,EAAE,cAAc,CAAS,SAAS,CAAC;QACzC,MAAM;QACN,WAAW,EAAE,CAAC;QACd,WAAW,EAAE,CAAC;QACd,SAAS,EAAE,CAAC;QACZ,OAAO,EAAE,MAAM,CAAC,GAAG;QACnB,OAAO,EAAE,MAAM,CAAC,GAAG;QACnB,OAAO,EAAE,MAAM,CAAC,GAAG;QACnB,aAAa,EAAE,MAAM,CAAC,G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;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,UAAU,GAAG,CACf,MAAc,EACd,MAAsB,EACtB,MAAc,EACd,IAAc;IAEd,MAAM,GAAG,GAAG,MAAM,EAAE,CAAC;IACrB,IAAI,IAAI,GAAG,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAwB,CAAC;IACjE,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QACrB,IAAI,GAAG,QAAQ,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;QACzD,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IACzC,CAAC;IACD,MAAM,GAAG,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC;IACpC,IAAI,GAAG,CAAC,MAAM,EAAE,CAAC;QACb,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,SAAS,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,CAAC;IACrD,CAAC;SAAM,CAAC;QACJ,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,UAAU,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,CAAC;IACjD,CAAC;IACD,OAAO,aAAa,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,IAAI,CAAC,CAAC,CAAC;AAClD,CAAC","sourcesContent":["// Copyright (c) 2026 Invinite. Licensed under the MIT License.\n// See the LICENSE file in the repo root for full license text.\n//\n// Ported from invinite/src/components/trading-chart/indicators/rsi.ts\n// (commit d2d1043c1b039f66d2f3674526d303d31cf2f1e0, © Invinite).\n// Re-licensed MIT for chartlang. The math is the reference, the code\n// style is not.\n// Structural choices (callsite-id slot, Series<T> proxy, replaceHead\n// mode) follow chartlang's primitive shape — NOT invinite's\n// IndicatorPlugin shape.\n\nimport type { RsiOpts, Series } from \"@invinite-org/chartlang-core\";\n\nimport { Float64RingBuffer } from \"../ringBuffer.js\";\nimport { ACTIVE_RUNTIME_CONTEXT, type RuntimeContext } from \"../runtimeContext.js\";\nimport { makeSeriesView, makeShiftedSeriesView } from \"../seriesView.js\";\nimport { wilderStep } from \"./lib/wilderSmoothing.js\";\nimport { type ScalarOrSeries, readSourceValue } from \"./lib/sourceValue.js\";\n\ntype RsiSlot = {\n readonly kind: \"ta.rsi\";\n readonly outBuffer: Float64RingBuffer;\n readonly series: Series<number>;\n readonly length: number;\n seedGainSum: number;\n seedLossSum: number;\n /** Number of diffs (= closed bars − 1) seen so far. */\n diffCount: number;\n avgGain: number;\n avgLoss: number;\n prevSrc: number;\n /** Source value as of the prior closed bar — used by tick-mode replay. */\n prevClosedSrc: number;\n /** Per-offset Series-view cache; see `sma.ts` for the convention. */\n readonly shiftedViews: Map<number, Series<number>>;\n};\n\nfunction getCtx(): RuntimeContext {\n const ctx = ACTIVE_RUNTIME_CONTEXT.current;\n if (ctx === null) {\n throw new Error(\"ta.rsi called outside an active script step\");\n }\n return ctx;\n}\n\nfunction initSlot(length: number, capacity: number): RsiSlot {\n const outBuffer = new Float64RingBuffer(capacity);\n return {\n kind: \"ta.rsi\",\n outBuffer,\n series: makeSeriesView<number>(outBuffer),\n length,\n seedGainSum: 0,\n seedLossSum: 0,\n diffCount: 0,\n avgGain: Number.NaN,\n avgLoss: Number.NaN,\n prevSrc: Number.NaN,\n prevClosedSrc: Number.NaN,\n shiftedViews: new Map(),\n };\n}\n\nfunction viewForOffset(slot: RsiSlot, offset: number): Series<number> {\n if (offset === 0) return slot.series;\n let view = slot.shiftedViews.get(offset);\n if (view === undefined) {\n view = makeShiftedSeriesView<number>(slot.outBuffer, offset);\n slot.shiftedViews.set(offset, view);\n }\n return view;\n}\n\nfunction rsiFromAvgs(avgGain: number, avgLoss: number): number {\n if (avgLoss === 0) return 100;\n return 100 - 100 / (1 + avgGain / avgLoss);\n}\n\nfunction closeValue(slot: RsiSlot, src: number): number {\n if (!Number.isFinite(src)) {\n // Skip the diff; hold prior values forward.\n if (Number.isFinite(slot.avgGain) && Number.isFinite(slot.avgLoss)) {\n return rsiFromAvgs(slot.avgGain, slot.avgLoss);\n }\n return Number.NaN;\n }\n if (!Number.isFinite(slot.prevSrc)) {\n slot.prevSrc = src;\n slot.prevClosedSrc = src;\n return Number.NaN;\n }\n const diff = src - slot.prevSrc;\n const gain = diff > 0 ? diff : 0;\n const loss = diff < 0 ? -diff : 0;\n slot.prevClosedSrc = slot.prevSrc;\n slot.prevSrc = src;\n slot.diffCount += 1;\n\n if (slot.diffCount < slot.length) {\n slot.seedGainSum += gain;\n slot.seedLossSum += loss;\n return Number.NaN;\n }\n if (slot.diffCount === slot.length) {\n slot.seedGainSum += gain;\n slot.seedLossSum += loss;\n slot.avgGain = slot.seedGainSum / slot.length;\n slot.avgLoss = slot.seedLossSum / slot.length;\n return rsiFromAvgs(slot.avgGain, slot.avgLoss);\n }\n slot.avgGain = wilderStep(slot.avgGain, gain, slot.length);\n slot.avgLoss = wilderStep(slot.avgLoss, loss, slot.length);\n return rsiFromAvgs(slot.avgGain, slot.avgLoss);\n}\n\nfunction tickValue(slot: RsiSlot, src: number): number {\n if (!Number.isFinite(src) || !Number.isFinite(slot.prevClosedSrc)) {\n if (Number.isFinite(slot.avgGain) && Number.isFinite(slot.avgLoss)) {\n return rsiFromAvgs(slot.avgGain, slot.avgLoss);\n }\n return Number.NaN;\n }\n // Replay the most recent diff using the (frozen) prior closed avgs.\n // We need pre-update avgs: at close we already overwrote `avgGain` /\n // `avgLoss`. So we reverse the Wilder step to recover them.\n if (slot.diffCount < slot.length) {\n // During seeding: simulate the seed completing with this tick.\n const diff = src - slot.prevClosedSrc;\n const gain = diff > 0 ? diff : 0;\n const loss = diff < 0 ? -diff : 0;\n const provisionalCount = slot.diffCount + 1;\n if (provisionalCount < slot.length) return Number.NaN;\n const provGain = (slot.seedGainSum + gain) / slot.length;\n const provLoss = (slot.seedLossSum + loss) / slot.length;\n return rsiFromAvgs(provGain, provLoss);\n }\n // Post-warmup: reverse the most recent Wilder step to get the prior-\n // close avgs, then apply this tick's diff against those.\n const diffClosed = slot.prevSrc - slot.prevClosedSrc;\n const closedGain = diffClosed > 0 ? diffClosed : 0;\n const closedLoss = diffClosed < 0 ? -diffClosed : 0;\n const priorAvgGain = (slot.avgGain * slot.length - closedGain) / (slot.length - 1);\n const priorAvgLoss = (slot.avgLoss * slot.length - closedLoss) / (slot.length - 1);\n const diff = src - slot.prevClosedSrc;\n const gain = diff > 0 ? diff : 0;\n const loss = diff < 0 ? -diff : 0;\n const provGain = wilderStep(priorAvgGain, gain, slot.length);\n const provLoss = wilderStep(priorAvgLoss, loss, slot.length);\n return rsiFromAvgs(provGain, provLoss);\n}\n\n/**\n * Wilder's Relative Strength Index. Output range `[0, 100]`. First\n * `length` bars NaN (no diff for bar 0, then a seed window of\n * `length` diffs). Output is `100 − 100 / (1 + RS)` with\n * `RS = avgGain / avgLoss`; `avgLoss = 0` → RSI = 100.\n *\n * @formula diff[t] = source[t] − source[t − 1] ;\n * seed at bar `length` = simple mean of first `length` diffs ;\n * avgGain[t] = (avgGain[t − 1] · (length − 1) + gain[t]) / length ;\n * same for avgLoss ;\n * RSI = 100 − 100 / (1 + avgGain / avgLoss)\n * @warmup length\n * @since 0.1\n * @stable\n *\n * `opts.offset` is a presentation display shift carried to the plot\n * emission as `xShift` (`+n` right / future, `−n` left / past); the\n * series value is unshifted.\n *\n * @example\n * // import { ta } from \"@invinite-org/chartlang-runtime\";\n * // const r = ta.rsi(\"slot\", bar.close, 14);\n * // const head = r.current;\n * // const lagged = ta.rsi(\"slot2\", bar.close, 14, { offset: 5 });\n */\nexport function rsi(\n slotId: string,\n source: ScalarOrSeries,\n length: number,\n opts?: RsiOpts,\n): Series<number> {\n const ctx = getCtx();\n let slot = ctx.stream.taSlots.get(slotId) as RsiSlot | undefined;\n if (slot === undefined) {\n slot = initSlot(length, ctx.stream.ohlcv.close.capacity);\n ctx.stream.taSlots.set(slotId, slot);\n }\n const src = readSourceValue(source);\n if (ctx.isTick) {\n slot.outBuffer.replaceHead(tickValue(slot, src));\n } else {\n slot.outBuffer.append(closeValue(slot, src));\n }\n return viewForOffset(slot, opts?.offset ?? 0);\n}\n"]}
package/dist/ta/rvi.d.ts CHANGED
@@ -19,8 +19,9 @@ import { type ScalarOrSeries } from "./lib/sourceValue.js";
19
19
  * @since 0.2
20
20
  * @stable
21
21
  *
22
- * `opts.offset` shifts the returned series so `series.current` reads
23
- * the value `offset` bars ago.
22
+ * `opts.offset` is a presentation display shift carried to the plot
23
+ * emission as `xShift` (`+n` right / future, `−n` left / past); the
24
+ * series value is unshifted.
24
25
  *
25
26
  * @example
26
27
  * // import { ta } from "@invinite-org/chartlang-core";
@@ -1 +1 @@
1
- {"version":3,"file":"rvi.d.ts","sourceRoot":"","sources":["../../src/ta/rvi.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AAMpE,OAAO,EAAE,KAAK,cAAc,EAAmB,MAAM,sBAAsB,CAAC;AA8H5E;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,GAAG,CACf,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,cAAc,EACtB,MAAM,EAAE,MAAM,EACd,IAAI,CAAC,EAAE,OAAO,GACf,MAAM,CAAC,MAAM,CAAC,CAoChB"}
1
+ {"version":3,"file":"rvi.d.ts","sourceRoot":"","sources":["../../src/ta/rvi.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AAMpE,OAAO,EAAE,KAAK,cAAc,EAAmB,MAAM,sBAAsB,CAAC;AA8H5E;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,GAAG,CACf,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,cAAc,EACtB,MAAM,EAAE,MAAM,EACd,IAAI,CAAC,EAAE,OAAO,GACf,MAAM,CAAC,MAAM,CAAC,CAoChB"}
package/dist/ta/rvi.js CHANGED
@@ -146,8 +146,9 @@ function rviValue(upEma, downEma) {
146
146
  * @since 0.2
147
147
  * @stable
148
148
  *
149
- * `opts.offset` shifts the returned series so `series.current` reads
150
- * the value `offset` bars ago.
149
+ * `opts.offset` is a presentation display shift carried to the plot
150
+ * emission as `xShift` (`+n` right / future, `−n` left / past); the
151
+ * series value is unshifted.
151
152
  *
152
153
  * @example
153
154
  * // import { ta } from "@invinite-org/chartlang-core";
@@ -1 +1 @@
1
- {"version":3,"file":"rvi.js","sourceRoot":"","sources":["../../src/ta/rvi.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,+DAA+D;AAC/D,EAAE;AACF,sEAAsE;AACtE,mEAAmE;AACnE,qEAAqE;AACrE,gBAAgB;AAChB,qEAAqE;AACrE,4DAA4D;AAC5D,mEAAmE;AACnE,+DAA+D;AAC/D,sDAAsD;AAItD,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,sBAAsB,EAAuB,MAAM,sBAAsB,CAAC;AACnF,OAAO,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AACzE,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAuB,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAe5E,SAAS,MAAM;IACX,MAAM,GAAG,GAAG,sBAAsB,CAAC,OAAO,CAAC;IAC3C,IAAI,GAAG,KAAK,IAAI,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAC;IACnE,CAAC;IACD,OAAO,GAAG,CAAC;AACf,CAAC;AAED,SAAS,QAAQ,CAAC,MAAc,EAAE,QAAgB;IAC9C,MAAM,SAAS,GAAG,IAAI,iBAAiB,CAAC,QAAQ,CAAC,CAAC;IAClD,OAAO;QACH,SAAS;QACT,MAAM,EAAE,cAAc,CAAS,SAAS,CAAC;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ACJ,MAAM,KAAK,GAAG,mBAAmB,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;QAC7C,MAAM,IAAI,GAAG,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC;QAChC,MAAM,EAAE,EAAE,EAAE,IAAI,EAAE,GAAG,QAAQ,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;QAC3C,MAAM,QAAQ,GAAG,GAAG,CAAC,GAAG,MAAM,QAAQ,EAAE,EAAE,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;QACzD,MAAM,UAAU,GAAG,GAAG,CAAC,GAAG,MAAM,UAAU,EAAE,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;QAC/D,MAAM,KAAK,GAAG,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC;YAC9B,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,OAAO,EAAE,UAAU,CAAC,OAAO,CAAC;YAChD,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC;QACjB,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAC7B,IAAI,CAAC,OAAO,GAAG,GAAG,CAAC;IACvB,CAAC;IACD,OAAO,aAAa,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,IAAI,CAAC,CAAC,CAAC;AAClD,CAAC","sourcesContent":["// Copyright (c) 2026 Invinite. Licensed under the MIT License.\n// See the LICENSE file in the repo root for full license text.\n//\n// Ported from invinite/src/components/trading-chart/indicators/rvi.ts\n// (commit 078f41fe2569d659d5aba726da8bcb5d3e2ced02, © Invinite).\n// Re-licensed MIT for chartlang. The math is the reference, the code\n// style is not.\n// Structural choices (callsite-id slot, Series<T> proxy, replaceHead\n// mode) follow chartlang's primitive shape — NOT invinite's\n// IndicatorPlugin shape. The up/down EMA arms compose `ta.ema` via\n// sub-slots `${slotId}/upEma` / `${slotId}/downEma` so the EMA\n// recurrence + warmup semantics flow in by reference.\n\nimport type { RviOpts, Series } from \"@invinite-org/chartlang-core\";\n\nimport { Float64RingBuffer } from \"../ringBuffer.js\";\nimport { ACTIVE_RUNTIME_CONTEXT, type RuntimeContext } from \"../runtimeContext.js\";\nimport { makeSeriesView, makeShiftedSeriesView } from \"../seriesView.js\";\nimport { ema } from \"./ema.js\";\nimport { type ScalarOrSeries, readSourceValue } from \"./lib/sourceValue.js\";\n\ntype RviSlot = {\n readonly outBuffer: Float64RingBuffer;\n readonly series: Series<number>;\n readonly length: number;\n readonly sigmaWindow: Float64RingBuffer;\n sumX: number;\n sumX2: number;\n /** Last closed source value (basis of next bar's up/down classification). */\n prevSrc: number;\n /** Per-offset Series-view cache; see `sma.ts` for the convention. */\n readonly shiftedViews: Map<number, Series<number>>;\n};\n\nfunction getCtx(): RuntimeContext {\n const ctx = ACTIVE_RUNTIME_CONTEXT.current;\n if (ctx === null) {\n throw new Error(\"ta.rvi called outside an active script step\");\n }\n return ctx;\n}\n\nfunction initSlot(length: number, capacity: number): RviSlot {\n const outBuffer = new Float64RingBuffer(capacity);\n return {\n outBuffer,\n series: makeSeriesView<number>(outBuffer),\n length,\n sigmaWindow: new Float64RingBuffer(length),\n sumX: 0,\n sumX2: 0,\n prevSrc: Number.NaN,\n shiftedViews: new Map(),\n };\n}\n\nfunction viewForOffset(slot: RviSlot, offset: number): Series<number> {\n if (offset === 0) return slot.series;\n let view = slot.shiftedViews.get(offset);\n if (view === undefined) {\n view = makeShiftedSeriesView<number>(slot.outBuffer, offset);\n slot.shiftedViews.set(offset, view);\n }\n return view;\n}\n\nfunction windowStdDev(n: number, sumX: number, sumX2: number): number {\n const mean = sumX / n;\n const variance = sumX2 / n - mean * mean;\n return Math.sqrt(Math.max(0, variance));\n}\n\n/** Fold a new source value into the sigma-window running sums. */\nfunction appendToSigmaWindow(slot: RviSlot, src: number): number {\n if (slot.sigmaWindow.length < slot.sigmaWindow.capacity) {\n slot.sigmaWindow.append(src);\n if (Number.isFinite(src)) {\n slot.sumX += src;\n slot.sumX2 += src * src;\n } else {\n slot.sumX = Number.NaN;\n slot.sumX2 = Number.NaN;\n }\n if (slot.sigmaWindow.length < slot.sigmaWindow.capacity) return Number.NaN;\n if (!Number.isFinite(slot.sumX)) return Number.NaN;\n return windowStdDev(slot.sigmaWindow.length, slot.sumX, slot.sumX2);\n }\n const outgoing = slot.sigmaWindow.at(slot.sigmaWindow.length - 1);\n slot.sigmaWindow.append(src);\n if (!Number.isFinite(src)) {\n slot.sumX = Number.NaN;\n slot.sumX2 = Number.NaN;\n return Number.NaN;\n }\n if (!Number.isFinite(slot.sumX) || !Number.isFinite(outgoing)) {\n // A previous NaN poisoned the running sums; rebuild from the\n // live window (NaN values short-circuit the result to NaN).\n let sumX = 0;\n let sumX2 = 0;\n for (let i = 0; i < slot.sigmaWindow.length; i += 1) {\n const v = slot.sigmaWindow.at(i);\n if (!Number.isFinite(v)) {\n slot.sumX = Number.NaN;\n slot.sumX2 = Number.NaN;\n return Number.NaN;\n }\n sumX += v;\n sumX2 += v * v;\n }\n slot.sumX = sumX;\n slot.sumX2 = sumX2;\n } else {\n slot.sumX = slot.sumX - outgoing + src;\n slot.sumX2 = slot.sumX2 - outgoing * outgoing + src * src;\n }\n return windowStdDev(slot.sigmaWindow.length, slot.sumX, slot.sumX2);\n}\n\n/** Sigma at the tick boundary against the closed sigma-window state. */\nfunction tickSigma(slot: RviSlot, src: number): number {\n if (slot.sigmaWindow.length < slot.sigmaWindow.capacity) return Number.NaN;\n if (!Number.isFinite(src)) return Number.NaN;\n const oldestInHead = slot.sigmaWindow.at(0);\n const sumX = slot.sumX - oldestInHead + src;\n const sumX2 = slot.sumX2 - oldestInHead * oldestInHead + src * src;\n return windowStdDev(slot.sigmaWindow.length, sumX, sumX2);\n}\n\nfunction classify(sigma: number, diff: number): { up: number; down: number } {\n if (!Number.isFinite(sigma) || !Number.isFinite(diff)) {\n return { up: Number.NaN, down: Number.NaN };\n }\n return {\n up: diff > 0 ? sigma : 0,\n down: diff < 0 ? sigma : 0,\n };\n}\n\nfunction rviValue(upEma: number, downEma: number): number {\n if (!Number.isFinite(upEma) || !Number.isFinite(downEma)) return Number.NaN;\n const total = upEma + downEma;\n if (total === 0) return Number.NaN;\n return (100 * upEma) / total;\n}\n\n/**\n * Relative Volatility Index — sub-pane oscillator bounded `[0, 100]`.\n * Like RSI but uses rolling stddev of the source instead of absolute\n * close changes for the magnitude, EMA-smoothed per TradingView's\n * `ta.rvi` reference. Composes `ta.ema` via two sub-slots\n * (`${slotId}/upEma`, `${slotId}/downEma`) — a fix to EMA's\n * recurrence flows in for free. NaN when either EMA arm is NaN or\n * when both arms are zero (zero-denominator).\n *\n * @formula sigma[t] = stddev(source[t − length + 1..= t]) ;\n * upRaw[t] = source[t] > source[t − 1] ? sigma[t] : 0 ;\n * downRaw[t] = source[t] < source[t − 1] ? sigma[t] : 0 ;\n * upEma = EMA(length)(upRaw) ;\n * downEma = EMA(length)(downRaw) ;\n * rvi[t] = 100 · upEma[t] / (upEma[t] + downEma[t])\n * @warmup 2 · length − 1\n * @since 0.2\n * @stable\n *\n * `opts.offset` shifts the returned series so `series.current` reads\n * the value `offset` bars ago.\n *\n * @example\n * // import { ta } from \"@invinite-org/chartlang-core\";\n * // const r = ta.rvi(bar.close, 10);\n * // plot(r);\n */\nexport function rvi(\n slotId: string,\n source: ScalarOrSeries,\n length: number,\n opts?: RviOpts,\n): Series<number> {\n const ctx = getCtx();\n let slot = ctx.stream.taSlots.get(slotId) as RviSlot | undefined;\n if (slot === undefined) {\n slot = initSlot(length, ctx.stream.ohlcv.close.capacity);\n ctx.stream.taSlots.set(slotId, slot);\n }\n const src = readSourceValue(source);\n if (ctx.isTick) {\n const sigma = tickSigma(slot, src);\n const diff = src - slot.prevSrc;\n const { up, down } = classify(sigma, diff);\n // Still drive the sub-slot EMAs so their tick-mode head stays\n // consistent with the closed state on a subsequent close.\n const upSeries = ema(`${slotId}/upEma`, up, slot.length);\n const downSeries = ema(`${slotId}/downEma`, down, slot.length);\n // NaN source short-circuits to NaN output regardless of how the\n // EMA arms forward-fill internally — RVI is undefined when the\n // current sample isn't measurable.\n const value = Number.isFinite(src)\n ? rviValue(upSeries.current, downSeries.current)\n : Number.NaN;\n slot.outBuffer.replaceHead(value);\n } else {\n const sigma = appendToSigmaWindow(slot, src);\n const diff = src - slot.prevSrc;\n const { up, down } = classify(sigma, diff);\n const upSeries = ema(`${slotId}/upEma`, up, slot.length);\n const downSeries = ema(`${slotId}/downEma`, down, slot.length);\n const value = Number.isFinite(src)\n ? rviValue(upSeries.current, downSeries.current)\n : Number.NaN;\n slot.outBuffer.append(value);\n slot.prevSrc = src;\n }\n return viewForOffset(slot, opts?.offset ?? 0);\n}\n"]}
1
+ {"version":3,"file":"rvi.js","sourceRoot":"","sources":["../../src/ta/rvi.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,+DAA+D;AAC/D,EAAE;AACF,sEAAsE;AACtE,mEAAmE;AACnE,qEAAqE;AACrE,gBAAgB;AAChB,qEAAqE;AACrE,4DAA4D;AAC5D,mEAAmE;AACnE,+DAA+D;AAC/D,sDAAsD;AAItD,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,sBAAsB,EAAuB,MAAM,sBAAsB,CAAC;AACnF,OAAO,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AACzE,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAuB,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAe5E,SAAS,MAAM;IACX,MAAM,GAAG,GAAG,sBAAsB,CAAC,OAAO,CAAC;IAC3C,IAAI,GAAG,KAAK,IAAI,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAC;IACnE,CAAC;IACD,OAAO,GAAG,CAAC;AACf,CAAC;AAED,SAAS,QAAQ,CAAC,MAAc,EAAE,QAAgB;IAC9C,MAAM,SAAS,GAAG,IAAI,iBAAiB,CAAC,QAAQ,CAAC,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AC,SAAS,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;IACtC,CAAC;SAAM,CAAC;QACJ,MAAM,KAAK,GAAG,mBAAmB,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;QAC7C,MAAM,IAAI,GAAG,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC;QAChC,MAAM,EAAE,EAAE,EAAE,IAAI,EAAE,GAAG,QAAQ,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;QAC3C,MAAM,QAAQ,GAAG,GAAG,CAAC,GAAG,MAAM,QAAQ,EAAE,EAAE,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;QACzD,MAAM,UAAU,GAAG,GAAG,CAAC,GAAG,MAAM,UAAU,EAAE,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;QAC/D,MAAM,KAAK,GAAG,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC;YAC9B,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,OAAO,EAAE,UAAU,CAAC,OAAO,CAAC;YAChD,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC;QACjB,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAC7B,IAAI,CAAC,OAAO,GAAG,GAAG,CAAC;IACvB,CAAC;IACD,OAAO,aAAa,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,IAAI,CAAC,CAAC,CAAC;AAClD,CAAC","sourcesContent":["// Copyright (c) 2026 Invinite. Licensed under the MIT License.\n// See the LICENSE file in the repo root for full license text.\n//\n// Ported from invinite/src/components/trading-chart/indicators/rvi.ts\n// (commit 078f41fe2569d659d5aba726da8bcb5d3e2ced02, © Invinite).\n// Re-licensed MIT for chartlang. The math is the reference, the code\n// style is not.\n// Structural choices (callsite-id slot, Series<T> proxy, replaceHead\n// mode) follow chartlang's primitive shape — NOT invinite's\n// IndicatorPlugin shape. The up/down EMA arms compose `ta.ema` via\n// sub-slots `${slotId}/upEma` / `${slotId}/downEma` so the EMA\n// recurrence + warmup semantics flow in by reference.\n\nimport type { RviOpts, Series } from \"@invinite-org/chartlang-core\";\n\nimport { Float64RingBuffer } from \"../ringBuffer.js\";\nimport { ACTIVE_RUNTIME_CONTEXT, type RuntimeContext } from \"../runtimeContext.js\";\nimport { makeSeriesView, makeShiftedSeriesView } from \"../seriesView.js\";\nimport { ema } from \"./ema.js\";\nimport { type ScalarOrSeries, readSourceValue } from \"./lib/sourceValue.js\";\n\ntype RviSlot = {\n readonly outBuffer: Float64RingBuffer;\n readonly series: Series<number>;\n readonly length: number;\n readonly sigmaWindow: Float64RingBuffer;\n sumX: number;\n sumX2: number;\n /** Last closed source value (basis of next bar's up/down classification). */\n prevSrc: number;\n /** Per-offset Series-view cache; see `sma.ts` for the convention. */\n readonly shiftedViews: Map<number, Series<number>>;\n};\n\nfunction getCtx(): RuntimeContext {\n const ctx = ACTIVE_RUNTIME_CONTEXT.current;\n if (ctx === null) {\n throw new Error(\"ta.rvi called outside an active script step\");\n }\n return ctx;\n}\n\nfunction initSlot(length: number, capacity: number): RviSlot {\n const outBuffer = new Float64RingBuffer(capacity);\n return {\n outBuffer,\n series: makeSeriesView<number>(outBuffer),\n length,\n sigmaWindow: new Float64RingBuffer(length),\n sumX: 0,\n sumX2: 0,\n prevSrc: Number.NaN,\n shiftedViews: new Map(),\n };\n}\n\nfunction viewForOffset(slot: RviSlot, offset: number): Series<number> {\n if (offset === 0) return slot.series;\n let view = slot.shiftedViews.get(offset);\n if (view === undefined) {\n view = makeShiftedSeriesView<number>(slot.outBuffer, offset);\n slot.shiftedViews.set(offset, view);\n }\n return view;\n}\n\nfunction windowStdDev(n: number, sumX: number, sumX2: number): number {\n const mean = sumX / n;\n const variance = sumX2 / n - mean * mean;\n return Math.sqrt(Math.max(0, variance));\n}\n\n/** Fold a new source value into the sigma-window running sums. */\nfunction appendToSigmaWindow(slot: RviSlot, src: number): number {\n if (slot.sigmaWindow.length < slot.sigmaWindow.capacity) {\n slot.sigmaWindow.append(src);\n if (Number.isFinite(src)) {\n slot.sumX += src;\n slot.sumX2 += src * src;\n } else {\n slot.sumX = Number.NaN;\n slot.sumX2 = Number.NaN;\n }\n if (slot.sigmaWindow.length < slot.sigmaWindow.capacity) return Number.NaN;\n if (!Number.isFinite(slot.sumX)) return Number.NaN;\n return windowStdDev(slot.sigmaWindow.length, slot.sumX, slot.sumX2);\n }\n const outgoing = slot.sigmaWindow.at(slot.sigmaWindow.length - 1);\n slot.sigmaWindow.append(src);\n if (!Number.isFinite(src)) {\n slot.sumX = Number.NaN;\n slot.sumX2 = Number.NaN;\n return Number.NaN;\n }\n if (!Number.isFinite(slot.sumX) || !Number.isFinite(outgoing)) {\n // A previous NaN poisoned the running sums; rebuild from the\n // live window (NaN values short-circuit the result to NaN).\n let sumX = 0;\n let sumX2 = 0;\n for (let i = 0; i < slot.sigmaWindow.length; i += 1) {\n const v = slot.sigmaWindow.at(i);\n if (!Number.isFinite(v)) {\n slot.sumX = Number.NaN;\n slot.sumX2 = Number.NaN;\n return Number.NaN;\n }\n sumX += v;\n sumX2 += v * v;\n }\n slot.sumX = sumX;\n slot.sumX2 = sumX2;\n } else {\n slot.sumX = slot.sumX - outgoing + src;\n slot.sumX2 = slot.sumX2 - outgoing * outgoing + src * src;\n }\n return windowStdDev(slot.sigmaWindow.length, slot.sumX, slot.sumX2);\n}\n\n/** Sigma at the tick boundary against the closed sigma-window state. */\nfunction tickSigma(slot: RviSlot, src: number): number {\n if (slot.sigmaWindow.length < slot.sigmaWindow.capacity) return Number.NaN;\n if (!Number.isFinite(src)) return Number.NaN;\n const oldestInHead = slot.sigmaWindow.at(0);\n const sumX = slot.sumX - oldestInHead + src;\n const sumX2 = slot.sumX2 - oldestInHead * oldestInHead + src * src;\n return windowStdDev(slot.sigmaWindow.length, sumX, sumX2);\n}\n\nfunction classify(sigma: number, diff: number): { up: number; down: number } {\n if (!Number.isFinite(sigma) || !Number.isFinite(diff)) {\n return { up: Number.NaN, down: Number.NaN };\n }\n return {\n up: diff > 0 ? sigma : 0,\n down: diff < 0 ? sigma : 0,\n };\n}\n\nfunction rviValue(upEma: number, downEma: number): number {\n if (!Number.isFinite(upEma) || !Number.isFinite(downEma)) return Number.NaN;\n const total = upEma + downEma;\n if (total === 0) return Number.NaN;\n return (100 * upEma) / total;\n}\n\n/**\n * Relative Volatility Index — sub-pane oscillator bounded `[0, 100]`.\n * Like RSI but uses rolling stddev of the source instead of absolute\n * close changes for the magnitude, EMA-smoothed per TradingView's\n * `ta.rvi` reference. Composes `ta.ema` via two sub-slots\n * (`${slotId}/upEma`, `${slotId}/downEma`) — a fix to EMA's\n * recurrence flows in for free. NaN when either EMA arm is NaN or\n * when both arms are zero (zero-denominator).\n *\n * @formula sigma[t] = stddev(source[t − length + 1..= t]) ;\n * upRaw[t] = source[t] > source[t − 1] ? sigma[t] : 0 ;\n * downRaw[t] = source[t] < source[t − 1] ? sigma[t] : 0 ;\n * upEma = EMA(length)(upRaw) ;\n * downEma = EMA(length)(downRaw) ;\n * rvi[t] = 100 · upEma[t] / (upEma[t] + downEma[t])\n * @warmup 2 · length − 1\n * @since 0.2\n * @stable\n *\n * `opts.offset` is a presentation display shift carried to the plot\n * emission as `xShift` (`+n` right / future, `−n` left / past); the\n * series value is unshifted.\n *\n * @example\n * // import { ta } from \"@invinite-org/chartlang-core\";\n * // const r = ta.rvi(bar.close, 10);\n * // plot(r);\n */\nexport function rvi(\n slotId: string,\n source: ScalarOrSeries,\n length: number,\n opts?: RviOpts,\n): Series<number> {\n const ctx = getCtx();\n let slot = ctx.stream.taSlots.get(slotId) as RviSlot | undefined;\n if (slot === undefined) {\n slot = initSlot(length, ctx.stream.ohlcv.close.capacity);\n ctx.stream.taSlots.set(slotId, slot);\n }\n const src = readSourceValue(source);\n if (ctx.isTick) {\n const sigma = tickSigma(slot, src);\n const diff = src - slot.prevSrc;\n const { up, down } = classify(sigma, diff);\n // Still drive the sub-slot EMAs so their tick-mode head stays\n // consistent with the closed state on a subsequent close.\n const upSeries = ema(`${slotId}/upEma`, up, slot.length);\n const downSeries = ema(`${slotId}/downEma`, down, slot.length);\n // NaN source short-circuits to NaN output regardless of how the\n // EMA arms forward-fill internally — RVI is undefined when the\n // current sample isn't measurable.\n const value = Number.isFinite(src)\n ? rviValue(upSeries.current, downSeries.current)\n : Number.NaN;\n slot.outBuffer.replaceHead(value);\n } else {\n const sigma = appendToSigmaWindow(slot, src);\n const diff = src - slot.prevSrc;\n const { up, down } = classify(sigma, diff);\n const upSeries = ema(`${slotId}/upEma`, up, slot.length);\n const downSeries = ema(`${slotId}/downEma`, down, slot.length);\n const value = Number.isFinite(src)\n ? rviValue(upSeries.current, downSeries.current)\n : Number.NaN;\n slot.outBuffer.append(value);\n slot.prevSrc = src;\n }\n return viewForOffset(slot, opts?.offset ?? 0);\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"sessionVolumeProfile.d.ts","sourceRoot":"","sources":["../../src/ta/sessionVolumeProfile.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EACR,wBAAwB,EACxB,0BAA0B,EAC7B,MAAM,8BAA8B,CAAC;AAwJtC;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,oBAAoB,CAChC,MAAM,EAAE,MAAM,EACd,IAAI,CAAC,EAAE,wBAAwB,GAChC,0BAA0B,CAwB5B"}
1
+ {"version":3,"file":"sessionVolumeProfile.d.ts","sourceRoot":"","sources":["../../src/ta/sessionVolumeProfile.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EACR,wBAAwB,EACxB,0BAA0B,EAC7B,MAAM,8BAA8B,CAAC;AAwItC;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,oBAAoB,CAChC,MAAM,EAAE,MAAM,EACd,IAAI,CAAC,EAAE,wBAAwB,GAChC,0BAA0B,CAwB5B"}
@@ -6,6 +6,7 @@
6
6
  import { pushDiagnostic } from "../emit/index.js";
7
7
  import { ACTIVE_RUNTIME_CONTEXT } from "../runtimeContext.js";
8
8
  import { makeSeriesView, makeShiftedSeriesView } from "../seriesView.js";
9
+ import { parseSessionWindowMinutes } from "../time-accessors/sessionWindow.js";
9
10
  import { commitVolumeProfileSnapshot, createVolumeProfileCore, emitVolumeProfileHistogram, resolveVolumeProfileSnapshot, volumeProfileConfigFromOpts, } from "./lib/volume-profile/index.js";
10
11
  const DAY_MS = 86_400_000;
11
12
  function getCtx() {
@@ -51,23 +52,6 @@ function resultForOffset(slot, offset) {
51
52
  function utcDayStart(time) {
52
53
  return Math.floor(time / DAY_MS) * DAY_MS;
53
54
  }
54
- function parseSessionWindowMinutes(session) {
55
- const match = /^(\d{1,2})(?::?(\d{2}))?\s*-\s*(\d{1,2})(?::?(\d{2}))?$/.exec(session.trim());
56
- if (match === null)
57
- return null;
58
- const startHour = Number(match[1]);
59
- const startMinute = match[2] === undefined ? 0 : Number(match[2]);
60
- const endHour = Number(match[3]);
61
- const endMinute = match[4] === undefined ? 0 : Number(match[4]);
62
- if (startHour < 0 || startHour > 23 || startMinute < 0 || startMinute > 59)
63
- return null;
64
- if (endHour < 0 || endHour > 23 || endMinute < 0 || endMinute > 59)
65
- return null;
66
- return {
67
- startMinutes: startHour * 60 + startMinute,
68
- endMinutes: endHour * 60 + endMinute,
69
- };
70
- }
71
55
  function sessionBoundaryFromDescriptor(time, session) {
72
56
  const parsed = parseSessionWindowMinutes(session);
73
57
  if (parsed === null)
@@ -1 +1 @@
1
- {"version":3,"file":"sessionVolumeProfile.js","sourceRoot":"","sources":["../../src/ta/sessionVolumeProfile.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,4FAA4F;AAC5F,gDAAgD;AAChD,qEAAqE;AACrE,iEAAiE;AAOjE,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,sBAAsB,EAAuB,MAAM,sBAAsB,CAAC;AACnF,OAAO,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AACzE,OAAO,EAGH,2BAA2B,E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,QAAQ,CAAC,OAAO,CACnB,CAAC;IACF,OAAO,eAAe,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,IAAI,CAAC,CAAC,CAAC;AACpD,CAAC","sourcesContent":["// Copyright (c) 2026 Invinite. Licensed under the MIT License.\n// Ported from ../invinite/src/components/trading-chart/indicators/session-volume-profile.ts\n// @ 3234c8c0c3f9880d9d1e3a3ee63ebd55ddd535f4.\n// Translated, not transcribed — Series<T> shape, opts.offset, JSDoc.\n// See packages/runtime/src/ta/CLAUDE.md for the port convention.\n\nimport type {\n SessionVolumeProfileOpts,\n SessionVolumeProfileResult,\n} from \"@invinite-org/chartlang-core\";\n\nimport { pushDiagnostic } from \"../emit/index.js\";\nimport { ACTIVE_RUNTIME_CONTEXT, type RuntimeContext } from \"../runtimeContext.js\";\nimport { makeSeriesView, makeShiftedSeriesView } from \"../seriesView.js\";\nimport {\n type VolumeProfileBar,\n type VolumeProfileCore,\n commitVolumeProfileSnapshot,\n createVolumeProfileCore,\n emitVolumeProfileHistogram,\n resolveVolumeProfileSnapshot,\n volumeProfileConfigFromOpts,\n} from \"./lib/volume-profile/index.js\";\n\nconst DAY_MS = 86_400_000;\n\ntype SessionVolumeProfileSlot = VolumeProfileCore & {\n readonly result: SessionVolumeProfileResult;\n readonly shiftedResults: Map<number, SessionVolumeProfileResult>;\n};\n\ntype MutableSessionVolumeProfileSlot = Omit<SessionVolumeProfileSlot, \"result\"> & {\n result: SessionVolumeProfileResult;\n};\n\nfunction getCtx(): RuntimeContext {\n const ctx = ACTIVE_RUNTIME_CONTEXT.current;\n if (ctx === null) {\n throw new Error(\"ta.sessionVolumeProfile called outside an active script step\");\n }\n return ctx;\n}\n\nfunction initSlot(capacity: number): SessionVolumeProfileSlot {\n const core = createVolumeProfileCore(capacity);\n const slot: MutableSessionVolumeProfileSlot = {\n ...core,\n result: Object.freeze({\n get buckets() {\n return slot.buckets;\n },\n poc: makeSeriesView<number>(core.pocBuffer),\n valHigh: makeSeriesView<number>(core.valHighBuffer),\n valLow: makeSeriesView<number>(core.valLowBuffer),\n }),\n shiftedResults: new Map(),\n };\n return slot;\n}\n\nfunction resultForOffset(\n slot: SessionVolumeProfileSlot,\n offset: number,\n): SessionVolumeProfileResult {\n if (offset === 0) return slot.result;\n let cached = slot.shiftedResults.get(offset);\n if (cached === undefined) {\n cached = Object.freeze({\n get buckets() {\n return slot.buckets;\n },\n poc: makeShiftedSeriesView<number>(slot.pocBuffer, offset),\n valHigh: makeShiftedSeriesView<number>(slot.valHighBuffer, offset),\n valLow: makeShiftedSeriesView<number>(slot.valLowBuffer, offset),\n });\n slot.shiftedResults.set(offset, cached);\n }\n return cached;\n}\n\nfunction utcDayStart(time: number): number {\n return Math.floor(time / DAY_MS) * DAY_MS;\n}\n\nfunction parseSessionWindowMinutes(\n session: string,\n): { startMinutes: number; endMinutes: number } | null {\n const match = /^(\\d{1,2})(?::?(\\d{2}))?\\s*-\\s*(\\d{1,2})(?::?(\\d{2}))?$/.exec(session.trim());\n if (match === null) return null;\n const startHour = Number(match[1]);\n const startMinute = match[2] === undefined ? 0 : Number(match[2]);\n const endHour = Number(match[3]);\n const endMinute = match[4] === undefined ? 0 : Number(match[4]);\n if (startHour < 0 || startHour > 23 || startMinute < 0 || startMinute > 59) return null;\n if (endHour < 0 || endHour > 23 || endMinute < 0 || endMinute > 59) return null;\n return {\n startMinutes: startHour * 60 + startMinute,\n endMinutes: endHour * 60 + endMinute,\n };\n}\n\nfunction sessionBoundaryFromDescriptor(time: number, session: string): number | null {\n const parsed = parseSessionWindowMinutes(session);\n if (parsed === null) return null;\n const dayStart = utcDayStart(time);\n const boundary = dayStart + parsed.startMinutes * 60_000;\n return time >= boundary ? boundary : boundary - DAY_MS;\n}\n\nfunction diagnoseMissingSession(ctx: RuntimeContext, slotId: string): void {\n const key = `session-info-missing|${slotId}`;\n if (ctx.diagnosedRequestKeys.has(key)) return;\n ctx.diagnosedRequestKeys.add(key);\n pushDiagnostic(ctx.emissions, {\n kind: \"diagnostic\",\n severity: \"warning\",\n code: \"session-info-missing\",\n message:\n \"Adapter did not provide syminfo.session; ta.sessionVolumeProfile used UTC-day boundaries.\",\n slotId,\n bar: ctx.barIndex(),\n });\n}\n\nfunction resolveSessionStart(\n ctx: RuntimeContext,\n slotId: string,\n opts: SessionVolumeProfileOpts | undefined,\n): number {\n if (opts?.sessionStart !== undefined) return opts.sessionStart;\n const session = ctx.views.syminfo.session;\n if (!ctx.capabilities.symInfoFields.has(\"session\") || session === \"\") {\n diagnoseMissingSession(ctx, slotId);\n return utcDayStart(ctx.stream.bar.time);\n }\n const boundary = sessionBoundaryFromDescriptor(ctx.stream.bar.time, session);\n if (boundary === null) {\n diagnoseMissingSession(ctx, slotId);\n return utcDayStart(ctx.stream.bar.time);\n }\n return boundary;\n}\n\nfunction collectBars(ctx: RuntimeContext, sessionStart: number): ReadonlyArray<VolumeProfileBar> {\n const { ohlcv } = ctx.stream;\n const bars: VolumeProfileBar[] = [];\n for (let lookback = ohlcv.close.length - 1; lookback >= 0; lookback -= 1) {\n const time = ohlcv.time.at(lookback);\n if (time <= sessionStart) continue;\n bars.push({\n close: ohlcv.close.at(lookback),\n high: ohlcv.high.at(lookback),\n low: ohlcv.low.at(lookback),\n open: ohlcv.open.at(lookback),\n time,\n volume: ohlcv.volume.at(lookback),\n });\n }\n return bars;\n}\n\n/**\n * Session Volume Profile — bucketizes the current session's volume\n * by price, resetting when `bar.time` crosses the active session\n * boundary.\n *\n * @formula Port of invinite session-vp: find the current session\n * window, bucket volume by price, then derive POC / value-\n * area high / value-area low via the shared volume-profile\n * pipeline.\n * @anchors `syminfo.session` descriptor, or `opts.sessionStart`\n * override when provided.\n * @warmup NaN until a session window has positive volume; missing\n * `syminfo.session` falls back to UTC-day boundaries.\n * @since 0.5\n * @stable\n * @example\n * // import { plot, ta } from \"@invinite-org/chartlang-core\";\n * // const vp = ta.sessionVolumeProfile({ rowSize: 24 });\n * // plot(vp.poc, { style: { kind: \"horizontal-histogram\", buckets: vp.buckets } });\n */\nexport function sessionVolumeProfile(\n slotId: string,\n opts?: SessionVolumeProfileOpts,\n): SessionVolumeProfileResult {\n const ctx = getCtx();\n let slot = ctx.stream.taSlots.get(slotId) as SessionVolumeProfileSlot | undefined;\n if (slot === undefined) {\n slot = initSlot(ctx.stream.ohlcv.close.capacity);\n ctx.stream.taSlots.set(slotId, slot);\n }\n\n const sessionStart = resolveSessionStart(ctx, slotId, opts);\n const bars = ctx.stream.bar.time <= sessionStart ? [] : collectBars(ctx, sessionStart);\n const snapshot = resolveVolumeProfileSnapshot({\n bars,\n bucketColor: opts?.bucketColor,\n config: volumeProfileConfigFromOpts(opts ?? {}),\n });\n commitVolumeProfileSnapshot(slot, ctx.isTick, snapshot);\n emitVolumeProfileHistogram(\n ctx,\n slotId,\n \"Session Volume Profile\",\n snapshot.poc,\n snapshot.buckets,\n );\n return resultForOffset(slot, opts?.offset ?? 0);\n}\n"]}
1
+ {"version":3,"file":"sessionVolumeProfile.js","sourceRoot":"","sources":["../../src/ta/sessionVolumeProfile.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,4FAA4F;AAC5F,gDAAgD;AAChD,qEAAqE;AACrE,iEAAiE;AAOjE,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,sBAAsB,EAAuB,MAAM,sBAAsB,CAAC;AACnF,OAAO,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AACzE,OAAO,EAAE,yBAAyB,EAAE,MAAM,oCAAoC,CAAC;AAC/E,OAAO,EAGH,2BAA2B,EAC3B,uBAAuB,EACvB,0BAA0B,EAC1B,4BAA4B,EAC5B,2BAA2B,GAC9B,MAAM,+BAA+B,CAAC;AAEvC,MAAM,MAAM,GAAG,UAAU,CAAC;AAW1B,SAAS,MAAM;IACX,MAAM,GAAG,GAAG,sBAAsB,CAAC,OAAO,CAAC;IAC3C,IAAI,GAAG,KAAK,IAAI,EAAE,CAAC;QACf,MAAM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AO,CACnB,CAAC;IACF,OAAO,eAAe,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,IAAI,CAAC,CAAC,CAAC;AACpD,CAAC","sourcesContent":["// Copyright (c) 2026 Invinite. Licensed under the MIT License.\n// Ported from ../invinite/src/components/trading-chart/indicators/session-volume-profile.ts\n// @ 3234c8c0c3f9880d9d1e3a3ee63ebd55ddd535f4.\n// Translated, not transcribed — Series<T> shape, opts.offset, JSDoc.\n// See packages/runtime/src/ta/CLAUDE.md for the port convention.\n\nimport type {\n SessionVolumeProfileOpts,\n SessionVolumeProfileResult,\n} from \"@invinite-org/chartlang-core\";\n\nimport { pushDiagnostic } from \"../emit/index.js\";\nimport { ACTIVE_RUNTIME_CONTEXT, type RuntimeContext } from \"../runtimeContext.js\";\nimport { makeSeriesView, makeShiftedSeriesView } from \"../seriesView.js\";\nimport { parseSessionWindowMinutes } from \"../time-accessors/sessionWindow.js\";\nimport {\n type VolumeProfileBar,\n type VolumeProfileCore,\n commitVolumeProfileSnapshot,\n createVolumeProfileCore,\n emitVolumeProfileHistogram,\n resolveVolumeProfileSnapshot,\n volumeProfileConfigFromOpts,\n} from \"./lib/volume-profile/index.js\";\n\nconst DAY_MS = 86_400_000;\n\ntype SessionVolumeProfileSlot = VolumeProfileCore & {\n readonly result: SessionVolumeProfileResult;\n readonly shiftedResults: Map<number, SessionVolumeProfileResult>;\n};\n\ntype MutableSessionVolumeProfileSlot = Omit<SessionVolumeProfileSlot, \"result\"> & {\n result: SessionVolumeProfileResult;\n};\n\nfunction getCtx(): RuntimeContext {\n const ctx = ACTIVE_RUNTIME_CONTEXT.current;\n if (ctx === null) {\n throw new Error(\"ta.sessionVolumeProfile called outside an active script step\");\n }\n return ctx;\n}\n\nfunction initSlot(capacity: number): SessionVolumeProfileSlot {\n const core = createVolumeProfileCore(capacity);\n const slot: MutableSessionVolumeProfileSlot = {\n ...core,\n result: Object.freeze({\n get buckets() {\n return slot.buckets;\n },\n poc: makeSeriesView<number>(core.pocBuffer),\n valHigh: makeSeriesView<number>(core.valHighBuffer),\n valLow: makeSeriesView<number>(core.valLowBuffer),\n }),\n shiftedResults: new Map(),\n };\n return slot;\n}\n\nfunction resultForOffset(\n slot: SessionVolumeProfileSlot,\n offset: number,\n): SessionVolumeProfileResult {\n if (offset === 0) return slot.result;\n let cached = slot.shiftedResults.get(offset);\n if (cached === undefined) {\n cached = Object.freeze({\n get buckets() {\n return slot.buckets;\n },\n poc: makeShiftedSeriesView<number>(slot.pocBuffer, offset),\n valHigh: makeShiftedSeriesView<number>(slot.valHighBuffer, offset),\n valLow: makeShiftedSeriesView<number>(slot.valLowBuffer, offset),\n });\n slot.shiftedResults.set(offset, cached);\n }\n return cached;\n}\n\nfunction utcDayStart(time: number): number {\n return Math.floor(time / DAY_MS) * DAY_MS;\n}\n\nfunction sessionBoundaryFromDescriptor(time: number, session: string): number | null {\n const parsed = parseSessionWindowMinutes(session);\n if (parsed === null) return null;\n const dayStart = utcDayStart(time);\n const boundary = dayStart + parsed.startMinutes * 60_000;\n return time >= boundary ? boundary : boundary - DAY_MS;\n}\n\nfunction diagnoseMissingSession(ctx: RuntimeContext, slotId: string): void {\n const key = `session-info-missing|${slotId}`;\n if (ctx.diagnosedRequestKeys.has(key)) return;\n ctx.diagnosedRequestKeys.add(key);\n pushDiagnostic(ctx.emissions, {\n kind: \"diagnostic\",\n severity: \"warning\",\n code: \"session-info-missing\",\n message:\n \"Adapter did not provide syminfo.session; ta.sessionVolumeProfile used UTC-day boundaries.\",\n slotId,\n bar: ctx.barIndex(),\n });\n}\n\nfunction resolveSessionStart(\n ctx: RuntimeContext,\n slotId: string,\n opts: SessionVolumeProfileOpts | undefined,\n): number {\n if (opts?.sessionStart !== undefined) return opts.sessionStart;\n const session = ctx.views.syminfo.session;\n if (!ctx.capabilities.symInfoFields.has(\"session\") || session === \"\") {\n diagnoseMissingSession(ctx, slotId);\n return utcDayStart(ctx.stream.bar.time);\n }\n const boundary = sessionBoundaryFromDescriptor(ctx.stream.bar.time, session);\n if (boundary === null) {\n diagnoseMissingSession(ctx, slotId);\n return utcDayStart(ctx.stream.bar.time);\n }\n return boundary;\n}\n\nfunction collectBars(ctx: RuntimeContext, sessionStart: number): ReadonlyArray<VolumeProfileBar> {\n const { ohlcv } = ctx.stream;\n const bars: VolumeProfileBar[] = [];\n for (let lookback = ohlcv.close.length - 1; lookback >= 0; lookback -= 1) {\n const time = ohlcv.time.at(lookback);\n if (time <= sessionStart) continue;\n bars.push({\n close: ohlcv.close.at(lookback),\n high: ohlcv.high.at(lookback),\n low: ohlcv.low.at(lookback),\n open: ohlcv.open.at(lookback),\n time,\n volume: ohlcv.volume.at(lookback),\n });\n }\n return bars;\n}\n\n/**\n * Session Volume Profile — bucketizes the current session's volume\n * by price, resetting when `bar.time` crosses the active session\n * boundary.\n *\n * @formula Port of invinite session-vp: find the current session\n * window, bucket volume by price, then derive POC / value-\n * area high / value-area low via the shared volume-profile\n * pipeline.\n * @anchors `syminfo.session` descriptor, or `opts.sessionStart`\n * override when provided.\n * @warmup NaN until a session window has positive volume; missing\n * `syminfo.session` falls back to UTC-day boundaries.\n * @since 0.5\n * @stable\n * @example\n * // import { plot, ta } from \"@invinite-org/chartlang-core\";\n * // const vp = ta.sessionVolumeProfile({ rowSize: 24 });\n * // plot(vp.poc, { style: { kind: \"horizontal-histogram\", buckets: vp.buckets } });\n */\nexport function sessionVolumeProfile(\n slotId: string,\n opts?: SessionVolumeProfileOpts,\n): SessionVolumeProfileResult {\n const ctx = getCtx();\n let slot = ctx.stream.taSlots.get(slotId) as SessionVolumeProfileSlot | undefined;\n if (slot === undefined) {\n slot = initSlot(ctx.stream.ohlcv.close.capacity);\n ctx.stream.taSlots.set(slotId, slot);\n }\n\n const sessionStart = resolveSessionStart(ctx, slotId, opts);\n const bars = ctx.stream.bar.time <= sessionStart ? [] : collectBars(ctx, sessionStart);\n const snapshot = resolveVolumeProfileSnapshot({\n bars,\n bucketColor: opts?.bucketColor,\n config: volumeProfileConfigFromOpts(opts ?? {}),\n });\n commitVolumeProfileSnapshot(slot, ctx.isTick, snapshot);\n emitVolumeProfileHistogram(\n ctx,\n slotId,\n \"Session Volume Profile\",\n snapshot.poc,\n snapshot.buckets,\n );\n return resultForOffset(slot, opts?.offset ?? 0);\n}\n"]}
package/dist/ta/sma.d.ts CHANGED
@@ -5,8 +5,11 @@ import { type ScalarOrSeries } from "./lib/sourceValue.js";
5
5
  * values. Warmup of `length − 1` bars returns `NaN`. Tick-mode replays
6
6
  * the head as `(window_sum − window_head + tick_value) / length` so a
7
7
  * partial-bar tick doesn't pollute the next close's running sum.
8
- * `opts.offset` shifts the returned series so `series.current` reads
9
- * the value `offset` bars ago.
8
+ * `opts.offset` is a presentation display shift carried to the plot
9
+ * emission as `xShift` (`+n` renders the series `n` bars right / future,
10
+ * `−n` `n` bars left / past); it does NOT transform the value —
11
+ * `series.current` is unshifted, so alerts and `state.*` see the value
12
+ * computed at the current bar.
10
13
  *
11
14
  * @formula out[t] = (source[t] + source[t − 1] + … + source[t − length + 1]) / length
12
15
  * @warmup length − 1
@@ -17,7 +20,7 @@ import { type ScalarOrSeries } from "./lib/sourceValue.js";
17
20
  * // import { ta } from "@invinite-org/chartlang-runtime";
18
21
  * // const s = ta.sma("slot", bar.close, 20);
19
22
  * // const head = s.current; // NaN until bar length-1
20
- * // const lagged = ta.sma("slot2", bar.close, 20, { offset: 5 });
23
+ * // const shifted = ta.sma("slot2", bar.close, 20, { offset: 5 }); // renders 5 bars right
21
24
  */
22
25
  export declare function sma(slotId: string, source: ScalarOrSeries, length: number, opts?: SmaOpts): Series<number>;
23
26
  //# sourceMappingURL=sma.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sma.d.ts","sourceRoot":"","sources":["../../src/ta/sma.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAC;AAKpE,OAAO,EAAE,KAAK,cAAc,EAAmB,MAAM,sBAAsB,CAAC;AAqF5E;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,GAAG,CACf,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,cAAc,EACtB,MAAM,EAAE,MAAM,EACd,IAAI,CAAC,EAAE,OAAO,GACf,MAAM,CAAC,MAAM,CAAC,CAchB"}
1
+ {"version":3,"file":"sma.d.ts","sourceRoot":"","sources":["../../src/ta/sma.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAC;AAKpE,OAAO,EAAE,KAAK,cAAc,EAAmB,MAAM,sBAAsB,CAAC;AAqF5E;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,GAAG,CACf,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,cAAc,EACtB,MAAM,EAAE,MAAM,EACd,IAAI,CAAC,EAAE,OAAO,GACf,MAAM,CAAC,MAAM,CAAC,CAchB"}
package/dist/ta/sma.js CHANGED
@@ -79,8 +79,11 @@ function closeValue(slot, src) {
79
79
  * values. Warmup of `length − 1` bars returns `NaN`. Tick-mode replays
80
80
  * the head as `(window_sum − window_head + tick_value) / length` so a
81
81
  * partial-bar tick doesn't pollute the next close's running sum.
82
- * `opts.offset` shifts the returned series so `series.current` reads
83
- * the value `offset` bars ago.
82
+ * `opts.offset` is a presentation display shift carried to the plot
83
+ * emission as `xShift` (`+n` renders the series `n` bars right / future,
84
+ * `−n` `n` bars left / past); it does NOT transform the value —
85
+ * `series.current` is unshifted, so alerts and `state.*` see the value
86
+ * computed at the current bar.
84
87
  *
85
88
  * @formula out[t] = (source[t] + source[t − 1] + … + source[t − length + 1]) / length
86
89
  * @warmup length − 1
@@ -91,7 +94,7 @@ function closeValue(slot, src) {
91
94
  * // import { ta } from "@invinite-org/chartlang-runtime";
92
95
  * // const s = ta.sma("slot", bar.close, 20);
93
96
  * // const head = s.current; // NaN until bar length-1
94
- * // const lagged = ta.sma("slot2", bar.close, 20, { offset: 5 });
97
+ * // const shifted = ta.sma("slot2", bar.close, 20, { offset: 5 }); // renders 5 bars right
95
98
  */
96
99
  export function sma(slotId, source, length, opts) {
97
100
  const ctx = getCtx();