oakscriptjs 0.11.0 → 0.11.1

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 (236) hide show
  1. package/dist/cjs/array/index.d.ts +8 -2
  2. package/dist/cjs/array/index.d.ts.map +1 -1
  3. package/dist/cjs/array/index.js +2 -1
  4. package/dist/cjs/array/index.js.map +2 -2
  5. package/dist/cjs/box/index.js +6 -6
  6. package/dist/cjs/box/index.js.map +2 -2
  7. package/dist/cjs/callsite/index.js +1 -1
  8. package/dist/cjs/callsite/index.js.map +2 -2
  9. package/dist/cjs/drawing/registry.d.ts +15 -6
  10. package/dist/cjs/drawing/registry.d.ts.map +1 -1
  11. package/dist/cjs/drawing/registry.js +16 -2
  12. package/dist/cjs/drawing/registry.js.map +2 -2
  13. package/dist/cjs/index.d.ts +3 -2
  14. package/dist/cjs/index.d.ts.map +1 -1
  15. package/dist/cjs/index.js +6 -1
  16. package/dist/cjs/index.js.map +2 -2
  17. package/dist/cjs/input.d.ts +9 -1
  18. package/dist/cjs/input.d.ts.map +1 -1
  19. package/dist/cjs/input.js +16 -0
  20. package/dist/cjs/input.js.map +2 -2
  21. package/dist/cjs/label/index.js +3 -3
  22. package/dist/cjs/label/index.js.map +2 -2
  23. package/dist/cjs/line/index.d.ts +10 -27
  24. package/dist/cjs/line/index.d.ts.map +1 -1
  25. package/dist/cjs/line/index.js +10 -27
  26. package/dist/cjs/line/index.js.map +2 -2
  27. package/dist/cjs/linefill/index.d.ts +3 -0
  28. package/dist/cjs/linefill/index.d.ts.map +1 -1
  29. package/dist/cjs/linefill/index.js +15 -1
  30. package/dist/cjs/linefill/index.js.map +3 -3
  31. package/dist/cjs/runtime/adapters/SimpleInputAdapter.js +1 -1
  32. package/dist/cjs/runtime/adapters/SimpleInputAdapter.js.map +2 -2
  33. package/dist/cjs/runtime/index.d.ts +1 -1
  34. package/dist/cjs/runtime/index.d.ts.map +1 -1
  35. package/dist/cjs/runtime/index.js +1 -0
  36. package/dist/cjs/runtime/index.js.map +2 -2
  37. package/dist/cjs/runtime/inputs.d.ts +9 -0
  38. package/dist/cjs/runtime/inputs.d.ts.map +1 -1
  39. package/dist/cjs/runtime/inputs.js +8 -0
  40. package/dist/cjs/runtime/inputs.js.map +2 -2
  41. package/dist/cjs/runtime/types.d.ts +1 -1
  42. package/dist/cjs/runtime/types.d.ts.map +1 -1
  43. package/dist/cjs/runtime/types.js.map +1 -1
  44. package/dist/cjs/script/index.d.ts +65 -12
  45. package/dist/cjs/script/index.d.ts.map +1 -1
  46. package/dist/cjs/script/index.js +168 -19
  47. package/dist/cjs/script/index.js.map +3 -3
  48. package/dist/cjs/security/other.d.ts +92 -0
  49. package/dist/cjs/security/other.d.ts.map +1 -0
  50. package/dist/cjs/security/other.js +164 -0
  51. package/dist/cjs/security/other.js.map +7 -0
  52. package/dist/cjs/session/bars.d.ts +10 -1
  53. package/dist/cjs/session/bars.d.ts.map +1 -1
  54. package/dist/cjs/session/bars.js +16 -2
  55. package/dist/cjs/session/bars.js.map +2 -2
  56. package/dist/cjs/session/calendar.d.ts +4 -1
  57. package/dist/cjs/session/calendar.d.ts.map +1 -1
  58. package/dist/cjs/session/calendar.js +11 -7
  59. package/dist/cjs/session/calendar.js.map +2 -2
  60. package/dist/cjs/session/context.d.ts +2 -1
  61. package/dist/cjs/session/context.d.ts.map +1 -1
  62. package/dist/cjs/session/context.js +2 -1
  63. package/dist/cjs/session/context.js.map +2 -2
  64. package/dist/cjs/str/floatingdecimal.d.ts +31 -0
  65. package/dist/cjs/str/floatingdecimal.d.ts.map +1 -0
  66. package/dist/cjs/str/floatingdecimal.js +298 -0
  67. package/dist/cjs/str/floatingdecimal.js.map +7 -0
  68. package/dist/cjs/str/index.d.ts +4 -3
  69. package/dist/cjs/str/index.d.ts.map +1 -1
  70. package/dist/cjs/str/index.js +1 -1
  71. package/dist/cjs/str/index.js.map +2 -2
  72. package/dist/cjs/str/numberformat.d.ts +6 -4
  73. package/dist/cjs/str/numberformat.d.ts.map +1 -1
  74. package/dist/cjs/str/numberformat.js +3 -2
  75. package/dist/cjs/str/numberformat.js.map +2 -2
  76. package/dist/cjs/ta/index.d.ts +34 -17
  77. package/dist/cjs/ta/index.d.ts.map +1 -1
  78. package/dist/cjs/ta/index.js +132 -116
  79. package/dist/cjs/ta/index.js.map +2 -2
  80. package/dist/cjs/ta/limits.d.ts +11 -0
  81. package/dist/cjs/ta/limits.d.ts.map +1 -1
  82. package/dist/cjs/ta/limits.js +15 -1
  83. package/dist/cjs/ta/limits.js.map +2 -2
  84. package/dist/cjs/ta/running-sum.js +1 -1
  85. package/dist/cjs/ta/running-sum.js.map +2 -2
  86. package/dist/cjs/ta-series.d.ts +1 -1
  87. package/dist/cjs/ta-series.d.ts.map +1 -1
  88. package/dist/cjs/ta-series.js +1 -1
  89. package/dist/cjs/ta-series.js.map +2 -2
  90. package/dist/cjs/table/index.d.ts +3 -1
  91. package/dist/cjs/table/index.d.ts.map +1 -1
  92. package/dist/cjs/table/index.js +1 -0
  93. package/dist/cjs/table/index.js.map +3 -3
  94. package/dist/cjs/time/session.d.ts +9 -0
  95. package/dist/cjs/time/session.d.ts.map +1 -1
  96. package/dist/cjs/time/session.js +42 -14
  97. package/dist/cjs/time/session.js.map +3 -3
  98. package/dist/cjs/time/timezone.d.ts +6 -1
  99. package/dist/cjs/time/timezone.d.ts.map +1 -1
  100. package/dist/cjs/time/timezone.js +2 -2
  101. package/dist/cjs/time/timezone.js.map +2 -2
  102. package/dist/cjs/types/metadata.d.ts +1 -1
  103. package/dist/cjs/types/metadata.d.ts.map +1 -1
  104. package/dist/cjs/types/metadata.js.map +1 -1
  105. package/dist/esm/array/index.d.ts +8 -2
  106. package/dist/esm/array/index.d.ts.map +1 -1
  107. package/dist/esm/array/index.js +12 -3
  108. package/dist/esm/array/index.js.map +1 -1
  109. package/dist/esm/box/index.js +6 -6
  110. package/dist/esm/box/index.js.map +1 -1
  111. package/dist/esm/callsite/index.js +1 -1
  112. package/dist/esm/callsite/index.js.map +1 -1
  113. package/dist/esm/drawing/registry.d.ts +15 -6
  114. package/dist/esm/drawing/registry.d.ts.map +1 -1
  115. package/dist/esm/drawing/registry.js +30 -7
  116. package/dist/esm/drawing/registry.js.map +1 -1
  117. package/dist/esm/index.d.ts +3 -2
  118. package/dist/esm/index.d.ts.map +1 -1
  119. package/dist/esm/index.js +4 -2
  120. package/dist/esm/index.js.map +1 -1
  121. package/dist/esm/input.d.ts +9 -1
  122. package/dist/esm/input.d.ts.map +1 -1
  123. package/dist/esm/input.js +16 -0
  124. package/dist/esm/input.js.map +1 -1
  125. package/dist/esm/label/index.js +3 -3
  126. package/dist/esm/label/index.js.map +1 -1
  127. package/dist/esm/line/index.d.ts +10 -27
  128. package/dist/esm/line/index.d.ts.map +1 -1
  129. package/dist/esm/line/index.js +20 -64
  130. package/dist/esm/line/index.js.map +1 -1
  131. package/dist/esm/linefill/index.d.ts +3 -0
  132. package/dist/esm/linefill/index.d.ts.map +1 -1
  133. package/dist/esm/linefill/index.js +20 -1
  134. package/dist/esm/linefill/index.js.map +1 -1
  135. package/dist/esm/runtime/adapters/SimpleInputAdapter.js +1 -1
  136. package/dist/esm/runtime/adapters/SimpleInputAdapter.js.map +1 -1
  137. package/dist/esm/runtime/index.d.ts +1 -1
  138. package/dist/esm/runtime/index.d.ts.map +1 -1
  139. package/dist/esm/runtime/index.js +1 -1
  140. package/dist/esm/runtime/index.js.map +1 -1
  141. package/dist/esm/runtime/inputs.d.ts +9 -0
  142. package/dist/esm/runtime/inputs.d.ts.map +1 -1
  143. package/dist/esm/runtime/inputs.js +15 -0
  144. package/dist/esm/runtime/inputs.js.map +1 -1
  145. package/dist/esm/runtime/types.d.ts +1 -1
  146. package/dist/esm/runtime/types.d.ts.map +1 -1
  147. package/dist/esm/script/index.d.ts +65 -12
  148. package/dist/esm/script/index.d.ts.map +1 -1
  149. package/dist/esm/script/index.js +217 -29
  150. package/dist/esm/script/index.js.map +1 -1
  151. package/dist/esm/security/other.d.ts +92 -0
  152. package/dist/esm/security/other.d.ts.map +1 -0
  153. package/dist/esm/security/other.js +211 -0
  154. package/dist/esm/security/other.js.map +1 -0
  155. package/dist/esm/session/bars.d.ts +10 -1
  156. package/dist/esm/session/bars.d.ts.map +1 -1
  157. package/dist/esm/session/bars.js +26 -1
  158. package/dist/esm/session/bars.js.map +1 -1
  159. package/dist/esm/session/calendar.d.ts +4 -1
  160. package/dist/esm/session/calendar.d.ts.map +1 -1
  161. package/dist/esm/session/calendar.js +19 -7
  162. package/dist/esm/session/calendar.js.map +1 -1
  163. package/dist/esm/session/context.d.ts +2 -1
  164. package/dist/esm/session/context.d.ts.map +1 -1
  165. package/dist/esm/session/context.js +5 -3
  166. package/dist/esm/session/context.js.map +1 -1
  167. package/dist/esm/str/floatingdecimal.d.ts +31 -0
  168. package/dist/esm/str/floatingdecimal.d.ts.map +1 -0
  169. package/dist/esm/str/floatingdecimal.js +272 -0
  170. package/dist/esm/str/floatingdecimal.js.map +1 -0
  171. package/dist/esm/str/index.d.ts +4 -3
  172. package/dist/esm/str/index.d.ts.map +1 -1
  173. package/dist/esm/str/index.js +6 -5
  174. package/dist/esm/str/index.js.map +1 -1
  175. package/dist/esm/str/numberformat.d.ts +6 -4
  176. package/dist/esm/str/numberformat.d.ts.map +1 -1
  177. package/dist/esm/str/numberformat.js +9 -5
  178. package/dist/esm/str/numberformat.js.map +1 -1
  179. package/dist/esm/ta/index.d.ts +34 -17
  180. package/dist/esm/ta/index.d.ts.map +1 -1
  181. package/dist/esm/ta/index.js +155 -185
  182. package/dist/esm/ta/index.js.map +1 -1
  183. package/dist/esm/ta/limits.d.ts +11 -0
  184. package/dist/esm/ta/limits.d.ts.map +1 -1
  185. package/dist/esm/ta/limits.js +27 -2
  186. package/dist/esm/ta/limits.js.map +1 -1
  187. package/dist/esm/ta/running-sum.js +1 -1
  188. package/dist/esm/ta/running-sum.js.map +1 -1
  189. package/dist/esm/ta-series.d.ts +1 -1
  190. package/dist/esm/ta-series.d.ts.map +1 -1
  191. package/dist/esm/ta-series.js +2 -1
  192. package/dist/esm/ta-series.js.map +1 -1
  193. package/dist/esm/table/index.d.ts +3 -1
  194. package/dist/esm/table/index.d.ts.map +1 -1
  195. package/dist/esm/table/index.js +6 -1
  196. package/dist/esm/table/index.js.map +1 -1
  197. package/dist/esm/time/session.d.ts +9 -0
  198. package/dist/esm/time/session.d.ts.map +1 -1
  199. package/dist/esm/time/session.js +53 -15
  200. package/dist/esm/time/session.js.map +1 -1
  201. package/dist/esm/time/timezone.d.ts +6 -1
  202. package/dist/esm/time/timezone.d.ts.map +1 -1
  203. package/dist/esm/time/timezone.js +8 -2
  204. package/dist/esm/time/timezone.js.map +1 -1
  205. package/dist/esm/types/metadata.d.ts +1 -1
  206. package/dist/esm/types/metadata.d.ts.map +1 -1
  207. package/package.json +1 -1
  208. package/src/array/index.ts +11 -3
  209. package/src/box/index.ts +6 -6
  210. package/src/callsite/index.ts +1 -1
  211. package/src/drawing/registry.ts +30 -7
  212. package/src/index.ts +11 -1
  213. package/src/input.ts +18 -1
  214. package/src/label/index.ts +3 -3
  215. package/src/line/index.ts +20 -68
  216. package/src/linefill/index.ts +20 -1
  217. package/src/runtime/adapters/SimpleInputAdapter.ts +1 -1
  218. package/src/runtime/index.ts +1 -0
  219. package/src/runtime/inputs.ts +16 -0
  220. package/src/runtime/types.ts +1 -1
  221. package/src/script/index.ts +292 -30
  222. package/src/security/other.ts +269 -0
  223. package/src/session/bars.ts +24 -1
  224. package/src/session/calendar.ts +23 -7
  225. package/src/session/context.ts +5 -3
  226. package/src/str/floatingdecimal.ts +268 -0
  227. package/src/str/index.ts +6 -5
  228. package/src/str/numberformat.ts +11 -6
  229. package/src/ta/index.ts +157 -183
  230. package/src/ta/limits.ts +28 -1
  231. package/src/ta/running-sum.ts +1 -1
  232. package/src/ta-series.ts +3 -2
  233. package/src/table/index.ts +4 -1
  234. package/src/time/session.ts +58 -16
  235. package/src/time/timezone.ts +9 -2
  236. package/src/types/metadata.ts +1 -1
@@ -14,6 +14,8 @@
14
14
  * "0000-0000" and "24x7" are the whole day, every day
15
15
  * - a run that ends at 0000 ("2000-0000") ends at 24:00 of the day it starts and belongs to that day
16
16
  * ("2000-0000:6" is Friday 20:00 to midnight)
17
+ * - "F" after the start moves it one day before the day the run ends on ("1700F-1900:2": Sunday 17:00 to Monday
18
+ * 19:00; "1900-1900:3456|1700F-1900:2" is the TVC:DXY symbol session) (#173)
17
19
  * - a string that is empty or does not start with a digit ("regular", "extended") is the symbol's own session
18
20
  * - a malformed string ("1100 -1400", "0930-16", ":8") is an error, as the PineScript runtime error
19
21
  */
@@ -22,6 +24,8 @@ export interface SessionRange {
22
24
  start: number;
23
25
  end: number;
24
26
  days: Set<number>;
27
+ /** Days between the start and the day the run ends on, given by "F" after the start (absent otherwise) */
28
+ startDays?: number;
25
29
  }
26
30
  /**
27
31
  * Runs of a PineScript session string, or null for the symbol's own session (empty or not starting with a digit).
@@ -49,4 +53,9 @@ export declare function parsePineSession(session: string): SessionRange[] | null
49
53
  * `time(timeframe, session)` in a script with the chart session
50
54
  */
51
55
  export declare function inSession(time: number, session: string, timezone: string, barMs?: number): boolean;
56
+ /**
57
+ * The run of `session` that contains `time`, as [start, end) UNIX times (ms), or null outside the session; rules in
58
+ * {@link inSession}. PineScript aligns the intraday periods of `time(tf, session)` on the start of this run (#173).
59
+ */
60
+ export declare function sessionRun(time: number, session: string, timezone: string, barMs?: number): [number, number] | null;
52
61
  //# sourceMappingURL=session.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../../src/time/session.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAQH,iHAAiH;AACjH,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;CACnB;AA+BD;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,YAAY,EAAE,GAAG,IAAI,CAuCvE;AAuBD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CA4DlG"}
1
+ {"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../../src/time/session.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAQH,iHAAiH;AACjH,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAClB,0GAA0G;IAC1G,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AA0CD;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,YAAY,EAAE,GAAG,IAAI,CAuCvE;AAuBD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAElG;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CA+EnH"}
@@ -19,7 +19,8 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
19
19
  var session_exports = {};
20
20
  __export(session_exports, {
21
21
  inSession: () => inSession,
22
- parsePineSession: () => parsePineSession
22
+ parsePineSession: () => parsePineSession,
23
+ sessionRun: () => sessionRun
23
24
  });
24
25
  module.exports = __toCommonJS(session_exports);
25
26
  var import_timezone = require("./timezone.js");
@@ -34,6 +35,13 @@ function parseRanges(text, session) {
34
35
  const entries = text.split(",");
35
36
  if (entries.length > 1 && entries[entries.length - 1] === "") entries.pop();
36
37
  return entries.map((entry) => {
38
+ const f = /^(\d{4})F-(\d{4})$/.exec(entry);
39
+ if (f) {
40
+ const minutes = (hhmm) => Number(hhmm.slice(0, 2)) * 60 + Number(hhmm.slice(2, 4));
41
+ const [start2, end2] = [minutes(f[1]), minutes(f[2])];
42
+ if (start2 >= MINUTES_PER_DAY || end2 >= MINUTES_PER_DAY) throw invalid(session);
43
+ return [start2, end2, 1];
44
+ }
37
45
  if (!/^\d{4}-\d{4}$/.test(entry)) throw invalid(session);
38
46
  let start = Number(entry.slice(0, 2)) * 60 + Number(entry.slice(2, 4));
39
47
  let end = Number(entry.slice(5, 7)) * 60 + Number(entry.slice(7, 9));
@@ -51,6 +59,7 @@ function parseDays(text, session) {
51
59
  return new Set([...text].map(Number));
52
60
  }
53
61
  const parsed = /* @__PURE__ */ new Map();
62
+ const range = (start, end, days, startDays) => startDays === void 0 ? { start, end, days } : { start, end, days, startDays };
54
63
  function parsePineSession(session) {
55
64
  const cached = parsed.get(session);
56
65
  if (cached !== void 0) return cached;
@@ -61,7 +70,7 @@ function parsePineSession(session) {
61
70
  } else if (spec === "24x7") {
62
71
  out = [{ start: 0, end: 0, days: new Set(ALL_DAYS) }];
63
72
  } else if (!/[:,|]/.test(spec)) {
64
- out = parseRanges(spec, session).map(([start, end]) => ({ start, end, days: new Set(ALL_DAYS) }));
73
+ out = parseRanges(spec, session).map(([start, end, startDays]) => range(start, end, new Set(ALL_DAYS), startDays));
65
74
  } else {
66
75
  const sections = spec.split("|");
67
76
  if (sections.length > 1 && sections[sections.length - 1] === "") sections.pop();
@@ -86,7 +95,7 @@ function parsePineSession(session) {
86
95
  for (const d of WEEKDAYS) if (!claimed.has(d)) own[i].add(d);
87
96
  }
88
97
  });
89
- out = items.flatMap((it, i) => own[i].size ? it.ranges.map(([start, end]) => ({ start, end, days: own[i] })) : []);
98
+ out = items.flatMap((it, i) => own[i].size ? it.ranges.map(([start, end, startDays]) => range(start, end, own[i], startDays)) : []);
90
99
  }
91
100
  parsed.set(session, out);
92
101
  return out;
@@ -109,26 +118,45 @@ function clockChangeNear(time, timezone) {
109
118
  return { at: hi, before, after };
110
119
  }
111
120
  function inSession(time, session, timezone, barMs) {
112
- if (Number.isNaN(time)) return false;
121
+ return sessionRun(time, session, timezone, barMs) !== null;
122
+ }
123
+ function sessionRun(time, session, timezone, barMs) {
124
+ if (Number.isNaN(time)) return null;
113
125
  const ranges = parsePineSession(session);
114
126
  if (ranges === null) throw new Error(`Session "${session}" is the symbol session: it needs the chart session (time(timeframe, session) in a script)`);
115
127
  const change = clockChangeNear(time, timezone);
116
128
  const f = (0, import_timezone.zonedFields)(time, timezone);
117
129
  const minute = f.hour * 60 + f.minute;
118
130
  const nextDay = f.dayOfWeek % 7 + 1;
119
- for (const { start, end: rawEnd, days } of ranges) {
131
+ for (const { start, end: rawEnd, days, startDays } of ranges) {
132
+ if (startDays !== void 0) {
133
+ for (let k = 0; k <= startDays + 1; k++) {
134
+ const endDay = Date.UTC(f.year, f.month - 1, f.day + k);
135
+ if (!days.has(new Date(endDay).getUTCDay() + 1)) continue;
136
+ const d = new Date(endDay);
137
+ const at = (dayShift, minutes) => (0, import_timezone.zonedToUnix)(timezone, d.getUTCFullYear(), d.getUTCMonth() + 1, d.getUTCDate() - dayShift, Math.floor(minutes / 60), minutes % 60);
138
+ const from = at(startDays, start);
139
+ const to = at(0, rawEnd);
140
+ if (time >= from && time < to) return [from, to];
141
+ }
142
+ continue;
143
+ }
120
144
  if (start === rawEnd) {
121
- if (days.has(start === 0 || minute < start ? f.dayOfWeek : nextDay)) return true;
145
+ if (days.has(start === 0 || minute < start ? f.dayOfWeek : nextDay)) {
146
+ const from = time - (minute - start + MINUTES_PER_DAY) % MINUTES_PER_DAY * MS_PER_MINUTE - f.second * 1e3 - time % 1e3;
147
+ return [from, from + MS_PER_DAY];
148
+ }
122
149
  continue;
123
150
  }
124
151
  const end = rawEnd === 0 ? MINUTES_PER_DAY : rawEnd;
125
152
  const overnight = start > end;
126
153
  if (!change) {
154
+ const midnight = time - minute * MS_PER_MINUTE - f.second * 1e3 - time % 1e3;
127
155
  if (!overnight) {
128
- if (minute >= start && minute < end && days.has(f.dayOfWeek)) return true;
156
+ if (minute >= start && minute < end && days.has(f.dayOfWeek)) return [midnight + start * MS_PER_MINUTE, midnight + end * MS_PER_MINUTE];
129
157
  } else {
130
- if (minute >= start && days.has(nextDay)) return true;
131
- if (minute < end && days.has(f.dayOfWeek)) return true;
158
+ if (minute >= start && days.has(nextDay)) return [midnight + start * MS_PER_MINUTE, midnight + (end + MINUTES_PER_DAY) * MS_PER_MINUTE];
159
+ if (minute < end && days.has(f.dayOfWeek)) return [midnight + (start - MINUTES_PER_DAY) * MS_PER_MINUTE, midnight + end * MS_PER_MINUTE];
132
160
  }
133
161
  continue;
134
162
  }
@@ -140,13 +168,13 @@ function inSession(time, session, timezone, barMs) {
140
168
  const from = day * MS_PER_DAY + (overnight ? start - MINUTES_PER_DAY : start) * MS_PER_MINUTE;
141
169
  const to = day * MS_PER_DAY + end * MS_PER_MINUTE;
142
170
  if (to === changeWall) {
143
- if (time >= from - change.after && time < to - change.after) return true;
171
+ if (time >= from - change.after && time < to - change.after) return [from - change.after, to - change.after];
144
172
  continue;
145
173
  }
146
- if (time >= place(from) && time < place(to)) return true;
174
+ if (time >= place(from) && time < place(to)) return [place(from), place(to)];
147
175
  const repeated = change.at + change.after;
148
176
  if (change.after < change.before && to < changeWall && to > repeated) {
149
- if (time >= Math.max(from, repeated) - change.after && time < to - change.after) return true;
177
+ if (time >= Math.max(from, repeated) - change.after && time < to - change.after) return [place(from), to - change.after];
150
178
  }
151
179
  }
152
180
  if (barMs !== void 0 && change.after < change.before) {
@@ -156,10 +184,10 @@ function inSession(time, session, timezone, barMs) {
156
184
  const from = day * MS_PER_DAY + (overnight ? start - MINUTES_PER_DAY : start) * MS_PER_MINUTE - change.before;
157
185
  const to = day * MS_PER_DAY + end * MS_PER_MINUTE - change.before;
158
186
  const shift = change.before - change.after;
159
- if (time >= from + shift && time < to + shift && time >= to + barMs) return true;
187
+ if (time >= from + shift && time < to + shift && time >= to + barMs) return [from + shift, to + shift];
160
188
  }
161
189
  }
162
190
  }
163
- return false;
191
+ return null;
164
192
  }
165
193
  //# sourceMappingURL=session.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/time/session.ts"],
4
- "sourcesContent": ["/**\n * PineScript session strings (\"0930-1600\", \"0930-1600:23456\", \"1000-1100,1400-1500:23456\", \"0930-1600|1000-1300:7\",\n * \"24x7\").\n *\n * Grammar (measured on PineScript): `range[,range...][:days]`, several sections joined by \"|\".\n * - a range is exactly \"HHMM-HHMM\"; hours and minutes are minute counts taken modulo one day (\"0930-2500\" runs\n * 09:30 to 01:00, \"0960-1600\" 10:00 to 16:00); a start of 24:00 or later must open a run of at most a day\n * - days are digits 1 (Sunday) to 7 (Saturday), the day each run ends on\n * - a lone range without days runs every day; otherwise a section without days is the default section, which runs\n * on the weekdays (2-6) no other section names, and a later section naming a day replaces the earlier ones on that\n * day (\"1100-1400|1200-1300:7\": 11:00-14:00 Monday to Friday, 12:00-13:00 Saturday)\n * - a trailing \",\", \":\" or \"|\" ends its list (\"1100-1400,\" is \"1100-1400\" Monday to Friday)\n * - an end before the start is an overnight run that belongs to the day it ends; equal ends are 24 hours;\n * \"0000-0000\" and \"24x7\" are the whole day, every day\n * - a run that ends at 0000 (\"2000-0000\") ends at 24:00 of the day it starts and belongs to that day\n * (\"2000-0000:6\" is Friday 20:00 to midnight)\n * - a string that is empty or does not start with a digit (\"regular\", \"extended\") is the symbol's own session\n * - a malformed string (\"1100 -1400\", \"0930-16\", \":8\") is an error, as the PineScript runtime error\n */\n\nimport { zoneOffset, zonedFields } from './timezone.js';\n\nconst MINUTES_PER_DAY = 1440;\nconst WEEKDAYS = [2, 3, 4, 5, 6];\nconst ALL_DAYS = [1, 2, 3, 4, 5, 6, 7];\n\n/** A run of a session: minutes after midnight (0-1439) and the days it ends on (1 = Sunday ... 7 = Saturday). */\nexport interface SessionRange {\n start: number;\n end: number;\n days: Set<number>;\n}\n\nfunction invalid(session: string): SyntaxError {\n return new SyntaxError(`Invalid session \"${session}\": expected \"HHMM-HHMM[,HHMM-HHMM...][:days][|...]\"`);\n}\n\nfunction parseRanges(text: string, session: string): Array<[number, number]> {\n if (!text) return [];\n const entries = text.split(',');\n if (entries.length > 1 && entries[entries.length - 1] === '') entries.pop();\n return entries.map((entry) => {\n if (!/^\\d{4}-\\d{4}$/.test(entry)) throw invalid(session);\n let start = Number(entry.slice(0, 2)) * 60 + Number(entry.slice(2, 4));\n let end = Number(entry.slice(5, 7)) * 60 + Number(entry.slice(7, 9));\n if (start >= MINUTES_PER_DAY) {\n const endOfRun = end || MINUTES_PER_DAY;\n if (!(start - MINUTES_PER_DAY < endOfRun && endOfRun <= start && start < 2 * MINUTES_PER_DAY)) throw invalid(session);\n }\n start %= MINUTES_PER_DAY;\n end %= MINUTES_PER_DAY;\n return [start, end];\n });\n}\n\nfunction parseDays(text: string, session: string): Set<number> {\n if (!/^[1-7]+$/.test(text)) throw invalid(session);\n return new Set([...text].map(Number));\n}\n\nconst parsed = new Map<string, SessionRange[] | null>();\n\n/**\n * Runs of a PineScript session string, or null for the symbol's own session (empty or not starting with a digit).\n * @throws SyntaxError when the string is malformed (a PineScript runtime error)\n */\nexport function parsePineSession(session: string): SessionRange[] | null {\n const cached = parsed.get(session);\n if (cached !== undefined) return cached;\n const spec = session.trim();\n let out: SessionRange[] | null;\n if (!spec || !/^\\d/.test(spec)) {\n out = null;\n } else if (spec === '24x7') {\n out = [{ start: 0, end: 0, days: new Set(ALL_DAYS) }];\n } else if (!/[:,|]/.test(spec)) {\n out = parseRanges(spec, session).map(([start, end]) => ({ start, end, days: new Set(ALL_DAYS) }));\n } else {\n const sections = spec.split('|');\n if (sections.length > 1 && sections[sections.length - 1] === '') sections.pop();\n const items = sections.map((section) => {\n const parts = section.split(':');\n if (parts.length > 2) throw invalid(session);\n const ranges = parseRanges(parts[0]!, session);\n const days = parts.length === 1 || parts[1] === '' ? null : parseDays(parts[1]!, session);\n return { ranges, days };\n });\n if (items.filter((it) => it.days === null).length > 1) throw invalid(session);\n // a later section naming a day replaces the earlier ones on that day; the default section takes the weekdays\n // no other section names\n const own: Set<number>[] = items.map(() => new Set<number>());\n const claimed = new Set<number>();\n for (let i = items.length - 1; i >= 0; i--) {\n const days = items[i]!.days;\n if (days === null) continue;\n for (const d of days) if (!claimed.has(d)) own[i]!.add(d);\n for (const d of days) claimed.add(d);\n }\n items.forEach((it, i) => {\n if (it.days === null) for (const d of WEEKDAYS) if (!claimed.has(d)) own[i]!.add(d);\n });\n out = items.flatMap((it, i) => (own[i]!.size ? it.ranges.map(([start, end]) => ({ start, end, days: own[i]! })) : []));\n }\n parsed.set(session, out);\n return out;\n}\n\nconst MS_PER_MINUTE = 60_000;\nconst MS_PER_HOUR = 3_600_000;\nconst MS_PER_DAY = 86_400_000;\n/** A clock change is looked for this far on each side of the tested time. */\nconst CHANGE_WINDOW = 36 * MS_PER_HOUR;\n\n/** The clock change of `timezone` within 36 hours of `time`: its UNIX time and the offsets (ms) around it. */\nfunction clockChangeNear(time: number, timezone: string): { at: number; before: number; after: number } | null {\n let lo = time - CHANGE_WINDOW;\n let hi = time + CHANGE_WINDOW;\n const before = zoneOffset(lo, timezone);\n const after = zoneOffset(hi, timezone);\n if (before === after) return null;\n while (hi - lo > MS_PER_MINUTE) {\n const mid = Math.floor((lo + hi) / 2 / MS_PER_MINUTE) * MS_PER_MINUTE;\n if (zoneOffset(mid, timezone) === before) lo = mid;\n else hi = mid;\n }\n return { at: hi, before, after };\n}\n\n/**\n * True when `time` falls inside `session`, with the session hours read in `timezone`.\n * A run includes its start minute and excludes its end minute.\n *\n * On the days around a clock change PineScript does not read the wall clock of each bar; it places each run of\n * each local day (measured on 15- and 5-minute bars, clocks going forward and back, four time zones):\n * - a wall time of the day is placed with the offset before the change when it is before the wall time of the\n * change (02:00 for 02:00 -> 03:00, 03:00 for 03:00 -> 02:00), with the offset after it otherwise. Forward\n * change: \"0100-0300\" lasts one hour and \"0130-0230\" is empty; back change: \"0230-0330\" lasts two hours\n * - a run that ends exactly on the wall time of the change is placed with the offset after the change at both ends\n * (forward change: \"0100-0200\" is one hour earlier than the wall clock says)\n * - clocks going back: a run that ends inside the repeated hour also covers its second pass\n * - clocks going back, the day BEFORE the change: a run with a start or an end on the wall time of the change is\n * also true one hour (the amount of the change) later, from one bar after its usual end. This needs the bar\n * duration `barMs`; without it the rule is not applied\n *\n * @param barMs - Duration of the bars in ms (the chart timeframe); only used by the last rule\n * @throws Error for the symbol's own session (\"regular\", \"extended\", \"\"), which this function does not know: use\n * `time(timeframe, session)` in a script with the chart session\n */\nexport function inSession(time: number, session: string, timezone: string, barMs?: number): boolean {\n if (Number.isNaN(time)) return false;\n const ranges = parsePineSession(session);\n if (ranges === null) throw new Error(`Session \"${session}\" is the symbol session: it needs the chart session (time(timeframe, session) in a script)`);\n const change = clockChangeNear(time, timezone);\n const f = zonedFields(time, timezone);\n const minute = f.hour * 60 + f.minute;\n const nextDay = (f.dayOfWeek % 7) + 1;\n for (const { start, end: rawEnd, days } of ranges) {\n if (start === rawEnd) {\n // 24 hours: the run belongs to the day it ends (\"0000-0000\": the day itself)\n if (days.has(start === 0 || minute < start ? f.dayOfWeek : nextDay)) return true;\n continue;\n }\n // a run that ends at 0000 ends at 24:00 of the day it starts\n const end = rawEnd === 0 ? MINUTES_PER_DAY : rawEnd;\n const overnight = start > end;\n if (!change) {\n if (!overnight) {\n if (minute >= start && minute < end && days.has(f.dayOfWeek)) return true;\n } else {\n // the part from `start` belongs to the next day\n if (minute >= start && days.has(nextDay)) return true;\n if (minute < end && days.has(f.dayOfWeek)) return true;\n }\n continue;\n }\n // local days as naive instants (wall clock read as UTC)\n const changeWall = change.at + change.before;\n const place = (naive: number): number => (naive < changeWall ? naive - change.before : naive - change.after);\n const today = Math.floor((time + change.before) / MS_PER_DAY);\n for (let day = today - 1; day <= today + 1; day++) {\n if (!days.has(((day + 4) % 7) + 1)) continue; // 01/01/1970 is a Thursday (5)\n const from = day * MS_PER_DAY + (overnight ? start - MINUTES_PER_DAY : start) * MS_PER_MINUTE;\n const to = day * MS_PER_DAY + end * MS_PER_MINUTE;\n if (to === changeWall) {\n if (time >= from - change.after && time < to - change.after) return true;\n continue;\n }\n if (time >= place(from) && time < place(to)) return true;\n // clocks going back: the second pass of the repeated hour\n const repeated = change.at + change.after;\n if (change.after < change.before && to < changeWall && to > repeated) {\n if (time >= Math.max(from, repeated) - change.after && time < to - change.after) return true;\n }\n }\n // clocks going back, the day before: a run with an end on the wall time of the change is also true one change\n // later, from one bar after its usual end\n if (barMs !== undefined && change.after < change.before) {\n const day = Math.floor(changeWall / MS_PER_DAY) - 1;\n const wallMinute = (changeWall - (day + 1) * MS_PER_DAY) / MS_PER_MINUTE;\n if ((start === wallMinute || end === wallMinute) && days.has(((day + 4) % 7) + 1)) {\n const from = day * MS_PER_DAY + (overnight ? start - MINUTES_PER_DAY : start) * MS_PER_MINUTE - change.before;\n const to = day * MS_PER_DAY + end * MS_PER_MINUTE - change.before;\n const shift = change.before - change.after;\n if (time >= from + shift && time < to + shift && time >= to + barMs) return true;\n }\n }\n }\n return false;\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAoBA,sBAAwC;AAExC,MAAM,kBAAkB;AACxB,MAAM,WAAW,CAAC,GAAG,GAAG,GAAG,GAAG,CAAC;AAC/B,MAAM,WAAW,CAAC,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;AASrC,SAAS,QAAQ,SAA8B;AAC7C,SAAO,IAAI,YAAY,oBAAoB,OAAO,qDAAqD;AAC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QAAQ,OAAO,QAAQ;AACvD,YAAM,MAAM,KAAK,MAAM,aAAa,UAAU,IAAI;AAClD,YAAM,cAAc,cAAc,MAAM,KAAK,cAAc;AAC3D,WAAK,UAAU,cAAc,QAAQ,eAAe,KAAK,KAAM,MAAM,KAAK,IAAK,CAAC,GAAG;AACjF,cAAM,OAAO,MAAM,cAAc,YAAY,QAAQ,kBAAkB,SAAS,gBAAgB,OAAO;AACvG,cAAM,KAAK,MAAM,aAAa,MAAM,gBAAgB,OAAO;AAC3D,cAAM,QAAQ,OAAO,SAAS,OAAO;AACrC,YAAI,QAAQ,OAAO,SAAS,OAAO,KAAK,SAAS,QAAQ,KAAK,MAAO,QAAO;AAAA,MAC9E;AAAA,IACF;AAAA,EACF;AACA,SAAO;AACT;",
6
- "names": []
4
+ "sourcesContent": ["/**\n * PineScript session strings (\"0930-1600\", \"0930-1600:23456\", \"1000-1100,1400-1500:23456\", \"0930-1600|1000-1300:7\",\n * \"24x7\").\n *\n * Grammar (measured on PineScript): `range[,range...][:days]`, several sections joined by \"|\".\n * - a range is exactly \"HHMM-HHMM\"; hours and minutes are minute counts taken modulo one day (\"0930-2500\" runs\n * 09:30 to 01:00, \"0960-1600\" 10:00 to 16:00); a start of 24:00 or later must open a run of at most a day\n * - days are digits 1 (Sunday) to 7 (Saturday), the day each run ends on\n * - a lone range without days runs every day; otherwise a section without days is the default section, which runs\n * on the weekdays (2-6) no other section names, and a later section naming a day replaces the earlier ones on that\n * day (\"1100-1400|1200-1300:7\": 11:00-14:00 Monday to Friday, 12:00-13:00 Saturday)\n * - a trailing \",\", \":\" or \"|\" ends its list (\"1100-1400,\" is \"1100-1400\" Monday to Friday)\n * - an end before the start is an overnight run that belongs to the day it ends; equal ends are 24 hours;\n * \"0000-0000\" and \"24x7\" are the whole day, every day\n * - a run that ends at 0000 (\"2000-0000\") ends at 24:00 of the day it starts and belongs to that day\n * (\"2000-0000:6\" is Friday 20:00 to midnight)\n * - \"F\" after the start moves it one day before the day the run ends on (\"1700F-1900:2\": Sunday 17:00 to Monday\n * 19:00; \"1900-1900:3456|1700F-1900:2\" is the TVC:DXY symbol session) (#173)\n * - a string that is empty or does not start with a digit (\"regular\", \"extended\") is the symbol's own session\n * - a malformed string (\"1100 -1400\", \"0930-16\", \":8\") is an error, as the PineScript runtime error\n */\n\nimport { zoneOffset, zonedFields, zonedToUnix } from './timezone.js';\n\nconst MINUTES_PER_DAY = 1440;\nconst WEEKDAYS = [2, 3, 4, 5, 6];\nconst ALL_DAYS = [1, 2, 3, 4, 5, 6, 7];\n\n/** A run of a session: minutes after midnight (0-1439) and the days it ends on (1 = Sunday ... 7 = Saturday). */\nexport interface SessionRange {\n start: number;\n end: number;\n days: Set<number>;\n /** Days between the start and the day the run ends on, given by \"F\" after the start (absent otherwise) */\n startDays?: number;\n}\n\nfunction invalid(session: string): SyntaxError {\n return new SyntaxError(`Invalid session \"${session}\": expected \"HHMM-HHMM[,HHMM-HHMM...][:days][|...]\"`);\n}\n\nfunction parseRanges(text: string, session: string): Array<[number, number, number?]> {\n if (!text) return [];\n const entries = text.split(',');\n if (entries.length > 1 && entries[entries.length - 1] === '') entries.pop();\n return entries.map((entry): [number, number, number?] => {\n // \"HHMMF-HHMM\": the start is one day before the day the run ends on\n const f = /^(\\d{4})F-(\\d{4})$/.exec(entry);\n if (f) {\n const minutes = (hhmm: string): number => Number(hhmm.slice(0, 2)) * 60 + Number(hhmm.slice(2, 4));\n const [start, end] = [minutes(f[1]!), minutes(f[2]!)];\n if (start >= MINUTES_PER_DAY || end >= MINUTES_PER_DAY) throw invalid(session);\n return [start, end, 1];\n }\n if (!/^\\d{4}-\\d{4}$/.test(entry)) throw invalid(session);\n let start = Number(entry.slice(0, 2)) * 60 + Number(entry.slice(2, 4));\n let end = Number(entry.slice(5, 7)) * 60 + Number(entry.slice(7, 9));\n if (start >= MINUTES_PER_DAY) {\n const endOfRun = end || MINUTES_PER_DAY;\n if (!(start - MINUTES_PER_DAY < endOfRun && endOfRun <= start && start < 2 * MINUTES_PER_DAY)) throw invalid(session);\n }\n start %= MINUTES_PER_DAY;\n end %= MINUTES_PER_DAY;\n return [start, end];\n });\n}\n\nfunction parseDays(text: string, session: string): Set<number> {\n if (!/^[1-7]+$/.test(text)) throw invalid(session);\n return new Set([...text].map(Number));\n}\n\nconst parsed = new Map<string, SessionRange[] | null>();\n\nconst range = (start: number, end: number, days: Set<number>, startDays?: number): SessionRange =>\n startDays === undefined ? { start, end, days } : { start, end, days, startDays };\n\n/**\n * Runs of a PineScript session string, or null for the symbol's own session (empty or not starting with a digit).\n * @throws SyntaxError when the string is malformed (a PineScript runtime error)\n */\nexport function parsePineSession(session: string): SessionRange[] | null {\n const cached = parsed.get(session);\n if (cached !== undefined) return cached;\n const spec = session.trim();\n let out: SessionRange[] | null;\n if (!spec || !/^\\d/.test(spec)) {\n out = null;\n } else if (spec === '24x7') {\n out = [{ start: 0, end: 0, days: new Set(ALL_DAYS) }];\n } else if (!/[:,|]/.test(spec)) {\n out = parseRanges(spec, session).map(([start, end, startDays]) => range(start, end, new Set(ALL_DAYS), startDays));\n } else {\n const sections = spec.split('|');\n if (sections.length > 1 && sections[sections.length - 1] === '') sections.pop();\n const items = sections.map((section) => {\n const parts = section.split(':');\n if (parts.length > 2) throw invalid(session);\n const ranges = parseRanges(parts[0]!, session);\n const days = parts.length === 1 || parts[1] === '' ? null : parseDays(parts[1]!, session);\n return { ranges, days };\n });\n if (items.filter((it) => it.days === null).length > 1) throw invalid(session);\n // a later section naming a day replaces the earlier ones on that day; the default section takes the weekdays\n // no other section names\n const own: Set<number>[] = items.map(() => new Set<number>());\n const claimed = new Set<number>();\n for (let i = items.length - 1; i >= 0; i--) {\n const days = items[i]!.days;\n if (days === null) continue;\n for (const d of days) if (!claimed.has(d)) own[i]!.add(d);\n for (const d of days) claimed.add(d);\n }\n items.forEach((it, i) => {\n if (it.days === null) for (const d of WEEKDAYS) if (!claimed.has(d)) own[i]!.add(d);\n });\n out = items.flatMap((it, i) => (own[i]!.size ? it.ranges.map(([start, end, startDays]) => range(start, end, own[i]!, startDays)) : []));\n }\n parsed.set(session, out);\n return out;\n}\n\nconst MS_PER_MINUTE = 60_000;\nconst MS_PER_HOUR = 3_600_000;\nconst MS_PER_DAY = 86_400_000;\n/** A clock change is looked for this far on each side of the tested time. */\nconst CHANGE_WINDOW = 36 * MS_PER_HOUR;\n\n/** The clock change of `timezone` within 36 hours of `time`: its UNIX time and the offsets (ms) around it. */\nfunction clockChangeNear(time: number, timezone: string): { at: number; before: number; after: number } | null {\n let lo = time - CHANGE_WINDOW;\n let hi = time + CHANGE_WINDOW;\n const before = zoneOffset(lo, timezone);\n const after = zoneOffset(hi, timezone);\n if (before === after) return null;\n while (hi - lo > MS_PER_MINUTE) {\n const mid = Math.floor((lo + hi) / 2 / MS_PER_MINUTE) * MS_PER_MINUTE;\n if (zoneOffset(mid, timezone) === before) lo = mid;\n else hi = mid;\n }\n return { at: hi, before, after };\n}\n\n/**\n * True when `time` falls inside `session`, with the session hours read in `timezone`.\n * A run includes its start minute and excludes its end minute.\n *\n * On the days around a clock change PineScript does not read the wall clock of each bar; it places each run of\n * each local day (measured on 15- and 5-minute bars, clocks going forward and back, four time zones):\n * - a wall time of the day is placed with the offset before the change when it is before the wall time of the\n * change (02:00 for 02:00 -> 03:00, 03:00 for 03:00 -> 02:00), with the offset after it otherwise. Forward\n * change: \"0100-0300\" lasts one hour and \"0130-0230\" is empty; back change: \"0230-0330\" lasts two hours\n * - a run that ends exactly on the wall time of the change is placed with the offset after the change at both ends\n * (forward change: \"0100-0200\" is one hour earlier than the wall clock says)\n * - clocks going back: a run that ends inside the repeated hour also covers its second pass\n * - clocks going back, the day BEFORE the change: a run with a start or an end on the wall time of the change is\n * also true one hour (the amount of the change) later, from one bar after its usual end. This needs the bar\n * duration `barMs`; without it the rule is not applied\n *\n * @param barMs - Duration of the bars in ms (the chart timeframe); only used by the last rule\n * @throws Error for the symbol's own session (\"regular\", \"extended\", \"\"), which this function does not know: use\n * `time(timeframe, session)` in a script with the chart session\n */\nexport function inSession(time: number, session: string, timezone: string, barMs?: number): boolean {\n return sessionRun(time, session, timezone, barMs) !== null;\n}\n\n/**\n * The run of `session` that contains `time`, as [start, end) UNIX times (ms), or null outside the session; rules in\n * {@link inSession}. PineScript aligns the intraday periods of `time(tf, session)` on the start of this run (#173).\n */\nexport function sessionRun(time: number, session: string, timezone: string, barMs?: number): [number, number] | null {\n if (Number.isNaN(time)) return null;\n const ranges = parsePineSession(session);\n if (ranges === null) throw new Error(`Session \"${session}\" is the symbol session: it needs the chart session (time(timeframe, session) in a script)`);\n const change = clockChangeNear(time, timezone);\n const f = zonedFields(time, timezone);\n const minute = f.hour * 60 + f.minute;\n const nextDay = (f.dayOfWeek % 7) + 1;\n for (const { start, end: rawEnd, days, startDays } of ranges) {\n if (startDays !== undefined) {\n // \"F\": from `start` of `startDays` days before the end day to `end` of the end day, wall times read in the zone\n for (let k = 0; k <= startDays + 1; k++) {\n const endDay = Date.UTC(f.year, f.month - 1, f.day + k);\n if (!days.has(new Date(endDay).getUTCDay() + 1)) continue;\n const d = new Date(endDay);\n const at = (dayShift: number, minutes: number): number =>\n zonedToUnix(timezone, d.getUTCFullYear(), d.getUTCMonth() + 1, d.getUTCDate() - dayShift, Math.floor(minutes / 60), minutes % 60);\n const from = at(startDays, start);\n const to = at(0, rawEnd);\n if (time >= from && time < to) return [from, to];\n }\n continue;\n }\n if (start === rawEnd) {\n // 24 hours: the run belongs to the day it ends (\"0000-0000\": the day itself)\n if (days.has(start === 0 || minute < start ? f.dayOfWeek : nextDay)) {\n const from = time - ((minute - start + MINUTES_PER_DAY) % MINUTES_PER_DAY) * MS_PER_MINUTE - f.second * 1000 - (time % 1000);\n return [from, from + MS_PER_DAY];\n }\n continue;\n }\n // a run that ends at 0000 ends at 24:00 of the day it starts\n const end = rawEnd === 0 ? MINUTES_PER_DAY : rawEnd;\n const overnight = start > end;\n if (!change) {\n // the wall-clock minute of the bar: the run is `start` to `end` minutes of the same offset\n const midnight = time - minute * MS_PER_MINUTE - f.second * 1000 - (time % 1000);\n if (!overnight) {\n if (minute >= start && minute < end && days.has(f.dayOfWeek)) return [midnight + start * MS_PER_MINUTE, midnight + end * MS_PER_MINUTE];\n } else {\n // the part from `start` belongs to the next day\n if (minute >= start && days.has(nextDay)) return [midnight + start * MS_PER_MINUTE, midnight + (end + MINUTES_PER_DAY) * MS_PER_MINUTE];\n if (minute < end && days.has(f.dayOfWeek)) return [midnight + (start - MINUTES_PER_DAY) * MS_PER_MINUTE, midnight + end * MS_PER_MINUTE];\n }\n continue;\n }\n // local days as naive instants (wall clock read as UTC)\n const changeWall = change.at + change.before;\n const place = (naive: number): number => (naive < changeWall ? naive - change.before : naive - change.after);\n const today = Math.floor((time + change.before) / MS_PER_DAY);\n for (let day = today - 1; day <= today + 1; day++) {\n if (!days.has(((day + 4) % 7) + 1)) continue; // 01/01/1970 is a Thursday (5)\n const from = day * MS_PER_DAY + (overnight ? start - MINUTES_PER_DAY : start) * MS_PER_MINUTE;\n const to = day * MS_PER_DAY + end * MS_PER_MINUTE;\n if (to === changeWall) {\n if (time >= from - change.after && time < to - change.after) return [from - change.after, to - change.after];\n continue;\n }\n if (time >= place(from) && time < place(to)) return [place(from), place(to)];\n // clocks going back: the second pass of the repeated hour\n const repeated = change.at + change.after;\n if (change.after < change.before && to < changeWall && to > repeated) {\n if (time >= Math.max(from, repeated) - change.after && time < to - change.after) return [place(from), to - change.after];\n }\n }\n // clocks going back, the day before: a run with an end on the wall time of the change is also true one change\n // later, from one bar after its usual end\n if (barMs !== undefined && change.after < change.before) {\n const day = Math.floor(changeWall / MS_PER_DAY) - 1;\n const wallMinute = (changeWall - (day + 1) * MS_PER_DAY) / MS_PER_MINUTE;\n if ((start === wallMinute || end === wallMinute) && days.has(((day + 4) % 7) + 1)) {\n const from = day * MS_PER_DAY + (overnight ? start - MINUTES_PER_DAY : start) * MS_PER_MINUTE - change.before;\n const to = day * MS_PER_DAY + end * MS_PER_MINUTE - change.before;\n const shift = change.before - change.after;\n if (time >= from + shift && time < to + shift && time >= to + barMs) return [from + shift, to + shift];\n }\n }\n }\n return null;\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAsBA,sBAAqD;AAErD,MAAM,kBAAkB;AACxB,MAAM,WAAW,CAAC,GAAG,GAAG,GAAG,GAAG,CAAC;AAC/B,MAAM,WAAW,CAAC,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;AAWrC,SAAS,QAAQ,SAA8B;AAC7C,SAAO,IAAI,YAAY,oBAAoB,OAAO,qDAAqD;AACzG;AAEA,SAAS,YAAY,MAAc,SAAmD;AACpF,MAAI,CAAC,KAAM,QAAO,CAAC;AACnB,QAAM,UAAU,KAAK,MAAM,GAAG;AAC9B,MAAI,QAAQ,SAAS,KAAK,QAAQ,QAAQ,SAAS,CAAC,MAAM,GAAI,SAAQ,IAAI;AAC1E,SAAO,QAAQ,IAAI,CAAC,UAAqC;AAEvD,UAAM,IAAI,qBAAqB,KAAK,KAAK;AACzC,QAAI,GAAG;AACL,YAAM,UAAU,CAAC,SAAyB,OAAO,KAAK,MAAM,GAAG,CAAC,CAAC,IAAI,KAAK,OAAO,KAAK,MAAM,GAAG,CAAC,CAAC;AACjG,YAAM,CAACA,QAAOC,IAAG,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAE,GAAG,QAAQ,EAAE,CAAC,CAAE,CAAC;AACpD,UAAID,UAAS,mBAAmBC,QAAO,gBAAiB,OAAM,QAAQ,OAAO;AAC7E,aAAO,CAACD,QAAOC,MAAK,CAAC;AAAA,IACvB;AACA,QAAI,CAAC,gBAAgB,KAAK,KAAK,EAAG,OAAM,QAAQ,OAAO;AACvD,QAAI,QAAQ,OAAO,MAAM,MAAM,GAAG,CAAC,CAAC,IAAI,KAAK,OAAO,MAAM,MAAM,GAAG,CAAC,CAAC;AACrE,QAAI,MAAM,OAAO,MAAM,MAAM,GAAG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OAAO,SAAS,OAAO,KAAK,SAAS,QAAQ,KAAK,MAAO,QAAO,CAAC,OAAO,OAAO,KAAK,KAAK;AAAA,MACvG;AAAA,IACF;AAAA,EACF;AACA,SAAO;AACT;",
6
+ "names": ["start", "end"]
7
7
  }
@@ -41,5 +41,10 @@ export declare function zonedFields(time: number, timezone: string): ZonedFields
41
41
  * PineScript: 1582-10-05 is 1582-10-15). Out-of-range fields roll over like `Date.UTC`.
42
42
  */
43
43
  export declare function civilToUnix(year: number, month: number, day: number, hour?: number, minute?: number, second?: number): number;
44
- export declare function zonedToUnix(timezone: string, year: number, month: number, day: number, hour?: number, minute?: number, second?: number): number;
44
+ /**
45
+ * UNIX time (ms) of a wall-clock date in `timezone`. A wall time skipped by a clock change is read with the offset
46
+ * before the change (02:30 on a 02:00 -> 03:00 night is 03:30 after it); a wall time that occurs twice gives the
47
+ * later instant, or the earlier one with `earlier`.
48
+ */
49
+ export declare function zonedToUnix(timezone: string, year: number, month: number, day: number, hour?: number, minute?: number, second?: number, earlier?: boolean): number;
45
50
  //# sourceMappingURL=timezone.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"timezone.d.ts","sourceRoot":"","sources":["../../../src/time/timezone.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AA0GH,qDAAqD;AACrD,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW;IACX,KAAK,EAAE,MAAM,CAAC;IACd,WAAW;IACX,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,mEAAmE;IACnE,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,uFAAuF;AACvF,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAEjE;AAED,kEAAkE;AAClE,wBAAgB,WAAW,CAAC,IAAI,EAAE,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M,CAc9G;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CACzB,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,EACb,GAAG,EAAE,MAAM,EACX,IAAI,GAAE,MAAU,EAChB,MAAM,GAAE,MAAU,EAClB,MAAM,GAAE,MAAU,EAClB,OAAO,GAAE,OAAe,GACvB,MAAM,CAaR"}
@@ -126,14 +126,14 @@ function civilToUnix(year, month, day, hour = 0, minute = 0, second = 0) {
126
126
  const days = jdn - 2440588 + (day - 1);
127
127
  return days * MS_PER_DAY + Date.UTC(1970, 0, 1, hour, minute, second);
128
128
  }
129
- function zonedToUnix(timezone, year, month, day, hour = 0, minute = 0, second = 0) {
129
+ function zonedToUnix(timezone, year, month, day, hour = 0, minute = 0, second = 0, earlier = false) {
130
130
  const zone = resolveZone(timezone);
131
131
  const local = civilToUnix(year, month, day, hour, minute, second);
132
132
  if (zone.kind === "fixed") return local - zone.offsetMs;
133
133
  const before = offsetAt(zone, local - MS_PER_DAY);
134
134
  const after = offsetAt(zone, local + MS_PER_DAY);
135
135
  const candidates = [local - before, local - after].filter((t) => local - offsetAt(zone, t) === t);
136
- if (candidates.length) return Math.max(...candidates);
136
+ if (candidates.length) return earlier ? Math.min(...candidates) : Math.max(...candidates);
137
137
  return local - before;
138
138
  }
139
139
  //# sourceMappingURL=timezone.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/time/timezone.ts"],
4
- "sourcesContent": ["/**\n * Time zone resolution for the calendar functions.\n *\n * PineScript accepts two time zone notations:\n * - UTC/GMT offset notation: \"UTC\", \"UTC-5\", \"UTC+05:30\", \"GMT+0530\", \"GMT+05:30:00\", up to \u00B118:00\n * - IANA time zone database names, case-sensitive: \"America/New_York\", \"Etc/UTC\", \"US/Eastern\", \"CET\"\n *\n * \"utc+2\", \"america/new_york\", \"UTC+5:3\", \"UTC+5:30:15\", \"GMT+18:01\", \"EST\", \"MST\" and \"HST\" are\n * errors in PineScript, and so here.\n *\n * Offsets of IANA zones (daylight saving time and historical changes included)\n * come from the host's `Intl.DateTimeFormat`, so no time zone data ships with the library.\n */\n\nconst MS_PER_SECOND = 1000;\nconst MS_PER_DAY = 86_400_000;\nconst MAX_OFFSET_SECONDS = 18 * 3600;\n\nconst OFFSET_NOTATION = /^(?:UTC|GMT)(?:([+-])(\\d{1,2})(?::?(\\d{2})(?::?(\\d{2}))?)?)?$/;\n\n/** Time zone database names that PineScript rejects although `Intl` accepts them. */\nconst REJECTED_NAMES = new Set(['EST', 'MST', 'HST']);\n\nlet canonicalNames: Map<string, string> | undefined;\n\n/** False when `name` is a wrong-case spelling of a time zone name (`Intl` matches names case-insensitively). */\nfunction hasTimeZoneCase(name: string): boolean {\n if (name.split('/').some((segment) => !/^[A-Z]/.test(segment))) return false;\n canonicalNames ??= new Map(Intl.supportedValuesOf('timeZone').map((n) => [n.toLowerCase(), n]));\n const canonical = canonicalNames.get(name.toLowerCase());\n return canonical === undefined || canonical === name;\n}\n\ntype Zone =\n | { readonly kind: 'fixed'; readonly offsetMs: number }\n | {\n readonly kind: 'iana';\n readonly format: Intl.DateTimeFormat;\n /** Offset of each UTC hour (`floor(time / 1 h)`); null for an hour with an offset change inside */\n readonly hours: Map<number, number | null>;\n };\n\nconst MS_PER_HOUR = 3_600_000;\n/** Cached hours per zone before the cache restarts (about 11 years of hours) */\nconst MAX_CACHED_HOURS = 100_000;\n\nconst zones = new Map<string, Zone>();\n\nfunction resolveZone(timezone: string): Zone {\n let zone = zones.get(timezone);\n if (zone) return zone;\n\n const invalid = () =>\n new RangeError(\n `Invalid time zone \"${timezone}\": use UTC/GMT offset notation (\"UTC-5\", \"GMT+0530\") or an IANA name (\"America/New_York\")`\n );\n const m = OFFSET_NOTATION.exec(timezone);\n if (m) {\n const [, sign, h = '0', mi = '0', s] = m;\n const minutes = Number(mi);\n const seconds = s === undefined ? 0 : Number(s);\n if (minutes > 59 || seconds > 59 || (s !== undefined && h.length !== 2)) throw invalid();\n const offsetSeconds = Number(h) * 3600 + minutes * 60 + seconds;\n if (offsetSeconds > MAX_OFFSET_SECONDS) throw invalid();\n zone = { kind: 'fixed', offsetMs: (sign === '-' ? -offsetSeconds : offsetSeconds) * MS_PER_SECOND };\n } else {\n if (REJECTED_NAMES.has(timezone) || !hasTimeZoneCase(timezone)) throw invalid();\n let format: Intl.DateTimeFormat;\n try {\n format = new Intl.DateTimeFormat('en-US', {\n timeZone: timezone,\n hourCycle: 'h23',\n year: 'numeric',\n month: 'numeric',\n day: 'numeric',\n hour: 'numeric',\n minute: 'numeric',\n second: 'numeric',\n });\n } catch {\n throw invalid();\n }\n zone = { kind: 'iana', format, hours: new Map() };\n }\n zones.set(timezone, zone);\n return zone;\n}\n\n/**\n * Offset of the zone from UTC at instant `time`, in milliseconds (local = UTC + offset).\n * An offset change happens at most once in a UTC hour, so when the first and the last second of the hour have the\n * same offset, the whole hour has it: it is computed once and cached.\n */\nfunction offsetAt(zone: Zone, time: number): number {\n if (zone.kind === 'fixed') return zone.offsetMs;\n const hour = Math.floor(time / MS_PER_HOUR);\n let offset = zone.hours.get(hour);\n if (offset === undefined) {\n const first = formattedOffset(zone.format, hour * MS_PER_HOUR);\n const last = formattedOffset(zone.format, hour * MS_PER_HOUR + MS_PER_HOUR - MS_PER_SECOND);\n offset = first === last ? first : null;\n if (zone.hours.size >= MAX_CACHED_HOURS) zone.hours.clear();\n zone.hours.set(hour, offset);\n }\n return offset ?? formattedOffset(zone.format, time);\n}\n\n/** Offset of the zone at instant `time` (whole second), from the host's `Intl` time zone data. */\nfunction formattedOffset(format: Intl.DateTimeFormat, time: number): number {\n const wholeSecond = Math.floor(time / 1000) * 1000;\n const f: Record<string, number> = {};\n for (const part of format.formatToParts(wholeSecond)) {\n if (part.type !== 'literal') f[part.type] = Number(part.value);\n }\n const local = Date.UTC(f.year!, f.month! - 1, f.day!, f.hour!, f.minute!, f.second!);\n return local - wholeSecond;\n}\n\n/** Calendar fields of a UNIX time in a time zone. */\nexport interface ZonedFields {\n year: number;\n /** 1-12 */\n month: number;\n /** 1-31 */\n day: number;\n hour: number;\n minute: number;\n second: number;\n /** 1 = Sunday ... 7 = Saturday (PineScript dayofweek numbering) */\n dayOfWeek: number;\n}\n\n/** Offset of `timezone` from UTC at `time`, in milliseconds (local = UTC + offset). */\nexport function zoneOffset(time: number, timezone: string): number {\n return offsetAt(resolveZone(timezone), time);\n}\n\n/** Splits a UNIX time (ms) into calendar fields in `timezone`. */\nexport function zonedFields(time: number, timezone: string): ZonedFields {\n const local = new Date(time + offsetAt(resolveZone(timezone), time));\n return {\n year: local.getUTCFullYear(),\n month: local.getUTCMonth() + 1,\n day: local.getUTCDate(),\n hour: local.getUTCHours(),\n minute: local.getUTCMinutes(),\n second: local.getUTCSeconds(),\n dayOfWeek: local.getUTCDay() + 1,\n };\n}\n\n/**\n * Converts a wall-clock date and time in `timezone` to a UNIX time (ms).\n * Out-of-range fields roll over like `Date.UTC` (month 13 is January of the next year).\n *\n * As in PineScript: wall-clock times that occur twice (end of daylight saving time)\n * resolve to the later instant, and wall-clock times that do not exist (start of\n * daylight saving time) are shifted forward by the length of the gap.\n */\n/**\n * UNIX time (ms) of a UTC wall-clock date: Gregorian calendar from 1582-10-15, Julian calendar before it (as\n * PineScript: 1582-10-05 is 1582-10-15). Out-of-range fields roll over like `Date.UTC`.\n */\nexport function civilToUnix(year: number, month: number, day: number, hour = 0, minute = 0, second = 0): number {\n const gregorian = Date.UTC(year, month - 1, day, hour, minute, second);\n // normalized year / month / day of the Gregorian reading decides the calendar\n const d = new Date(Date.UTC(year, month - 1, 1));\n const y = d.getUTCFullYear();\n const m = d.getUTCMonth() + 1;\n if (y > 1582 || (y === 1582 && (m > 10 || (m === 10 && day >= 15)))) return gregorian;\n // Julian day number of y-m-1, then the day offset and the time of day\n const a = Math.floor((14 - m) / 12);\n const yy = y + 4800 - a;\n const mm = m + 12 * a - 3;\n const jdn = 1 + Math.floor((153 * mm + 2) / 5) + 365 * yy + Math.floor(yy / 4) - 32083;\n const days = jdn - 2440588 + (day - 1);\n return days * MS_PER_DAY + Date.UTC(1970, 0, 1, hour, minute, second);\n}\n\nexport function zonedToUnix(\n timezone: string,\n year: number,\n month: number,\n day: number,\n hour: number = 0,\n minute: number = 0,\n second: number = 0\n): number {\n const zone = resolveZone(timezone);\n const local = civilToUnix(year, month, day, hour, minute, second);\n if (zone.kind === 'fixed') return local - zone.offsetMs;\n\n // At most one offset transition happens within a day of `local`: the offsets\n // one day before and one day after are the two candidates.\n const before = offsetAt(zone, local - MS_PER_DAY);\n const after = offsetAt(zone, local + MS_PER_DAY);\n const candidates = [local - before, local - after].filter((t) => local - offsetAt(zone, t) === t);\n if (candidates.length) return Math.max(...candidates);\n return local - before;\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAcA,MAAM,gBAAgB;AACtB,MAAM,aAAa;AACnB,MAAM,qBAAqB,KAAK;AAEhC,MAAM,kBAAkB;AAGxB,MAAM,iBAAiB,oBAAI,IAAI,CAAC,OAAO,OAAO,KAAK,CAAC;AAEpD,IAAI;AAGJ,SAAS,gBAAgB,MAAuB;AAC9C,MAAI,KAAK,MAAM,GAAG,EAAE,KAAK,CAAC,YAAY,CAAC,SAAS,KAAK,OAAO,CAAC,EAAG,QAAO;AACvE,qBAAmB,IAAI,IAAI,KAAK,kBAAkB,UAAU,EAAE,IAAI,CAAC,MAAM,CAAC,EAAE,YAAY,GAAG,CAAC,CAAC,CAAC;AAC9F,QAAM,YAAY,eAAe,IAAI,KAAK,YAAY,CAAC;AACvD,SAAO,cAAc,UAAa,cAAc;AAClD;AAWA,MAAM,cAAc;AAEpB,MAAM,mBAAmB;AAEzB,MAAM,QAAQ,oBAAI,IAAkB;AAEpC,SAAS,YAAY,UAAwB;AAC3C,MAAI,OAAO,MAAM,IAAI,QAAQ;AAC7B,MAAI,KAAM,QAAO;AAEjB,Q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M,IAAI,IAAI,KAAK,KAAK,IAAI,MAAM,QAAQ,GAAG,CAAC,CAAC;AAC/C,QAAM,IAAI,EAAE,eAAe;AAC3B,QAAM,IAAI,EAAE,YAAY,IAAI;AAC5B,MAAI,IAAI,QAAS,MAAM,SAAS,IAAI,MAAO,MAAM,MAAM,OAAO,IAAO,QAAO;AAE5E,QAAM,IAAI,KAAK,OAAO,KAAK,KAAK,EAAE;AAClC,QAAM,KAAK,IAAI,OAAO;AACtB,QAAM,KAAK,IAAI,KAAK,IAAI;AACxB,QAAM,MAAM,IAAI,KAAK,OAAO,MAAM,KAAK,KAAK,CAAC,IAAI,MAAM,KAAK,KAAK,MAAM,KAAK,CAAC,IAAI;AACjF,QAAM,OAAO,MAAM,WAAW,MAAM;AACpC,SAAO,OAAO,aAAa,KAAK,IAAI,MAAM,GAAG,GAAG,MAAM,QAAQ,MAAM;AACtE;AAEO,SAAS,YACd,UACA,MACA,OACA,KACA,OAAe,GACf,SAAiB,GACjB,SAAiB,GACT;AACR,QAAM,OAAO,YAAY,QAAQ;AACjC,QAAM,QAAQ,YAAY,MAAM,OAAO,KAAK,MAAM,QAAQ,MAAM;AAChE,MAAI,KAAK,SAAS,QAAS,QAAO,QAAQ,KAAK;AAI/C,QAAM,SAAS,SAAS,MAAM,QAAQ,UAAU;AAChD,QAAM,QAAQ,SAAS,MAAM,QAAQ,UAAU;AAC/C,QAAM,aAAa,CAAC,QAAQ,QAAQ,QAAQ,KAAK,EAAE,OAAO,CAAC,MAAM,QAAQ,SAAS,MAAM,CAAC,MAAM,CAAC;AAChG,MAAI,WAAW,OAAQ,QAAO,KAAK,IAAI,GAAG,UAAU;AACpD,SAAO,QAAQ;AACjB;",
4
+ "sourcesContent": ["/**\n * Time zone resolution for the calendar functions.\n *\n * PineScript accepts two time zone notations:\n * - UTC/GMT offset notation: \"UTC\", \"UTC-5\", \"UTC+05:30\", \"GMT+0530\", \"GMT+05:30:00\", up to \u00B118:00\n * - IANA time zone database names, case-sensitive: \"America/New_York\", \"Etc/UTC\", \"US/Eastern\", \"CET\"\n *\n * \"utc+2\", \"america/new_york\", \"UTC+5:3\", \"UTC+5:30:15\", \"GMT+18:01\", \"EST\", \"MST\" and \"HST\" are\n * errors in PineScript, and so here.\n *\n * Offsets of IANA zones (daylight saving time and historical changes included)\n * come from the host's `Intl.DateTimeFormat`, so no time zone data ships with the library.\n */\n\nconst MS_PER_SECOND = 1000;\nconst MS_PER_DAY = 86_400_000;\nconst MAX_OFFSET_SECONDS = 18 * 3600;\n\nconst OFFSET_NOTATION = /^(?:UTC|GMT)(?:([+-])(\\d{1,2})(?::?(\\d{2})(?::?(\\d{2}))?)?)?$/;\n\n/** Time zone database names that PineScript rejects although `Intl` accepts them. */\nconst REJECTED_NAMES = new Set(['EST', 'MST', 'HST']);\n\nlet canonicalNames: Map<string, string> | undefined;\n\n/** False when `name` is a wrong-case spelling of a time zone name (`Intl` matches names case-insensitively). */\nfunction hasTimeZoneCase(name: string): boolean {\n if (name.split('/').some((segment) => !/^[A-Z]/.test(segment))) return false;\n canonicalNames ??= new Map(Intl.supportedValuesOf('timeZone').map((n) => [n.toLowerCase(), n]));\n const canonical = canonicalNames.get(name.toLowerCase());\n return canonical === undefined || canonical === name;\n}\n\ntype Zone =\n | { readonly kind: 'fixed'; readonly offsetMs: number }\n | {\n readonly kind: 'iana';\n readonly format: Intl.DateTimeFormat;\n /** Offset of each UTC hour (`floor(time / 1 h)`); null for an hour with an offset change inside */\n readonly hours: Map<number, number | null>;\n };\n\nconst MS_PER_HOUR = 3_600_000;\n/** Cached hours per zone before the cache restarts (about 11 years of hours) */\nconst MAX_CACHED_HOURS = 100_000;\n\nconst zones = new Map<string, Zone>();\n\nfunction resolveZone(timezone: string): Zone {\n let zone = zones.get(timezone);\n if (zone) return zone;\n\n const invalid = () =>\n new RangeError(\n `Invalid time zone \"${timezone}\": use UTC/GMT offset notation (\"UTC-5\", \"GMT+0530\") or an IANA name (\"America/New_York\")`\n );\n const m = OFFSET_NOTATION.exec(timezone);\n if (m) {\n const [, sign, h = '0', mi = '0', s] = m;\n const minutes = Number(mi);\n const seconds = s === undefined ? 0 : Number(s);\n if (minutes > 59 || seconds > 59 || (s !== undefined && h.length !== 2)) throw invalid();\n const offsetSeconds = Number(h) * 3600 + minutes * 60 + seconds;\n if (offsetSeconds > MAX_OFFSET_SECONDS) throw invalid();\n zone = { kind: 'fixed', offsetMs: (sign === '-' ? -offsetSeconds : offsetSeconds) * MS_PER_SECOND };\n } else {\n if (REJECTED_NAMES.has(timezone) || !hasTimeZoneCase(timezone)) throw invalid();\n let format: Intl.DateTimeFormat;\n try {\n format = new Intl.DateTimeFormat('en-US', {\n timeZone: timezone,\n hourCycle: 'h23',\n year: 'numeric',\n month: 'numeric',\n day: 'numeric',\n hour: 'numeric',\n minute: 'numeric',\n second: 'numeric',\n });\n } catch {\n throw invalid();\n }\n zone = { kind: 'iana', format, hours: new Map() };\n }\n zones.set(timezone, zone);\n return zone;\n}\n\n/**\n * Offset of the zone from UTC at instant `time`, in milliseconds (local = UTC + offset).\n * An offset change happens at most once in a UTC hour, so when the first and the last second of the hour have the\n * same offset, the whole hour has it: it is computed once and cached.\n */\nfunction offsetAt(zone: Zone, time: number): number {\n if (zone.kind === 'fixed') return zone.offsetMs;\n const hour = Math.floor(time / MS_PER_HOUR);\n let offset = zone.hours.get(hour);\n if (offset === undefined) {\n const first = formattedOffset(zone.format, hour * MS_PER_HOUR);\n const last = formattedOffset(zone.format, hour * MS_PER_HOUR + MS_PER_HOUR - MS_PER_SECOND);\n offset = first === last ? first : null;\n if (zone.hours.size >= MAX_CACHED_HOURS) zone.hours.clear();\n zone.hours.set(hour, offset);\n }\n return offset ?? formattedOffset(zone.format, time);\n}\n\n/** Offset of the zone at instant `time` (whole second), from the host's `Intl` time zone data. */\nfunction formattedOffset(format: Intl.DateTimeFormat, time: number): number {\n const wholeSecond = Math.floor(time / 1000) * 1000;\n const f: Record<string, number> = {};\n for (const part of format.formatToParts(wholeSecond)) {\n if (part.type !== 'literal') f[part.type] = Number(part.value);\n }\n const local = Date.UTC(f.year!, f.month! - 1, f.day!, f.hour!, f.minute!, f.second!);\n return local - wholeSecond;\n}\n\n/** Calendar fields of a UNIX time in a time zone. */\nexport interface ZonedFields {\n year: number;\n /** 1-12 */\n month: number;\n /** 1-31 */\n day: number;\n hour: number;\n minute: number;\n second: number;\n /** 1 = Sunday ... 7 = Saturday (PineScript dayofweek numbering) */\n dayOfWeek: number;\n}\n\n/** Offset of `timezone` from UTC at `time`, in milliseconds (local = UTC + offset). */\nexport function zoneOffset(time: number, timezone: string): number {\n return offsetAt(resolveZone(timezone), time);\n}\n\n/** Splits a UNIX time (ms) into calendar fields in `timezone`. */\nexport function zonedFields(time: number, timezone: string): ZonedFields {\n const local = new Date(time + offsetAt(resolveZone(timezone), time));\n return {\n year: local.getUTCFullYear(),\n month: local.getUTCMonth() + 1,\n day: local.getUTCDate(),\n hour: local.getUTCHours(),\n minute: local.getUTCMinutes(),\n second: local.getUTCSeconds(),\n dayOfWeek: local.getUTCDay() + 1,\n };\n}\n\n/**\n * Converts a wall-clock date and time in `timezone` to a UNIX time (ms).\n * Out-of-range fields roll over like `Date.UTC` (month 13 is January of the next year).\n *\n * As in PineScript: wall-clock times that occur twice (end of daylight saving time)\n * resolve to the later instant, and wall-clock times that do not exist (start of\n * daylight saving time) are shifted forward by the length of the gap.\n */\n/**\n * UNIX time (ms) of a UTC wall-clock date: Gregorian calendar from 1582-10-15, Julian calendar before it (as\n * PineScript: 1582-10-05 is 1582-10-15). Out-of-range fields roll over like `Date.UTC`.\n */\nexport function civilToUnix(year: number, month: number, day: number, hour = 0, minute = 0, second = 0): number {\n const gregorian = Date.UTC(year, month - 1, day, hour, minute, second);\n // normalized year / month / day of the Gregorian reading decides the calendar\n const d = new Date(Date.UTC(year, month - 1, 1));\n const y = d.getUTCFullYear();\n const m = d.getUTCMonth() + 1;\n if (y > 1582 || (y === 1582 && (m > 10 || (m === 10 && day >= 15)))) return gregorian;\n // Julian day number of y-m-1, then the day offset and the time of day\n const a = Math.floor((14 - m) / 12);\n const yy = y + 4800 - a;\n const mm = m + 12 * a - 3;\n const jdn = 1 + Math.floor((153 * mm + 2) / 5) + 365 * yy + Math.floor(yy / 4) - 32083;\n const days = jdn - 2440588 + (day - 1);\n return days * MS_PER_DAY + Date.UTC(1970, 0, 1, hour, minute, second);\n}\n\n/**\n * UNIX time (ms) of a wall-clock date in `timezone`. A wall time skipped by a clock change is read with the offset\n * before the change (02:30 on a 02:00 -> 03:00 night is 03:30 after it); a wall time that occurs twice gives the\n * later instant, or the earlier one with `earlier`.\n */\nexport function zonedToUnix(\n timezone: string,\n year: number,\n month: number,\n day: number,\n hour: number = 0,\n minute: number = 0,\n second: number = 0,\n earlier: boolean = false\n): number {\n const zone = resolveZone(timezone);\n const local = civilToUnix(year, month, day, hour, minute, second);\n if (zone.kind === 'fixed') return local - zone.offsetMs;\n\n // At most one offset transition happens within a day of `local`: the offsets\n // one day before and one day after are the two candidates.\n const before = offsetAt(zone, local - MS_PER_DAY);\n const after = offsetAt(zone, local + MS_PER_DAY);\n const candidates = [local - before, local - after].filter((t) => local - offsetAt(zone, t) === t);\n // a wall time that occurs twice: the later instant, or the earlier one with `earlier`\n if (candidates.length) return earlier ? Math.min(...candidates) : Math.max(...candidates);\n return local - before;\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAcA,MAAM,gBAAgB;AACtB,MAAM,aAAa;AACnB,MAAM,qBAAqB,KAAK;AAEhC,MAAM,kBAAkB;AAGxB,MAAM,iBAAiB,oBAAI,IAAI,CAAC,OAAO,OAAO,KAAK,CAAC;AAEpD,IAAI;AAGJ,SAAS,gBAAgB,MAAuB;AAC9C,MAAI,KAAK,MAAM,GAAG,EAAE,KAAK,CAAC,YAAY,CAAC,SAAS,KAAK,OAAO,CAAC,EAAG,QAAO;AACvE,qBAAmB,IAAI,IAAI,KAAK,kB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AQ,QAAQ,QAAQ,KAAK,EAAE,OAAO,CAAC,MAAM,QAAQ,SAAS,MAAM,CAAC,MAAM,CAAC;AAEhG,MAAI,WAAW,OAAQ,QAAO,UAAU,KAAK,IAAI,GAAG,UAAU,IAAI,KAAK,IAAI,GAAG,UAAU;AACxF,SAAO,QAAQ;AACjB;",
6
6
  "names": []
7
7
  }
@@ -79,7 +79,7 @@ export interface FillOptions {
79
79
  /**
80
80
  * Input parameter type
81
81
  */
82
- export type InputType = 'int' | 'float' | 'bool' | 'string' | 'source' | 'color' | 'timeframe' | 'session' | 'time';
82
+ export type InputType = 'int' | 'float' | 'bool' | 'string' | 'source' | 'color' | 'timeframe' | 'session' | 'time' | 'symbol';
83
83
  /**
84
84
  * Input parameter metadata
85
85
  */
@@ -1 +1 @@
1
- {"version":3,"file":"metadata.d.ts","sourceRoot":"","sources":["../../../src/types/metadata.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,UAAU,GAAG,WAAW,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,QAAQ,GAAG,YAAY,GAAG,QAAQ,GAAG,kBAAkB,CAAC;AAE/J;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAEtD;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,KAAK,GAAG,MAAM,GAAG,aAAa,GAAG,aAAa,GAAG,MAAM,CAAC;AAElF;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,iBAAiB;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,6CAA6C;IAC7C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,iBAAiB;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,iBAAiB;IACjB,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,oGAAoG;IACpG,SAAS,CAAC,EAAE,SAAS,CAA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C;IAC3B,yCAAyC;IACzC,SAAS,CAAC,EAAE,YAAY,EAAE,CAAC;IAC3B,sCAAsC;IACtC,MAAM,CAAC,EAAE,SAAS,EAAE,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK;IAChE,yBAAyB;IACzB,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,yBAAyB;IACzB,SAAS,EAAE,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK,QAAQ,EAAE,GAAG,SAAS,EAAE,CAAC;CACtD,CAAC"}
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/types/metadata.ts"],
4
- "sourcesContent": ["/**\n * @fileoverview Type definitions for indicator metadata\n * These types define the structure of data returned by indicators\n * @module types/metadata\n */\n\n/**\n * Plot style options\n */\nexport type PlotStyle = 'line' | 'stepline' | 'histogram' | 'area' | 'circles' | 'columns' | 'cross' | 'areabr' | 'steplinebr' | 'linebr' | 'stepline_diamond';\n\n/**\n * Line style options\n */\nexport type LineStyle = 'solid' | 'dashed' | 'dotted';\n\n/**\n * Plot display options\n */\nexport type PlotDisplay = 'all' | 'none' | 'data_window' | 'status_line' | 'pane';\n\n/**\n * Options for a plot\n */\nexport interface PlotOptions {\n /** Plot title */\n title?: string;\n /** Plot color (hex string or named color) */\n color?: string;\n /** Line width */\n linewidth?: number;\n /** Plot style */\n style?: PlotStyle;\n /** Line style (PineScript `linestyle`); default solid. A constant or an input value, not per bar */\n linestyle?: LineStyle;\n /** Track price on price scale */\n trackprice?: boolean;\n /** Histogram base value */\n histbase?: number;\n /** Offset from current bar */\n offset?: number;\n /** Join gaps in data */\n join?: boolean;\n /** User can edit */\n editable?: boolean;\n /** Display mode */\n display?: PlotDisplay;\n /** Transparency (0-100) */\n transp?: number;\n /** Draw the plot on the main chart pane even when the indicator is not an overlay; default false */\n force_overlay?: boolean;\n}\n\n/**\n * Options for a horizontal line\n */\nexport interface HLineOptions {\n /** Line title */\n title?: string;\n /** Line color */\n color?: string;\n /** Line style (PineScript default: dashed) */\n linestyle?: LineStyle;\n /** Line width */\n linewidth?: number;\n /** User can edit */\n editable?: boolean;\n}\n\n/**\n * Options for a fill\n */\nexport interface FillOptions {\n /** Fill color */\n color?: string;\n /** Transparency (0-100) */\n transp?: number;\n /** Fill title */\n title?: string;\n /** User can edit */\n editable?: boolean;\n /** Fill gaps in data */\n fillgaps?: boolean;\n}\n\n/**\n * Input parameter type\n */\nexport type InputType = 'int' | 'float' | 'bool' | 'string' | 'source' | 'color' | 'timeframe' | 'session' | 'time';\n\n/**\n * Input parameter metadata\n */\nexport interface InputMetadata {\n /** Input type */\n type: InputType;\n /** Internal name (snake_case) */\n name: string;\n /** Display title */\n title: string;\n /** Default value */\n defval: any;\n /** Minimum value (for numeric inputs) */\n minval?: number;\n /** Maximum value (for numeric inputs) */\n maxval?: number;\n /** Step size (for numeric inputs) */\n step?: number;\n /** Tooltip text */\n tooltip?: string;\n /** Inline group */\n inline?: string;\n /** Parameter group */\n group?: string;\n /** Options for dropdown (for string/source inputs) */\n options?: any[];\n /** Confirm before changing */\n confirm?: boolean;\n}\n\n/**\n * Plot metadata\n */\nexport interface PlotMetadata {\n /** Variable name for the plot */\n varName: string;\n /** Plot title */\n title: string;\n /** Plot color */\n color: string;\n /** Line width */\n linewidth: number;\n /** Plot style */\n style: PlotStyle;\n}\n\n/**\n * Indicator metadata\n */\nexport interface IndicatorMetadata {\n /** Indicator title */\n title: string;\n /** Short title */\n shorttitle?: string;\n /** Overlay on main chart */\n overlay: boolean;\n /** Number format precision */\n precision?: number;\n /** Number format */\n format?: string;\n /** Timeframe */\n timeframe?: string;\n /** Show gaps in timeframes */\n timeframe_gaps?: boolean;\n /** Input parameters */\n inputs?: InputMetadata[];\n /** Plots */\n plots?: PlotMetadata[];\n}\n\n/**\n * Time-value pair for charting\n */\nexport interface TimeValue {\n /** Time (timestamp or string) */\n time: any;\n /** Value */\n value: number;\n /** Per-bar color override */\n color?: string;\n}\n\n/**\n * Plot data with options\n */\nexport interface PlotData {\n /** Time-value pairs */\n data: TimeValue[];\n /** Plot options */\n options?: PlotOptions;\n}\n\n/**\n * Horizontal line data\n */\nexport interface HLineData {\n /** Y-axis value */\n value: number;\n /** Line options */\n options?: HLineOptions;\n}\n\n/**\n * Fill data (area between two plots)\n */\nexport interface FillData {\n /** First plot index or name */\n plot1: number | string;\n /** Second plot index or name */\n plot2: number | string;\n /** Fill options */\n options?: FillOptions;\n /** Per-bar fill colors (overrides static options.color) */\n colors?: string[];\n /** Gradient fill (PineScript `fill(p1, p2, top_value, bottom_value, top_color, bottom_color)`) */\n gradient?: FillGradient;\n}\n\n/**\n * Gradient of a fill, one entry per bar. PineScript rules: the colour\n * changes with the price, `topColor` at `topValue` and `bottomColor` at `bottomValue`; outside that range the end\n * colour is kept; each bar has its own gradient (the part from bar i-1 to bar i uses the values of bar i).\n */\nexport interface FillGradient {\n /** Price of `topColor`, per bar */\n topValue: number[];\n /** Price of `bottomColor`, per bar */\n bottomValue: number[];\n /** Colour at `topValue`, per bar (null: na) */\n topColor: Array<string | null>;\n /** Colour at `bottomValue`, per bar (null: na) */\n bottomColor: Array<string | null>;\n}\n\n/**\n * Marker location on the chart (PineScript plotshape/plotchar `location.*`)\n */\nexport type MarkerLocation = 'abovebar' | 'belowbar' | 'top' | 'bottom' | 'absolute';\n\n/**\n * PineScript size constant (`size.auto`, `size.tiny`, ...)\n */\nexport type PineSize = 'auto' | 'tiny' | 'small' | 'normal' | 'large' | 'huge';\n\n/**\n * Marker size (PineScript size.* constants)\n */\nexport type MarkerSize = PineSize;\n\n/**\n * Shape style (PineScript shape.* constants)\n */\nexport type ShapeStyle =\n | 'xcross'\n | 'cross'\n | 'triangleup'\n | 'triangledown'\n | 'flag'\n | 'circle'\n | 'arrowup'\n | 'arrowdown'\n | 'labelup'\n | 'labeldown'\n | 'square'\n | 'diamond';\n\n/**\n * Position of a marker:\n * - aboveBar / belowBar / inBar: next to the bar (PineScript location.abovebar / location.belowbar)\n * - atPriceTop / atPriceBottom / atPriceMiddle: at `price` (PineScript location.absolute), with the meaning of the\n * lightweight-charts price positions: atPriceTop has the shape above the price, its bottom (the tip of a label) on\n * the price (shape.labeldown); atPriceBottom has the shape below the price, its top on the price (shape.labelup);\n * atPriceMiddle centres the shape on the price (other shapes)\n * - top / bottom: at the top / bottom edge of the pane of the indicator (PineScript location.top / location.bottom),\n * the price pane for an overlay indicator or with forceOverlay\n */\nexport type MarkerPosition =\n | 'aboveBar'\n | 'belowBar'\n | 'inBar'\n | 'atPriceTop'\n | 'atPriceBottom'\n | 'atPriceMiddle'\n | 'top'\n | 'bottom';\n\n/**\n * Marker shape (PineScript shape.* in the lightweight-charts spelling)\n */\nexport type MarkerShape =\n | 'arrowUp'\n | 'arrowDown'\n | 'circle'\n | 'square'\n | 'labelUp'\n | 'labelDown'\n | 'triangleUp'\n | 'triangleDown'\n | 'cross'\n | 'xcross'\n | 'diamond'\n | 'flag';\n\n/**\n * One marker: a plotshape()/plotchar() marker on a bar where the condition held, or a marker of a built-in indicator\n */\nexport interface MarkerData {\n /** Time of the bar the marker is displayed on (offset already applied) */\n time: number;\n /** Where the marker is drawn */\n position: MarkerPosition;\n /** Price of the atPrice* positions (required with them) */\n price?: number;\n /** Shape. A plotchar marker also has `char`: the character is drawn in place of the shape */\n shape: MarkerShape;\n /**\n * Shape colour (the character colour of a plotchar marker). A fully transparent colour ('transparent',\n * '#rrggbb00', 'rgba(r, g, b, 0)') draws no shape, as PineScript `color = na`; the text is still drawn\n */\n color: string;\n /** Text; a line feed starts a new line */\n text?: string;\n /**\n * Text colour (PineScript textcolor). When omitted: white inside label shapes (labelUp / labelDown), the shape\n * colour for the other shapes\n */\n textColor?: string;\n /** Size multiplier (1 = default size) or a PineScript size */\n size?: number | PineSize;\n /** PineScript force_overlay = true: the marker of a non-overlay indicator is drawn on the price pane */\n forceOverlay?: boolean;\n /** Id of the plotshape/plotchar declaration that produced it (script markers) */\n id?: string;\n /** plotchar character, drawn in place of the shape */\n char?: string;\n /** Hover tooltip */\n tooltip?: string;\n}\n\n/**\n * Per-bar arrow from plotarrow(): up arrow for a positive value, down arrow for a negative value\n */\nexport interface ArrowData {\n /** Time of the bar the arrow is displayed on (offset already applied) */\n time: any;\n /** Id of the plotarrow declaration that produced it */\n id: string;\n /** Series value (non-zero): its sign gives the direction, its absolute value the height */\n value: number;\n /** Arrow color (colorup or colordown of that bar) */\n color: string;\n}\n\n/**\n * Per-bar candle color (barcolor() output)\n */\nexport interface BarColorData {\n /** Time of the colored bar (offset already applied) */\n time: number;\n /** Color */\n color: string;\n}\n\n/**\n * Per-bar background color (bgcolor() output)\n */\nexport interface BgColorData {\n /** Time of the colored bar (offset already applied) */\n time: number;\n /** Color (with its transparency) */\n color: string;\n /** PineScript bgcolor(..., force_overlay = true): drawn on the price pane even for a non-overlay indicator */\n forceOverlay?: boolean;\n}\n\n/**\n * One candle of plotcandle() (or of a built-in indicator that draws candles)\n */\nexport interface PlotCandleData {\n time: number;\n open: number;\n high: number;\n low: number;\n close: number;\n /** Body colour */\n color?: string;\n borderColor?: string;\n wickColor?: string;\n /** PineScript force_overlay = true: the candles of a non-overlay indicator are drawn on the price pane */\n forceOverlay?: boolean;\n}\n\n/**\n * One bar of plotbar(): an OHLC bar (a vertical line from low to high, the open tick on the left, the close tick on\n * the right)\n */\nexport interface PlotBarData {\n time: number;\n open: number;\n high: number;\n low: number;\n close: number;\n color?: string;\n /** PineScript force_overlay = true: the bars of a non-overlay indicator are drawn on the price pane */\n forceOverlay?: boolean;\n}\n\n/** PineScript label style (`label.style_*` without the prefix) */\nexport type LabelStyle =\n | 'none'\n | 'xcross'\n | 'cross'\n | 'triangleup'\n | 'triangledown'\n | 'flag'\n | 'circle'\n | 'arrowup'\n | 'arrowdown'\n | 'label_up'\n | 'label_down'\n | 'label_left'\n | 'label_right'\n | 'label_lower_left'\n | 'label_lower_right'\n | 'label_upper_left'\n | 'label_upper_right'\n | 'label_center'\n | 'square'\n | 'diamond'\n | 'text_outline';\n\n// Drawing outputs (labels, lines, boxes, linefills, polylines, tables). A field the script did not set is omitted and\n// the renderer uses the PineScript default; a colour set to na is 'transparent'. A point on a bar after the last bar\n// (PineScript bar_index + k) has the time of that future bar (see barTime). The same applies to markers and plots.\n\n/**\n * A label (PineScript label.new)\n */\nexport interface LabelData {\n time: number;\n /** Price; not used with yloc 'abovebar' / 'belowbar' */\n price: number;\n text: string;\n /** Background, border and arrow colour. Omitted: #2962FF (color.blue; #2196F3 in a v4 script) */\n color?: string;\n /** Omitted: #FFFFFF in a v6 script, #363A45 in v4 and v5 (the result does not carry the version) */\n textColor?: string;\n /** 'none': text only, no background (PineScript label.style_none). Omitted: 'label_down' */\n style?: LabelStyle;\n /** Omitted: 'normal' */\n size?: PineSize | number;\n /**\n * PineScript yloc: 'price' (default) places the label at `price`; 'abovebar' / 'belowbar' place it above the bar\n * high / below the bar low and ignore `price` (the renderer reads the bar at `time`).\n */\n yloc?: 'price' | 'abovebar' | 'belowbar';\n /** Omitted: 'center' */\n textAlign?: 'left' | 'center' | 'right';\n tooltip?: string;\n fontFamily?: 'default' | 'monospace';\n /** PineScript text.format_* flags: 0 none, 1 bold, 2 italic, 3 bold + italic */\n textFormatting?: number;\n /** PineScript force_overlay = true: the label of a non-overlay indicator is drawn on the price pane */\n forceOverlay?: boolean;\n}\n\n/**\n * A line (PineScript line.new)\n */\nexport interface LineDrawingData {\n time1: number;\n price1: number;\n time2: number;\n price2: number;\n /** Omitted: #2962FF (color.blue; #2196F3 in a v4 script) */\n color?: string;\n /** Omitted: 1. A width of 0 is kept (PineScript `width = 0`) */\n width?: number;\n /** Omitted: 'solid' */\n style?: 'solid' | 'dashed' | 'dotted' | 'arrow_left' | 'arrow_right' | 'arrow_both';\n extend?: 'none' | 'left' | 'right' | 'both';\n /** PineScript force_overlay = true: the line of a non-overlay indicator is drawn on the price pane */\n forceOverlay?: boolean;\n}\n\n/**\n * A rectangle (PineScript box.new): time1 / price1 are the left / top, time2 / price2 the right / bottom\n */\nexport interface BoxData {\n time1: number;\n price1: number;\n time2: number;\n price2: number;\n /** Omitted: #2962FF (color.blue; #2196F3 in a v4 script) */\n bgColor?: string;\n /** Omitted: #2962FF (color.blue; #2196F3 in a v4 script) */\n borderColor?: string;\n /** Omitted: 1. A width of 0 is no border (PineScript `border_width = 0`) */\n borderWidth?: number;\n /** Omitted: 'solid' */\n borderStyle?: 'solid' | 'dashed' | 'dotted';\n text?: string;\n /** Omitted: #FFFFFF in a v6 script, #363A45 in v5 (the result does not carry the version) */\n textColor?: string;\n /** Omitted: 'auto' */\n textSize?: PineSize | number;\n /** Omitted: 'center' */\n textHAlign?: 'left' | 'center' | 'right';\n /** Omitted: 'center' */\n textVAlign?: 'top' | 'center' | 'bottom';\n textWrap?: 'none' | 'auto';\n fontFamily?: 'default' | 'monospace';\n /** PineScript text.format_* flags: 0 none, 1 bold, 2 italic, 3 bold + italic */\n textFormatting?: number;\n /** PineScript box extend: the box continues to the left / right edge of the chart */\n extend?: 'none' | 'left' | 'right' | 'both';\n /** PineScript force_overlay = true: the box of a non-overlay indicator is drawn on the price pane */\n forceOverlay?: boolean;\n}\n\n/**\n * The area between two lines (PineScript linefill.new), with the two lines as drawn (their extend included)\n */\nexport interface LinefillData {\n line1: LineDrawingData;\n line2: LineDrawingData;\n color?: string;\n}\n\n/**\n * A polyline (PineScript polyline.new)\n */\nexport interface PolylineData {\n points: Array<{ time: number; price: number }>;\n /** Curved segments between the points */\n curved?: boolean;\n /** The last point is connected to the first */\n closed?: boolean;\n /** Omitted: #2962FF (color.blue) */\n lineColor?: string;\n /** Fill of the area inside the polyline. Omitted: no fill */\n fillColor?: string;\n lineStyle?: 'solid' | 'dotted' | 'dashed' | 'arrow_left' | 'arrow_right' | 'arrow_both';\n /** Omitted: 1 */\n lineWidth?: number;\n /** PineScript force_overlay = true: the polyline of a non-overlay indicator is drawn on the price pane */\n forceOverlay?: boolean;\n}\n\n/** Table position (PineScript position.*) */\nexport type TablePosition =\n | 'top_left'\n | 'top_center'\n | 'top_right'\n | 'middle_left'\n | 'middle_center'\n | 'middle_right'\n | 'bottom_left'\n | 'bottom_center'\n | 'bottom_right';\n\n/**\n * A table cell (PineScript table.cell)\n */\nexport interface TableCellData {\n row: number;\n column: number;\n text: string;\n /** Omitted: no background */\n bgColor?: string;\n /** Omitted: #363A45 (in v4, v5 and v6 scripts) */\n textColor?: string;\n /** Omitted: 'auto' */\n textSize?: PineSize | number;\n /** Width in % of the chart width; 0 fits the text */\n width?: number;\n /** Height in % of the chart height; 0 fits the text */\n height?: number;\n textHAlign?: 'left' | 'center' | 'right';\n textVAlign?: 'top' | 'center' | 'bottom';\n tooltip?: string;\n fontFamily?: 'default' | 'monospace';\n /** PineScript text.format_* flags: 0 none, 1 bold, 2 italic, 3 bold + italic */\n textFormatting?: number;\n}\n\n/**\n * Merged cells of a table (PineScript table.merge_cells): the cell at the start column / row covers the range and\n * gives its content\n */\nexport interface TableMergeData {\n startColumn: number;\n startRow: number;\n endColumn: number;\n endRow: number;\n}\n\n/**\n * A table (PineScript table.new)\n */\nexport interface TableData {\n position: TablePosition;\n columns: number;\n rows: number;\n cells: TableCellData[];\n merges?: TableMergeData[];\n /** Omitted: no background */\n bgColor?: string;\n /** Omitted: no frame */\n frameColor?: string;\n /** Omitted: 0 */\n frameWidth?: number;\n /** Omitted: no cell borders */\n borderColor?: string;\n /** Omitted: 0 */\n borderWidth?: number;\n /** PineScript force_overlay = true: the table of a non-overlay indicator is drawn on the price pane */\n forceOverlay?: boolean;\n}\n\n/**\n * Complete indicator calculation result\n */\nexport interface IndicatorResult {\n /** Indicator metadata */\n metadata: IndicatorMetadata;\n /** Plot data as Record mapping plot IDs to TimeValue arrays */\n plots: Record<string, TimeValue[]>;\n /** Horizontal lines */\n hlines?: HLineData[];\n /** Fills */\n fills?: FillData[];\n /** Markers from plotshape()/plotchar() */\n markers?: MarkerData[];\n /** Arrows from plotarrow() */\n arrows?: ArrowData[];\n /** Background colors from bgcolor() */\n bgColors?: BgColorData[];\n /** Bar colors from barcolor() */\n barColors?: BarColorData[];\n /** Candles from plotcandle(), keyed by plotcandle id */\n plotCandles?: Record<string, PlotCandleData[]>;\n /** OHLC bars from plotbar(), keyed by plotbar id */\n plotBars?: Record<string, PlotBarData[]>;\n /** Labels alive after the last bar */\n labels?: LabelData[];\n /** Lines alive after the last bar */\n lines?: LineDrawingData[];\n /** Boxes alive after the last bar */\n boxes?: BoxData[];\n /** Linefills alive after the last bar */\n linefills?: LinefillData[];\n /** Polylines alive after the last bar */\n polylines?: PolylineData[];\n /** Tables alive after the last bar */\n tables?: TableData[];\n}\n\n/**\n * Indicator factory function type\n */\nexport type IndicatorFactory = (options?: Record<string, any>) => {\n /** Indicator metadata */\n metadata: IndicatorMetadata;\n /** Calculate function */\n calculate: (bars: any[]) => PlotData[] | TimeValue[];\n};\n"],
4
+ "sourcesContent": ["/**\n * @fileoverview Type definitions for indicator metadata\n * These types define the structure of data returned by indicators\n * @module types/metadata\n */\n\n/**\n * Plot style options\n */\nexport type PlotStyle = 'line' | 'stepline' | 'histogram' | 'area' | 'circles' | 'columns' | 'cross' | 'areabr' | 'steplinebr' | 'linebr' | 'stepline_diamond';\n\n/**\n * Line style options\n */\nexport type LineStyle = 'solid' | 'dashed' | 'dotted';\n\n/**\n * Plot display options\n */\nexport type PlotDisplay = 'all' | 'none' | 'data_window' | 'status_line' | 'pane';\n\n/**\n * Options for a plot\n */\nexport interface PlotOptions {\n /** Plot title */\n title?: string;\n /** Plot color (hex string or named color) */\n color?: string;\n /** Line width */\n linewidth?: number;\n /** Plot style */\n style?: PlotStyle;\n /** Line style (PineScript `linestyle`); default solid. A constant or an input value, not per bar */\n linestyle?: LineStyle;\n /** Track price on price scale */\n trackprice?: boolean;\n /** Histogram base value */\n histbase?: number;\n /** Offset from current bar */\n offset?: number;\n /** Join gaps in data */\n join?: boolean;\n /** User can edit */\n editable?: boolean;\n /** Display mode */\n display?: PlotDisplay;\n /** Transparency (0-100) */\n transp?: number;\n /** Draw the plot on the main chart pane even when the indicator is not an overlay; default false */\n force_overlay?: boolean;\n}\n\n/**\n * Options for a horizontal line\n */\nexport interface HLineOptions {\n /** Line title */\n title?: string;\n /** Line color */\n color?: string;\n /** Line style (PineScript default: dashed) */\n linestyle?: LineStyle;\n /** Line width */\n linewidth?: number;\n /** User can edit */\n editable?: boolean;\n}\n\n/**\n * Options for a fill\n */\nexport interface FillOptions {\n /** Fill color */\n color?: string;\n /** Transparency (0-100) */\n transp?: number;\n /** Fill title */\n title?: string;\n /** User can edit */\n editable?: boolean;\n /** Fill gaps in data */\n fillgaps?: boolean;\n}\n\n/**\n * Input parameter type\n */\nexport type InputType = 'int' | 'float' | 'bool' | 'string' | 'source' | 'color' | 'timeframe' | 'session' | 'time' | 'symbol';\n\n/**\n * Input parameter metadata\n */\nexport interface InputMetadata {\n /** Input type */\n type: InputType;\n /** Internal name (snake_case) */\n name: string;\n /** Display title */\n title: string;\n /** Default value */\n defval: any;\n /** Minimum value (for numeric inputs) */\n minval?: number;\n /** Maximum value (for numeric inputs) */\n maxval?: number;\n /** Step size (for numeric inputs) */\n step?: number;\n /** Tooltip text */\n tooltip?: string;\n /** Inline group */\n inline?: string;\n /** Parameter group */\n group?: string;\n /** Options for dropdown (for string/source inputs) */\n options?: any[];\n /** Confirm before changing */\n confirm?: boolean;\n}\n\n/**\n * Plot metadata\n */\nexport interface PlotMetadata {\n /** Variable name for the plot */\n varName: string;\n /** Plot title */\n title: string;\n /** Plot color */\n color: string;\n /** Line width */\n linewidth: number;\n /** Plot style */\n style: PlotStyle;\n}\n\n/**\n * Indicator metadata\n */\nexport interface IndicatorMetadata {\n /** Indicator title */\n title: string;\n /** Short title */\n shorttitle?: string;\n /** Overlay on main chart */\n overlay: boolean;\n /** Number format precision */\n precision?: number;\n /** Number format */\n format?: string;\n /** Timeframe */\n timeframe?: string;\n /** Show gaps in timeframes */\n timeframe_gaps?: boolean;\n /** Input parameters */\n inputs?: InputMetadata[];\n /** Plots */\n plots?: PlotMetadata[];\n}\n\n/**\n * Time-value pair for charting\n */\nexport interface TimeValue {\n /** Time (timestamp or string) */\n time: any;\n /** Value */\n value: number;\n /** Per-bar color override */\n color?: string;\n}\n\n/**\n * Plot data with options\n */\nexport interface PlotData {\n /** Time-value pairs */\n data: TimeValue[];\n /** Plot options */\n options?: PlotOptions;\n}\n\n/**\n * Horizontal line data\n */\nexport interface HLineData {\n /** Y-axis value */\n value: number;\n /** Line options */\n options?: HLineOptions;\n}\n\n/**\n * Fill data (area between two plots)\n */\nexport interface FillData {\n /** First plot index or name */\n plot1: number | string;\n /** Second plot index or name */\n plot2: number | string;\n /** Fill options */\n options?: FillOptions;\n /** Per-bar fill colors (overrides static options.color) */\n colors?: string[];\n /** Gradient fill (PineScript `fill(p1, p2, top_value, bottom_value, top_color, bottom_color)`) */\n gradient?: FillGradient;\n}\n\n/**\n * Gradient of a fill, one entry per bar. PineScript rules: the colour\n * changes with the price, `topColor` at `topValue` and `bottomColor` at `bottomValue`; outside that range the end\n * colour is kept; each bar has its own gradient (the part from bar i-1 to bar i uses the values of bar i).\n */\nexport interface FillGradient {\n /** Price of `topColor`, per bar */\n topValue: number[];\n /** Price of `bottomColor`, per bar */\n bottomValue: number[];\n /** Colour at `topValue`, per bar (null: na) */\n topColor: Array<string | null>;\n /** Colour at `bottomValue`, per bar (null: na) */\n bottomColor: Array<string | null>;\n}\n\n/**\n * Marker location on the chart (PineScript plotshape/plotchar `location.*`)\n */\nexport type MarkerLocation = 'abovebar' | 'belowbar' | 'top' | 'bottom' | 'absolute';\n\n/**\n * PineScript size constant (`size.auto`, `size.tiny`, ...)\n */\nexport type PineSize = 'auto' | 'tiny' | 'small' | 'normal' | 'large' | 'huge';\n\n/**\n * Marker size (PineScript size.* constants)\n */\nexport type MarkerSize = PineSize;\n\n/**\n * Shape style (PineScript shape.* constants)\n */\nexport type ShapeStyle =\n | 'xcross'\n | 'cross'\n | 'triangleup'\n | 'triangledown'\n | 'flag'\n | 'circle'\n | 'arrowup'\n | 'arrowdown'\n | 'labelup'\n | 'labeldown'\n | 'square'\n | 'diamond';\n\n/**\n * Position of a marker:\n * - aboveBar / belowBar / inBar: next to the bar (PineScript location.abovebar / location.belowbar)\n * - atPriceTop / atPriceBottom / atPriceMiddle: at `price` (PineScript location.absolute), with the meaning of the\n * lightweight-charts price positions: atPriceTop has the shape above the price, its bottom (the tip of a label) on\n * the price (shape.labeldown); atPriceBottom has the shape below the price, its top on the price (shape.labelup);\n * atPriceMiddle centres the shape on the price (other shapes)\n * - top / bottom: at the top / bottom edge of the pane of the indicator (PineScript location.top / location.bottom),\n * the price pane for an overlay indicator or with forceOverlay\n */\nexport type MarkerPosition =\n | 'aboveBar'\n | 'belowBar'\n | 'inBar'\n | 'atPriceTop'\n | 'atPriceBottom'\n | 'atPriceMiddle'\n | 'top'\n | 'bottom';\n\n/**\n * Marker shape (PineScript shape.* in the lightweight-charts spelling)\n */\nexport type MarkerShape =\n | 'arrowUp'\n | 'arrowDown'\n | 'circle'\n | 'square'\n | 'labelUp'\n | 'labelDown'\n | 'triangleUp'\n | 'triangleDown'\n | 'cross'\n | 'xcross'\n | 'diamond'\n | 'flag';\n\n/**\n * One marker: a plotshape()/plotchar() marker on a bar where the condition held, or a marker of a built-in indicator\n */\nexport interface MarkerData {\n /** Time of the bar the marker is displayed on (offset already applied) */\n time: number;\n /** Where the marker is drawn */\n position: MarkerPosition;\n /** Price of the atPrice* positions (required with them) */\n price?: number;\n /** Shape. A plotchar marker also has `char`: the character is drawn in place of the shape */\n shape: MarkerShape;\n /**\n * Shape colour (the character colour of a plotchar marker). A fully transparent colour ('transparent',\n * '#rrggbb00', 'rgba(r, g, b, 0)') draws no shape, as PineScript `color = na`; the text is still drawn\n */\n color: string;\n /** Text; a line feed starts a new line */\n text?: string;\n /**\n * Text colour (PineScript textcolor). When omitted: white inside label shapes (labelUp / labelDown), the shape\n * colour for the other shapes\n */\n textColor?: string;\n /** Size multiplier (1 = default size) or a PineScript size */\n size?: number | PineSize;\n /** PineScript force_overlay = true: the marker of a non-overlay indicator is drawn on the price pane */\n forceOverlay?: boolean;\n /** Id of the plotshape/plotchar declaration that produced it (script markers) */\n id?: string;\n /** plotchar character, drawn in place of the shape */\n char?: string;\n /** Hover tooltip */\n tooltip?: string;\n}\n\n/**\n * Per-bar arrow from plotarrow(): up arrow for a positive value, down arrow for a negative value\n */\nexport interface ArrowData {\n /** Time of the bar the arrow is displayed on (offset already applied) */\n time: any;\n /** Id of the plotarrow declaration that produced it */\n id: string;\n /** Series value (non-zero): its sign gives the direction, its absolute value the height */\n value: number;\n /** Arrow color (colorup or colordown of that bar) */\n color: string;\n}\n\n/**\n * Per-bar candle color (barcolor() output)\n */\nexport interface BarColorData {\n /** Time of the colored bar (offset already applied) */\n time: number;\n /** Color */\n color: string;\n}\n\n/**\n * Per-bar background color (bgcolor() output)\n */\nexport interface BgColorData {\n /** Time of the colored bar (offset already applied) */\n time: number;\n /** Color (with its transparency) */\n color: string;\n /** PineScript bgcolor(..., force_overlay = true): drawn on the price pane even for a non-overlay indicator */\n forceOverlay?: boolean;\n}\n\n/**\n * One candle of plotcandle() (or of a built-in indicator that draws candles)\n */\nexport interface PlotCandleData {\n time: number;\n open: number;\n high: number;\n low: number;\n close: number;\n /** Body colour */\n color?: string;\n borderColor?: string;\n wickColor?: string;\n /** PineScript force_overlay = true: the candles of a non-overlay indicator are drawn on the price pane */\n forceOverlay?: boolean;\n}\n\n/**\n * One bar of plotbar(): an OHLC bar (a vertical line from low to high, the open tick on the left, the close tick on\n * the right)\n */\nexport interface PlotBarData {\n time: number;\n open: number;\n high: number;\n low: number;\n close: number;\n color?: string;\n /** PineScript force_overlay = true: the bars of a non-overlay indicator are drawn on the price pane */\n forceOverlay?: boolean;\n}\n\n/** PineScript label style (`label.style_*` without the prefix) */\nexport type LabelStyle =\n | 'none'\n | 'xcross'\n | 'cross'\n | 'triangleup'\n | 'triangledown'\n | 'flag'\n | 'circle'\n | 'arrowup'\n | 'arrowdown'\n | 'label_up'\n | 'label_down'\n | 'label_left'\n | 'label_right'\n | 'label_lower_left'\n | 'label_lower_right'\n | 'label_upper_left'\n | 'label_upper_right'\n | 'label_center'\n | 'square'\n | 'diamond'\n | 'text_outline';\n\n// Drawing outputs (labels, lines, boxes, linefills, polylines, tables). A field the script did not set is omitted and\n// the renderer uses the PineScript default; a colour set to na is 'transparent'. A point on a bar after the last bar\n// (PineScript bar_index + k) has the time of that future bar (see barTime). The same applies to markers and plots.\n\n/**\n * A label (PineScript label.new)\n */\nexport interface LabelData {\n time: number;\n /** Price; not used with yloc 'abovebar' / 'belowbar' */\n price: number;\n text: string;\n /** Background, border and arrow colour. Omitted: #2962FF (color.blue; #2196F3 in a v4 script) */\n color?: string;\n /** Omitted: #FFFFFF in a v6 script, #363A45 in v4 and v5 (the result does not carry the version) */\n textColor?: string;\n /** 'none': text only, no background (PineScript label.style_none). Omitted: 'label_down' */\n style?: LabelStyle;\n /** Omitted: 'normal' */\n size?: PineSize | number;\n /**\n * PineScript yloc: 'price' (default) places the label at `price`; 'abovebar' / 'belowbar' place it above the bar\n * high / below the bar low and ignore `price` (the renderer reads the bar at `time`).\n */\n yloc?: 'price' | 'abovebar' | 'belowbar';\n /** Omitted: 'center' */\n textAlign?: 'left' | 'center' | 'right';\n tooltip?: string;\n fontFamily?: 'default' | 'monospace';\n /** PineScript text.format_* flags: 0 none, 1 bold, 2 italic, 3 bold + italic */\n textFormatting?: number;\n /** PineScript force_overlay = true: the label of a non-overlay indicator is drawn on the price pane */\n forceOverlay?: boolean;\n}\n\n/**\n * A line (PineScript line.new)\n */\nexport interface LineDrawingData {\n time1: number;\n price1: number;\n time2: number;\n price2: number;\n /** Omitted: #2962FF (color.blue; #2196F3 in a v4 script) */\n color?: string;\n /** Omitted: 1. A width of 0 is kept (PineScript `width = 0`) */\n width?: number;\n /** Omitted: 'solid' */\n style?: 'solid' | 'dashed' | 'dotted' | 'arrow_left' | 'arrow_right' | 'arrow_both';\n extend?: 'none' | 'left' | 'right' | 'both';\n /** PineScript force_overlay = true: the line of a non-overlay indicator is drawn on the price pane */\n forceOverlay?: boolean;\n}\n\n/**\n * A rectangle (PineScript box.new): time1 / price1 are the left / top, time2 / price2 the right / bottom\n */\nexport interface BoxData {\n time1: number;\n price1: number;\n time2: number;\n price2: number;\n /** Omitted: #2962FF (color.blue; #2196F3 in a v4 script) */\n bgColor?: string;\n /** Omitted: #2962FF (color.blue; #2196F3 in a v4 script) */\n borderColor?: string;\n /** Omitted: 1. A width of 0 is no border (PineScript `border_width = 0`) */\n borderWidth?: number;\n /** Omitted: 'solid' */\n borderStyle?: 'solid' | 'dashed' | 'dotted';\n text?: string;\n /** Omitted: #FFFFFF in a v6 script, #363A45 in v5 (the result does not carry the version) */\n textColor?: string;\n /** Omitted: 'auto' */\n textSize?: PineSize | number;\n /** Omitted: 'center' */\n textHAlign?: 'left' | 'center' | 'right';\n /** Omitted: 'center' */\n textVAlign?: 'top' | 'center' | 'bottom';\n textWrap?: 'none' | 'auto';\n fontFamily?: 'default' | 'monospace';\n /** PineScript text.format_* flags: 0 none, 1 bold, 2 italic, 3 bold + italic */\n textFormatting?: number;\n /** PineScript box extend: the box continues to the left / right edge of the chart */\n extend?: 'none' | 'left' | 'right' | 'both';\n /** PineScript force_overlay = true: the box of a non-overlay indicator is drawn on the price pane */\n forceOverlay?: boolean;\n}\n\n/**\n * The area between two lines (PineScript linefill.new), with the two lines as drawn (their extend included)\n */\nexport interface LinefillData {\n line1: LineDrawingData;\n line2: LineDrawingData;\n color?: string;\n}\n\n/**\n * A polyline (PineScript polyline.new)\n */\nexport interface PolylineData {\n points: Array<{ time: number; price: number }>;\n /** Curved segments between the points */\n curved?: boolean;\n /** The last point is connected to the first */\n closed?: boolean;\n /** Omitted: #2962FF (color.blue) */\n lineColor?: string;\n /** Fill of the area inside the polyline. Omitted: no fill */\n fillColor?: string;\n lineStyle?: 'solid' | 'dotted' | 'dashed' | 'arrow_left' | 'arrow_right' | 'arrow_both';\n /** Omitted: 1 */\n lineWidth?: number;\n /** PineScript force_overlay = true: the polyline of a non-overlay indicator is drawn on the price pane */\n forceOverlay?: boolean;\n}\n\n/** Table position (PineScript position.*) */\nexport type TablePosition =\n | 'top_left'\n | 'top_center'\n | 'top_right'\n | 'middle_left'\n | 'middle_center'\n | 'middle_right'\n | 'bottom_left'\n | 'bottom_center'\n | 'bottom_right';\n\n/**\n * A table cell (PineScript table.cell)\n */\nexport interface TableCellData {\n row: number;\n column: number;\n text: string;\n /** Omitted: no background */\n bgColor?: string;\n /** Omitted: #363A45 (in v4, v5 and v6 scripts) */\n textColor?: string;\n /** Omitted: 'auto' */\n textSize?: PineSize | number;\n /** Width in % of the chart width; 0 fits the text */\n width?: number;\n /** Height in % of the chart height; 0 fits the text */\n height?: number;\n textHAlign?: 'left' | 'center' | 'right';\n textVAlign?: 'top' | 'center' | 'bottom';\n tooltip?: string;\n fontFamily?: 'default' | 'monospace';\n /** PineScript text.format_* flags: 0 none, 1 bold, 2 italic, 3 bold + italic */\n textFormatting?: number;\n}\n\n/**\n * Merged cells of a table (PineScript table.merge_cells): the cell at the start column / row covers the range and\n * gives its content\n */\nexport interface TableMergeData {\n startColumn: number;\n startRow: number;\n endColumn: number;\n endRow: number;\n}\n\n/**\n * A table (PineScript table.new)\n */\nexport interface TableData {\n position: TablePosition;\n columns: number;\n rows: number;\n cells: TableCellData[];\n merges?: TableMergeData[];\n /** Omitted: no background */\n bgColor?: string;\n /** Omitted: no frame */\n frameColor?: string;\n /** Omitted: 0 */\n frameWidth?: number;\n /** Omitted: no cell borders */\n borderColor?: string;\n /** Omitted: 0 */\n borderWidth?: number;\n /** PineScript force_overlay = true: the table of a non-overlay indicator is drawn on the price pane */\n forceOverlay?: boolean;\n}\n\n/**\n * Complete indicator calculation result\n */\nexport interface IndicatorResult {\n /** Indicator metadata */\n metadata: IndicatorMetadata;\n /** Plot data as Record mapping plot IDs to TimeValue arrays */\n plots: Record<string, TimeValue[]>;\n /** Horizontal lines */\n hlines?: HLineData[];\n /** Fills */\n fills?: FillData[];\n /** Markers from plotshape()/plotchar() */\n markers?: MarkerData[];\n /** Arrows from plotarrow() */\n arrows?: ArrowData[];\n /** Background colors from bgcolor() */\n bgColors?: BgColorData[];\n /** Bar colors from barcolor() */\n barColors?: BarColorData[];\n /** Candles from plotcandle(), keyed by plotcandle id */\n plotCandles?: Record<string, PlotCandleData[]>;\n /** OHLC bars from plotbar(), keyed by plotbar id */\n plotBars?: Record<string, PlotBarData[]>;\n /** Labels alive after the last bar */\n labels?: LabelData[];\n /** Lines alive after the last bar */\n lines?: LineDrawingData[];\n /** Boxes alive after the last bar */\n boxes?: BoxData[];\n /** Linefills alive after the last bar */\n linefills?: LinefillData[];\n /** Polylines alive after the last bar */\n polylines?: PolylineData[];\n /** Tables alive after the last bar */\n tables?: TableData[];\n}\n\n/**\n * Indicator factory function type\n */\nexport type IndicatorFactory = (options?: Record<string, any>) => {\n /** Indicator metadata */\n metadata: IndicatorMetadata;\n /** Calculate function */\n calculate: (bars: any[]) => PlotData[] | TimeValue[];\n};\n"],
5
5
  "mappings": ";;;;;;;;;;;;;;AAAA;AAAA;",
6
6
  "names": []
7
7
  }
@@ -15,7 +15,12 @@ export declare function size<T>(id: PineArray<T>): int;
15
15
  * Returns the element at the specified index.
16
16
  *
17
17
  * PineScript rules: a negative index counts from the end (`get(a, -1)` is the last element); an index outside
18
- * `-size .. size - 1` is a runtime error (throws); an `na` index gives `na`.
18
+ * `-size .. size - 1` is a runtime error (throws "In 'array.get()' function. Index 5 is out of bounds, array size
19
+ * is 3."); an `na` index gives `na`.
20
+ *
21
+ * Negative indexes are a PineScript v6 rule, which oakscriptjs follows: a version 5 script stops on them with the
22
+ * same out of bounds error (`array.get(a, -1)`, #176). A port of a v5 script that the original stops must check the
23
+ * index itself.
19
24
  */
20
25
  export declare function get<T>(id: PineArray<T>, index: simple_int): T;
21
26
  /**
@@ -576,7 +581,8 @@ export declare function binary_search_rightmost(id: PineArray<float>, val: float
576
581
  * - Formula: Cov(X,Y) = E[(X - μX)(Y - μY)]
577
582
  *
578
583
  * PineScript rules: a pair where either value is `na` is skipped and the count is the number of pairs kept; both
579
- * means first, then the sum of the products from the first to the last pair. One pair gives 0 biased, NaN unbiased.
584
+ * means first, then the sum of the products from the first to the last pair, set to 0 whenever it is within 1e-10 of
585
+ * zero (#177: five equal closes give 0, not -1.7e-18). One pair gives 0 biased, NaN unbiased.
580
586
  */
581
587
  export declare function covariance(id1: PineArray<float>, id2: PineArray<float>, biased?: bool): float;
582
588
  /**