oakscriptjs 0.24.0 → 0.25.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 (300) hide show
  1. package/README.md +25 -1
  2. package/bin/oakscript.mjs +10 -3
  3. package/dist/cjs/box/index.d.ts +348 -289
  4. package/dist/cjs/box/index.d.ts.map +1 -1
  5. package/dist/cjs/box/index.js.map +2 -2
  6. package/dist/cjs/check/node.d.ts.map +1 -1
  7. package/dist/cjs/check/node.js +1 -0
  8. package/dist/cjs/check/node.js.map +2 -2
  9. package/dist/cjs/check/preview.d.ts +31 -0
  10. package/dist/cjs/check/preview.d.ts.map +1 -0
  11. package/dist/cjs/check/preview.js +303 -0
  12. package/dist/cjs/check/preview.js.map +7 -0
  13. package/dist/cjs/color/index.d.ts +11 -11
  14. package/dist/cjs/color/index.js.map +1 -1
  15. package/dist/cjs/color/parse.d.ts +2 -0
  16. package/dist/cjs/color/parse.d.ts.map +1 -1
  17. package/dist/cjs/color/parse.js +6 -0
  18. package/dist/cjs/color/parse.js.map +2 -2
  19. package/dist/cjs/compare/index.d.ts +76 -12
  20. package/dist/cjs/compare/index.d.ts.map +1 -1
  21. package/dist/cjs/compare/index.js.map +2 -2
  22. package/dist/cjs/drawing/registry.d.ts +28 -5
  23. package/dist/cjs/drawing/registry.d.ts.map +1 -1
  24. package/dist/cjs/drawing/registry.js +14 -0
  25. package/dist/cjs/drawing/registry.js.map +2 -2
  26. package/dist/cjs/index.d.ts +1 -1
  27. package/dist/cjs/index.js +1 -1
  28. package/dist/cjs/index.js.map +1 -1
  29. package/dist/cjs/label/index.d.ts +265 -187
  30. package/dist/cjs/label/index.d.ts.map +1 -1
  31. package/dist/cjs/label/index.js +1 -1
  32. package/dist/cjs/label/index.js.map +2 -2
  33. package/dist/cjs/line/index.d.ts +247 -207
  34. package/dist/cjs/line/index.d.ts.map +1 -1
  35. package/dist/cjs/line/index.js.map +2 -2
  36. package/dist/cjs/linefill/index.d.ts +61 -89
  37. package/dist/cjs/linefill/index.d.ts.map +1 -1
  38. package/dist/cjs/linefill/index.js.map +2 -2
  39. package/dist/cjs/math/index.d.ts +49 -40
  40. package/dist/cjs/math/index.d.ts.map +1 -1
  41. package/dist/cjs/math/index.js.map +2 -2
  42. package/dist/cjs/polyline/index.d.ts +57 -78
  43. package/dist/cjs/polyline/index.d.ts.map +1 -1
  44. package/dist/cjs/polyline/index.js.map +2 -2
  45. package/dist/cjs/runtime/input-active.d.ts +2 -2
  46. package/dist/cjs/runtime/input-active.js.map +1 -1
  47. package/dist/cjs/runtime/series.d.ts +241 -161
  48. package/dist/cjs/runtime/series.d.ts.map +1 -1
  49. package/dist/cjs/runtime/series.js +223 -127
  50. package/dist/cjs/runtime/series.js.map +2 -2
  51. package/dist/cjs/script/api/alert.d.ts +37 -0
  52. package/dist/cjs/script/api/alert.d.ts.map +1 -0
  53. package/dist/cjs/script/api/alert.js +17 -0
  54. package/dist/cjs/script/api/alert.js.map +7 -0
  55. package/dist/cjs/script/api/calc.d.ts +232 -0
  56. package/dist/cjs/script/api/calc.d.ts.map +1 -0
  57. package/dist/cjs/script/api/calc.js +17 -0
  58. package/dist/cjs/script/api/calc.js.map +7 -0
  59. package/dist/cjs/script/api/color.d.ts +213 -0
  60. package/dist/cjs/script/api/color.d.ts.map +1 -0
  61. package/dist/cjs/script/api/color.js +17 -0
  62. package/dist/cjs/script/api/color.js.map +7 -0
  63. package/dist/cjs/script/api/context.d.ts +764 -0
  64. package/dist/cjs/script/api/context.d.ts.map +1 -0
  65. package/dist/cjs/script/api/context.js +17 -0
  66. package/dist/cjs/script/api/context.js.map +7 -0
  67. package/dist/cjs/script/api/log.d.ts +58 -0
  68. package/dist/cjs/script/api/log.d.ts.map +1 -0
  69. package/dist/cjs/script/api/log.js +17 -0
  70. package/dist/cjs/script/api/log.js.map +7 -0
  71. package/dist/cjs/script/api/strategy.d.ts +391 -0
  72. package/dist/cjs/script/api/strategy.d.ts.map +1 -0
  73. package/dist/cjs/script/api/strategy.js +17 -0
  74. package/dist/cjs/script/api/strategy.js.map +7 -0
  75. package/dist/cjs/script/api/ta.d.ts +1012 -0
  76. package/dist/cjs/script/api/ta.d.ts.map +1 -0
  77. package/dist/cjs/script/api/ta.js +17 -0
  78. package/dist/cjs/script/api/ta.js.map +7 -0
  79. package/dist/cjs/script/api/table.d.ts +479 -0
  80. package/dist/cjs/script/api/table.d.ts.map +1 -0
  81. package/dist/cjs/script/api/table.js +17 -0
  82. package/dist/cjs/script/api/table.js.map +7 -0
  83. package/dist/cjs/script/constants.d.ts +228 -83
  84. package/dist/cjs/script/constants.d.ts.map +1 -1
  85. package/dist/cjs/script/constants.js +87 -0
  86. package/dist/cjs/script/constants.js.map +2 -2
  87. package/dist/cjs/script/define.d.ts +94 -0
  88. package/dist/cjs/script/define.d.ts.map +1 -0
  89. package/dist/cjs/script/define.js +127 -0
  90. package/dist/cjs/script/define.js.map +7 -0
  91. package/dist/cjs/script/drawing-args.d.ts.map +1 -1
  92. package/dist/cjs/script/drawing-args.js +1 -1
  93. package/dist/cjs/script/drawing-args.js.map +2 -2
  94. package/dist/cjs/script/formula.d.ts +53 -0
  95. package/dist/cjs/script/formula.d.ts.map +1 -0
  96. package/dist/cjs/script/formula.js +402 -0
  97. package/dist/cjs/script/formula.js.map +7 -0
  98. package/dist/cjs/script/globals.d.ts +10 -0
  99. package/dist/cjs/script/globals.d.ts.map +1 -1
  100. package/dist/cjs/script/globals.js.map +1 -1
  101. package/dist/cjs/script/index.d.ts +1067 -1006
  102. package/dist/cjs/script/index.d.ts.map +1 -1
  103. package/dist/cjs/script/index.js +530 -60
  104. package/dist/cjs/script/index.js.map +3 -3
  105. package/dist/cjs/script/json.d.ts +117 -0
  106. package/dist/cjs/script/json.d.ts.map +1 -0
  107. package/dist/cjs/script/json.js +321 -0
  108. package/dist/cjs/script/json.js.map +7 -0
  109. package/dist/cjs/str/index.d.ts +50 -75
  110. package/dist/cjs/str/index.d.ts.map +1 -1
  111. package/dist/cjs/str/index.js +2 -2
  112. package/dist/cjs/str/index.js.map +2 -2
  113. package/dist/cjs/strategy/index.d.ts +102 -1
  114. package/dist/cjs/strategy/index.d.ts.map +1 -1
  115. package/dist/cjs/strategy/index.js.map +2 -2
  116. package/dist/cjs/table/index.d.ts +330 -49
  117. package/dist/cjs/table/index.d.ts.map +1 -1
  118. package/dist/cjs/table/index.js +55 -27
  119. package/dist/cjs/table/index.js.map +2 -2
  120. package/dist/cjs/text/index.d.ts +12 -14
  121. package/dist/cjs/text/index.d.ts.map +1 -1
  122. package/dist/cjs/text/index.js.map +2 -2
  123. package/dist/cjs/types/index.d.ts +15 -8
  124. package/dist/cjs/types/index.d.ts.map +1 -1
  125. package/dist/cjs/types/index.js +12 -3
  126. package/dist/cjs/types/index.js.map +2 -2
  127. package/dist/esm/box/index.d.ts +348 -289
  128. package/dist/esm/box/index.d.ts.map +1 -1
  129. package/dist/esm/box/index.js +276 -276
  130. package/dist/esm/box/index.js.map +1 -1
  131. package/dist/esm/check/node.d.ts.map +1 -1
  132. package/dist/esm/check/node.js +1 -0
  133. package/dist/esm/check/node.js.map +1 -1
  134. package/dist/esm/check/preview.d.ts +31 -0
  135. package/dist/esm/check/preview.d.ts.map +1 -0
  136. package/dist/esm/check/preview.js +296 -0
  137. package/dist/esm/check/preview.js.map +1 -0
  138. package/dist/esm/color/index.d.ts +11 -11
  139. package/dist/esm/color/index.js +11 -11
  140. package/dist/esm/color/parse.d.ts +2 -0
  141. package/dist/esm/color/parse.d.ts.map +1 -1
  142. package/dist/esm/color/parse.js +7 -0
  143. package/dist/esm/color/parse.js.map +1 -1
  144. package/dist/esm/compare/index.d.ts +76 -12
  145. package/dist/esm/compare/index.d.ts.map +1 -1
  146. package/dist/esm/compare/index.js +76 -12
  147. package/dist/esm/compare/index.js.map +1 -1
  148. package/dist/esm/drawing/registry.d.ts +28 -5
  149. package/dist/esm/drawing/registry.d.ts.map +1 -1
  150. package/dist/esm/drawing/registry.js +39 -3
  151. package/dist/esm/drawing/registry.js.map +1 -1
  152. package/dist/esm/index.d.ts +1 -1
  153. package/dist/esm/index.js +1 -1
  154. package/dist/esm/label/index.d.ts +265 -187
  155. package/dist/esm/label/index.d.ts.map +1 -1
  156. package/dist/esm/label/index.js +207 -177
  157. package/dist/esm/label/index.js.map +1 -1
  158. package/dist/esm/line/index.d.ts +247 -207
  159. package/dist/esm/line/index.d.ts.map +1 -1
  160. package/dist/esm/line/index.js +202 -194
  161. package/dist/esm/line/index.js.map +1 -1
  162. package/dist/esm/linefill/index.d.ts +61 -89
  163. package/dist/esm/linefill/index.d.ts.map +1 -1
  164. package/dist/esm/linefill/index.js +61 -89
  165. package/dist/esm/linefill/index.js.map +1 -1
  166. package/dist/esm/math/index.d.ts +49 -40
  167. package/dist/esm/math/index.d.ts.map +1 -1
  168. package/dist/esm/math/index.js +22 -9
  169. package/dist/esm/math/index.js.map +1 -1
  170. package/dist/esm/polyline/index.d.ts +57 -78
  171. package/dist/esm/polyline/index.d.ts.map +1 -1
  172. package/dist/esm/polyline/index.js +57 -78
  173. package/dist/esm/polyline/index.js.map +1 -1
  174. package/dist/esm/runtime/input-active.d.ts +2 -2
  175. package/dist/esm/runtime/input-active.js +2 -2
  176. package/dist/esm/runtime/series.d.ts +241 -161
  177. package/dist/esm/runtime/series.d.ts.map +1 -1
  178. package/dist/esm/runtime/series.js +241 -161
  179. package/dist/esm/runtime/series.js.map +1 -1
  180. package/dist/esm/script/api/alert.d.ts +37 -0
  181. package/dist/esm/script/api/alert.d.ts.map +1 -0
  182. package/dist/esm/script/api/alert.js +7 -0
  183. package/dist/esm/script/api/alert.js.map +1 -0
  184. package/dist/esm/script/api/calc.d.ts +232 -0
  185. package/dist/esm/script/api/calc.d.ts.map +1 -0
  186. package/dist/esm/script/api/calc.js +6 -0
  187. package/dist/esm/script/api/calc.js.map +1 -0
  188. package/dist/esm/script/api/color.d.ts +213 -0
  189. package/dist/esm/script/api/color.d.ts.map +1 -0
  190. package/dist/esm/script/api/color.js +6 -0
  191. package/dist/esm/script/api/color.js.map +1 -0
  192. package/dist/esm/script/api/context.d.ts +764 -0
  193. package/dist/esm/script/api/context.d.ts.map +1 -0
  194. package/dist/esm/script/api/context.js +7 -0
  195. package/dist/esm/script/api/context.js.map +1 -0
  196. package/dist/esm/script/api/log.d.ts +58 -0
  197. package/dist/esm/script/api/log.d.ts.map +1 -0
  198. package/dist/esm/script/api/log.js +6 -0
  199. package/dist/esm/script/api/log.js.map +1 -0
  200. package/dist/esm/script/api/strategy.d.ts +391 -0
  201. package/dist/esm/script/api/strategy.d.ts.map +1 -0
  202. package/dist/esm/script/api/strategy.js +7 -0
  203. package/dist/esm/script/api/strategy.js.map +1 -0
  204. package/dist/esm/script/api/ta.d.ts +1012 -0
  205. package/dist/esm/script/api/ta.d.ts.map +1 -0
  206. package/dist/esm/script/api/ta.js +6 -0
  207. package/dist/esm/script/api/ta.js.map +1 -0
  208. package/dist/esm/script/api/table.d.ts +479 -0
  209. package/dist/esm/script/api/table.d.ts.map +1 -0
  210. package/dist/esm/script/api/table.js +7 -0
  211. package/dist/esm/script/api/table.js.map +1 -0
  212. package/dist/esm/script/constants.d.ts +228 -83
  213. package/dist/esm/script/constants.d.ts.map +1 -1
  214. package/dist/esm/script/constants.js +110 -24
  215. package/dist/esm/script/constants.js.map +1 -1
  216. package/dist/esm/script/define.d.ts +94 -0
  217. package/dist/esm/script/define.d.ts.map +1 -0
  218. package/dist/esm/script/define.js +136 -0
  219. package/dist/esm/script/define.js.map +1 -0
  220. package/dist/esm/script/drawing-args.d.ts.map +1 -1
  221. package/dist/esm/script/drawing-args.js +2 -1
  222. package/dist/esm/script/drawing-args.js.map +1 -1
  223. package/dist/esm/script/formula.d.ts +53 -0
  224. package/dist/esm/script/formula.d.ts.map +1 -0
  225. package/dist/esm/script/formula.js +408 -0
  226. package/dist/esm/script/formula.js.map +1 -0
  227. package/dist/esm/script/globals.d.ts +10 -0
  228. package/dist/esm/script/globals.d.ts.map +1 -1
  229. package/dist/esm/script/globals.js.map +1 -1
  230. package/dist/esm/script/index.d.ts +1067 -1006
  231. package/dist/esm/script/index.d.ts.map +1 -1
  232. package/dist/esm/script/index.js +1096 -151
  233. package/dist/esm/script/index.js.map +1 -1
  234. package/dist/esm/script/json.d.ts +117 -0
  235. package/dist/esm/script/json.d.ts.map +1 -0
  236. package/dist/esm/script/json.js +375 -0
  237. package/dist/esm/script/json.js.map +1 -0
  238. package/dist/esm/str/index.d.ts +50 -75
  239. package/dist/esm/str/index.d.ts.map +1 -1
  240. package/dist/esm/str/index.js +51 -76
  241. package/dist/esm/str/index.js.map +1 -1
  242. package/dist/esm/strategy/index.d.ts +102 -1
  243. package/dist/esm/strategy/index.d.ts.map +1 -1
  244. package/dist/esm/strategy/index.js +1 -1
  245. package/dist/esm/strategy/index.js.map +1 -1
  246. package/dist/esm/table/index.d.ts +330 -49
  247. package/dist/esm/table/index.d.ts.map +1 -1
  248. package/dist/esm/table/index.js +372 -61
  249. package/dist/esm/table/index.js.map +1 -1
  250. package/dist/esm/text/index.d.ts +12 -14
  251. package/dist/esm/text/index.d.ts.map +1 -1
  252. package/dist/esm/text/index.js +12 -14
  253. package/dist/esm/text/index.js.map +1 -1
  254. package/dist/esm/types/index.d.ts +15 -8
  255. package/dist/esm/types/index.d.ts.map +1 -1
  256. package/dist/esm/types/index.js +15 -8
  257. package/dist/esm/types/index.js.map +1 -1
  258. package/docs/first-indicator.md +152 -0
  259. package/docs/guide.md +1185 -0
  260. package/docs/inventory.md +772 -0
  261. package/docs/no-code.md +207 -0
  262. package/docs/recipes.md +202 -0
  263. package/package.json +2 -1
  264. package/skills/oakscript/SKILL.md +8 -0
  265. package/skills/oakscript/reference/errors.md +3 -2
  266. package/src/box/index.ts +348 -289
  267. package/src/check/node.ts +1 -0
  268. package/src/check/preview.ts +307 -0
  269. package/src/color/index.ts +11 -11
  270. package/src/color/parse.ts +7 -0
  271. package/src/compare/index.ts +76 -12
  272. package/src/drawing/registry.ts +44 -5
  273. package/src/index.ts +1 -1
  274. package/src/label/index.ts +267 -189
  275. package/src/line/index.ts +248 -208
  276. package/src/linefill/index.ts +61 -89
  277. package/src/math/index.ts +51 -42
  278. package/src/polyline/index.ts +57 -78
  279. package/src/runtime/input-active.ts +2 -2
  280. package/src/runtime/series.ts +243 -163
  281. package/src/script/api/alert.ts +43 -0
  282. package/src/script/api/calc.ts +250 -0
  283. package/src/script/api/color.ts +245 -0
  284. package/src/script/api/context.ts +944 -0
  285. package/src/script/api/log.ts +60 -0
  286. package/src/script/api/strategy.ts +410 -0
  287. package/src/script/api/ta.ts +1115 -0
  288. package/src/script/api/table.ts +538 -0
  289. package/src/script/constants.ts +229 -25
  290. package/src/script/define.ts +221 -0
  291. package/src/script/drawing-args.ts +2 -1
  292. package/src/script/formula.ts +438 -0
  293. package/src/script/globals.ts +10 -0
  294. package/src/script/index.ts +1519 -239
  295. package/src/script/json.ts +457 -0
  296. package/src/str/index.ts +51 -76
  297. package/src/strategy/index.ts +102 -1
  298. package/src/table/index.ts +388 -62
  299. package/src/text/index.ts +12 -14
  300. package/src/types/index.ts +15 -8
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../../src/script/api/context.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,KAAK,EACV,gBAAgB,EAChB,YAAY,EACZ,mBAAmB,EACnB,aAAa,EACb,QAAQ,EACT,MAAM,aAAa,CAAC;AAIrB;;;;;;GAMG;AACH,MAAM,WAAW,kBAAkB;IACjC;;;;;;;;;;;OAWG;IACH,UAAU,CAAC,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAEhC;;;;;;;;;;;;OAYG;IACH,YAAY,CAAC,OAAO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AAsB,EAAE,MAAM,CAAC;IAExC,oFAAoF;IACpF,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;IAE9B,mCAAmC;IACnC,QAAQ,CAAC,aAAa,EAAE,OAAO,CAAC;IAEhC,6BAA6B;IAC7B,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAE3B,4BAA4B;IAC5B,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAE1B,kCAAkC;IAClC,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAC;IAE/B,wCAAwC;IACxC,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IAEzB,6BAA6B;IAC7B,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAE3B,gEAAgE;IAChE,QAAQ,CAAC,KAAK,EAAE,mBAAmB,CAAC;CACrC"}
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __copyProps = (to, from, except, desc) => {
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from))
9
+ if (!__hasOwnProp.call(to, key) && key !== except)
10
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
+ }
12
+ return to;
13
+ };
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
+ var context_exports = {};
16
+ module.exports = __toCommonJS(context_exports);
17
+ //# sourceMappingURL=context.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/script/api/context.ts"],
4
+ "sourcesContent": ["/**\n * @fileoverview The documented types of the chart and symbol context namespaces of the script API: `timeframe`,\n * `syminfo`, `barstate`, `session`, `barmerge`, `ticker`, `dividends`, `splits`, `earnings`, `request` and `chart`.\n * @module script/api/context\n */\n\nimport type { Series } from '../../runtime/series.js';\nimport type { ChartPoint } from '../../types/index.js';\nimport type { TimeframeInfo } from '../../timeframe/index.js';\nimport type {\n EventRequestArgs,\n SecurityArgs,\n SecurityLowerTfArgs,\n SecurityValue,\n SeedArgs,\n} from '../index.js';\n\n// \u2500\u2500 timeframe \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n/**\n * The timeframe of the chart and timeframe string helpers.\n *\n * A timeframe string is a multiplier and a unit letter: no letter for minutes (`\"1\"`, `\"15\"`, `\"60\"`, `\"240\"`), `\"S\"`\n * seconds, `\"D\"` days, `\"W\"` weeks, `\"M\"` months, `\"T\"` ticks. Without a multiplier 1 is used (`\"D\"` is `\"1D\"`).\n * The chart values come from the app; inside a `request.security` expression they describe the requested timeframe.\n */\nexport interface TimeframeNamespace {\n /**\n * Number of seconds in a timeframe. A month counts 2,628,003 seconds (365 / 12 days); a tick timeframe gives\n * `NaN`. Without an argument, or with `\"\"`, the chart timeframe.\n * @param tf - Timeframe string, e.g. `\"60\"`, `\"1D\"`, `\"W\"`, `\"30S\"`. Default: the chart timeframe.\n * @returns The number of seconds. Throws for a string that is not a timeframe (`\"1H\"`).\n * @example\n * ```js\n * const barMinutes = timeframe.in_seconds() / 60;\n * const dayLength = Math.max(1, Math.round(1440 / barMinutes));\n * plot(ta.sma(close, dayLength), \"One-day average\");\n * ```\n */\n in_seconds(tf?: string): number;\n\n /**\n * The timeframe string of a number of seconds. When no timeframe lasts exactly that long, the next longer one is\n * returned (`45` gives `\"1\"`); when several do, the larger unit wins (`604800` gives `\"1W\"`). From 365 days the\n * result is `\"12M\"`.\n * @param seconds - Duration in seconds.\n * @returns A timeframe string such as `\"60\"`, `\"1D\"` or `\"1W\"`.\n * @example\n * ```js\n * const higher = timeframe.from_seconds(timeframe.in_seconds() * 4);\n * const higherClose = request.security(\"\", higher, () => close);\n * plot(higherClose, \"Close x4\");\n * ```\n */\n from_seconds(seconds: number): string;\n\n /**\n * Describes any timeframe string with the same fields as the chart values (`period`, `multiplier`, `isintraday`,\n * `isdaily`...). Use it to test a timeframe chosen in the inputs.\n * @param timeframe - Timeframe string, e.g. `\"5\"`, `\"60\"`, `\"D\"`, `\"1W\"`, `\"30S\"`.\n * @returns An object with `period` (always with its multiplier: `\"D\"` becomes `\"1D\"`), `multiplier` and the\n * `is*` flags. Throws for a string that is not a timeframe.\n * @example\n * ```js\n * const tf = input.timeframe(\"D\", \"Higher timeframe\");\n * const isDayOrMore = timeframe.info(tf).isdwm;\n * plot(request.security(\"\", tf, () => close), isDayOrMore ? \"Daily+ close\" : \"Intraday close\");\n * ```\n */\n info(timeframe: string): TimeframeInfo;\n\n /**\n * Chart timeframe with its multiplier: `\"1\"`, `\"60\"`, `\"1D\"`, `\"1W\"`, `\"30S\"`. Throws when the app did not\n * give it.\n */\n readonly period: string;\n\n /**\n * Timeframe of the chart the script runs on, e.g. `\"60\"` or `\"1D\"`, also inside a `request.security` expression\n * (where `timeframe.period` is the requested timeframe).\n */\n readonly main_period: string;\n\n /** Number before the unit of the chart timeframe: 60 for `\"60\"`, 1 for `\"1D\"`, 4 for `\"4W\"`. */\n readonly multiplier: number;\n\n /** True on a minutes, seconds or ticks chart. */\n readonly isintraday: boolean;\n\n /** True on a chart of days (`\"1D\"`, `\"2D\"`...). */\n readonly isdaily: boolean;\n\n /** True on a chart of weeks. */\n readonly isweekly: boolean;\n\n /** True on a chart of months. */\n readonly ismonthly: boolean;\n\n /** True on a chart of minutes (and hours: `\"60\"`, `\"240\"`). */\n readonly isminutes: boolean;\n\n /** True on a chart of seconds. */\n readonly isseconds: boolean;\n\n /** True on a chart of ticks. */\n readonly isticks: boolean;\n\n /** True on a chart of days, weeks or months. */\n readonly isdwm: boolean;\n\n /**\n * Marks the bars that open a new period of another timeframe, e.g. the first bar of each day on an intraday\n * chart. The first bar of the chart is 0. Follows the session and the holidays of the symbol.\n * @param tf - Timeframe of the periods, e.g. `\"D\"`, `\"W\"`, `\"240\"`; `\"\"` is the chart timeframe.\n * @returns Series of 1 on the first bar of each new period and 0 elsewhere.\n * @example\n * ```js\n * const newDay = timeframe.change(\"D\");\n * plotshape(newDay, \"New day\", { location: location.bottom, color: color.blue });\n * ```\n */\n change(tf: string): Series;\n}\n\n// \u2500\u2500 syminfo \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n/**\n * Properties of the chart symbol: ticker, exchange, price step, currency, company and analysts' figures. Inside a\n * `request.security` expression they describe the requested symbol (`main_tickerid` stays the chart's).\n *\n * A field the symbol does not have is na: `\"\"` for a text (test it with `na(...)`), `NaN` for a number. A field the\n * app does not know stops the script with an error.\n */\nexport interface SyminfoNamespace {\n /** Smallest price step of the symbol, e.g. 0.01. Equals `minmove / pricescale`. */\n readonly mintick: number;\n\n /** Number of price-scale units in one price step: `mintick = minmove / pricescale` (1 for most symbols). */\n readonly minmove: number;\n\n /** Price scale of the symbol: 100 for prices with 2 decimals, 32 for prices in 1/32. */\n readonly pricescale: number;\n\n /** Money value of a one-point price move for one contract (1 for stocks). */\n readonly pointvalue: number;\n\n /** Smallest quantity that can be traded (1 for whole shares). */\n readonly mincontract: number;\n\n /** Time zone of the exchange, e.g. `\"America/New_York\"`. The default time zone of the date and time functions. */\n readonly timezone: string;\n\n /**\n * Full symbol id with its exchange prefix, e.g. `\"NASDAQ:AAPL\"`. Pass it to `request.security` for the chart\n * symbol.\n */\n readonly tickerid: string;\n\n /** Symbol id of the chart itself, also inside a `request.security` expression on another symbol. */\n readonly main_tickerid: string;\n\n /** Symbol name without the exchange prefix, e.g. `\"AAPL\"`. */\n readonly ticker: string;\n\n /** Exchange prefix of the symbol id, e.g. `\"NASDAQ\"`; `\"\"` without one. */\n readonly prefix: string;\n\n /** Session type of the bars: `\"regular\"` (regular hours) or `\"extended\"` (with pre and post market). */\n readonly session: string;\n\n /** Type of the symbol: `\"stock\"`, `\"fund\"`, `\"index\"`, `\"futures\"`, `\"forex\"`, `\"crypto\"`... */\n readonly type: string;\n\n /** Currency the prices are in, e.g. `\"USD\"`. */\n readonly currency: string;\n\n /** Base currency of a pair: `\"BTC\"` for a BTC/USD symbol, `\"EUR\"` for EUR/USD; `\"\"` for a stock or an index. */\n readonly basecurrency: string;\n\n /** Root of the symbol: `\"ES\"` for a continuous future `\"ES1!\"` or a contract `\"ESZ2026\"`; the ticker otherwise. */\n readonly root: string;\n\n /** Full name of the symbol, e.g. `\"Apple Inc.\"`. */\n readonly description: string;\n\n /** Two-letter code of the country the symbol trades in, e.g. `\"US\"`. */\n readonly country: string;\n\n /** Contract a continuous future stands for, e.g. `\"ESZ2026\"`; `\"\"` for other symbols. */\n readonly current_contract: string;\n\n /** Last trading day of a futures contract (UNIX time in ms); na for other symbols. */\n readonly expiration_date: number;\n\n /** Sector of the company, e.g. `\"Electronic Technology\"`; `\"\"` when it has none. */\n readonly sector: string;\n\n /** Industry of the company; `\"\"` when it has none. */\n readonly industry: string;\n\n /** International Securities Identification Number of the symbol, e.g. `\"US0378331005\"`. */\n readonly isin: string;\n\n /** Unit of the volume: `\"base\"` (units of the base currency), `\"quote\"`, `\"tick\"` or `\"n/a\"`. */\n readonly volumetype: string;\n\n /** Number of employees of the company. */\n readonly employees: number;\n\n /** Number of shareholders of the company. */\n readonly shareholders: number;\n\n /** Total number of shares the company has issued. */\n readonly shares_outstanding_total: number;\n\n /** Number of shares free to trade (without the shares held by insiders and large holders). */\n readonly shares_outstanding_float: number;\n\n /** Number of analysts who rate the symbol \"buy\". */\n readonly recommendations_buy: number;\n\n /** Number of analysts who rate the symbol \"strong buy\". */\n readonly recommendations_buy_strong: number;\n\n /** Number of analysts who rate the symbol \"hold\". */\n readonly recommendations_hold: number;\n\n /** Number of analysts who rate the symbol \"sell\". */\n readonly recommendations_sell: number;\n\n /** Number of analysts who rate the symbol \"strong sell\". */\n readonly recommendations_sell_strong: number;\n\n /** Total number of analysts' ratings. */\n readonly recommendations_total: number;\n\n /** Date of the analysts' ratings (UNIX time in ms). */\n readonly recommendations_date: number;\n\n /** Average of the analysts' price targets. */\n readonly target_price_average: number;\n\n /** Highest analyst price target. */\n readonly target_price_high: number;\n\n /** Lowest analyst price target. */\n readonly target_price_low: number;\n\n /** Median of the analysts' price targets. */\n readonly target_price_median: number;\n\n /** Number of analysts' price targets. */\n readonly target_price_estimates: number;\n\n /** Date of the analysts' price targets (UNIX time in ms). */\n readonly target_price_date: number;\n}\n\n// \u2500\u2500 barstate \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n/**\n * Where each bar stands in the data: first, last, closed, history or live. Each value is a Series of 1 (true) and\n * 0 (false), one value per bar: pass it to a plot as a condition, or read it in a bar loop with\n * `c.get(barstate.islast) === 1`.\n */\nexport interface BarstateNamespace {\n /** 1 on the first bar of the data. */\n readonly isfirst: Series;\n\n /** 1 on the last bar of the chart. */\n readonly islast: Series;\n\n /** 1 on closed bars: every bar but the last, and the last bar once the app says it has closed. */\n readonly isconfirmed: Series;\n\n /** 1 on the last bar when it receives live updates. */\n readonly isrealtime: Series;\n\n /** 1 on every bar but a live last bar. */\n readonly ishistory: Series;\n\n /** 1 on every history bar, and on a live last bar at its first update. */\n readonly isnew: Series;\n\n /** 1 on the last closed history bar: the last bar when it is closed and not live, else the bar before it. */\n readonly islastconfirmedhistory: Series;\n}\n\n// \u2500\u2500 session \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n/**\n * Trading session values: where each bar sits in the trading hours of the symbol, and the session types. The flags\n * are Series of 1 (true) and 0 (false). Market, pre market and post market follow the regular hours; on a daily,\n * weekly or monthly chart every bar is a first, last and market bar.\n */\nexport interface SessionNamespace {\n /** Session type of regular trading hours (compare with `syminfo.session`). */\n readonly regular: 'regular';\n\n /** Session type with the pre and post market hours (compare with `syminfo.session`). */\n readonly extended: 'extended';\n\n /** 1 on the first bar of each session period (including pre market when the bars have it). */\n readonly isfirstbar: Series;\n\n /** 1 on the last bar of each session period. */\n readonly islastbar: Series;\n\n /** 1 on bars inside the regular trading hours. */\n readonly ismarket: Series;\n\n /** 1 on bars before the regular hours open (pre market). */\n readonly ispremarket: Series;\n\n /** 1 on bars after the regular hours close (post market). */\n readonly ispostmarket: Series;\n\n /** 1 on the first bar of the regular trading hours of each day. */\n readonly isfirstbar_regular: Series;\n\n /** 1 on the last bar of the regular trading hours of each day. */\n readonly islastbar_regular: Series;\n}\n\n// \u2500\u2500 barmerge \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n/** How `request.security` and the event requests place their values on the chart bars. */\nexport interface BarmergeNamespace {\n /** A value shows only on the bar where it appears; the bars between are na. */\n readonly gaps_on: 'gaps_on';\n\n /** A value stays on every bar until the next one (the default). */\n readonly gaps_off: 'gaps_off';\n\n /**\n * A period's value shows from the first chart bar of that period. On history it reads values that were not known\n * yet: use it with values of the previous period (`high.offset(1)`).\n */\n readonly lookahead_on: 'lookahead_on';\n\n /** A period's value shows from the chart bar that completes the period (the default, no future values). */\n readonly lookahead_off: 'lookahead_off';\n}\n\n// \u2500\u2500 ticker \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n/** Symbol ids for `request.security`: Heikin Ashi bars of a symbol, and back to its standard bars. */\nexport interface TickerNamespace {\n /**\n * The symbol id of the Heikin Ashi bars of a symbol: `request.security` on it computes the expression on Heikin\n * Ashi candles.\n * @param symbol - Symbol id, e.g. `syminfo.tickerid`.\n * @returns The symbol id that selects Heikin Ashi bars.\n * @example\n * ```js\n * const haClose = request.security(ticker.heikinashi(syminfo.tickerid), \"\", () => close);\n * plot(haClose, \"Heikin Ashi close\");\n * ```\n */\n heikinashi(symbol: string): string;\n\n /**\n * The symbol id of the standard bars of a symbol: removes the Heikin Ashi marking of `ticker.heikinashi`, and\n * returns any other id unchanged.\n * @param symbol - Symbol id, e.g. `syminfo.tickerid`.\n * @returns The symbol id of the standard bars.\n * @example\n * ```js\n * const realClose = request.security(ticker.standard(syminfo.tickerid), \"\", () => close);\n * plot(realClose, \"Close\");\n * ```\n */\n standard(symbol: string): string;\n}\n\n// \u2500\u2500 dividends / splits / earnings \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n/** Fields of `request.dividends`, and the next announced dividend of the chart symbol. */\nexport interface DividendsNamespace {\n /** The dividend after taxes (the default field of `request.dividends`). */\n readonly net: 'net';\n\n /** The dividend before taxes. */\n readonly gross: 'gross';\n\n /** Amount of the next announced dividend (net); na when none is announced. */\n readonly future_amount: number;\n\n /** Ex-date of the next announced dividend (UNIX time in ms); na when none is announced. */\n readonly future_ex_date: number;\n\n /** Payment date of the next announced dividend (UNIX time in ms); na when none is announced. */\n readonly future_pay_date: number;\n}\n\n/** Fields of `request.splits`: the two numbers of a split ratio. */\nexport interface SplitsNamespace {\n /** The number of shares after the split (2 for a 2-for-1 split). */\n readonly numerator: 'numerator';\n\n /** The number of shares before the split (1 for a 2-for-1 split). */\n readonly denominator: 'denominator';\n}\n\n/** Fields of `request.earnings`, and the next announced earnings release of the chart symbol. */\nexport interface EarningsNamespace {\n /** The reported earnings per share (the default field of `request.earnings`). */\n readonly actual: 'actual';\n\n /** The analysts' estimate of the earnings per share. */\n readonly estimate: 'estimate';\n\n /** The standardized earnings per share. */\n readonly standardized: 'standardized';\n\n /** Estimated earnings per share of the next release; na when none is announced. */\n readonly future_eps: number;\n\n /** Estimated revenue of the next release; na when none is announced. */\n readonly future_revenue: number;\n\n /** Time of the next release (UNIX time in ms); na when none is announced. */\n readonly future_time: number;\n\n /** End of the fiscal period of the next release (UNIX time in ms); na when none is announced. */\n readonly future_period_end_time: number;\n}\n\n// \u2500\u2500 request \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n/** Named arguments of `request.splits`: those of the other event requests, without `currency`. */\nexport type SplitsRequestArgs = Omit<EventRequestArgs, 'currency'>;\n\n/**\n * Data of other timeframes and other symbols: values computed on their bars, lower-timeframe values, seed series,\n * dividends, splits and earnings. The arguments after the first ones can be given by position or by name in a last\n * object (`{ lookahead: barmerge.lookahead_on }`); an unknown name stops the script with the closest names.\n */\nexport interface RequestNamespace {\n /**\n * Computes `expression` on the bars of another timeframe or another symbol and places its values on the chart\n * bars. Compute every Series the expression needs inside it: a Series computed outside runs on the chart bars and\n * stops the script. Return an array to get several Series at once.\n * @param symbol - Symbol id: `\"\"` or `syminfo.tickerid` for the chart symbol, `\"NASDAQ:AAPL\"` for another one,\n * `ticker.heikinashi(...)` for Heikin Ashi bars.\n * @param timeframe - Timeframe string, e.g. `\"D\"`, `\"W\"`, `\"60\"`; `\"\"` is the chart timeframe.\n * @param expression - Function that returns a Series, a number, or an array of them, computed on those bars.\n * @param gaps - `barmerge.gaps_off` keeps a value on every bar until the next one; `barmerge.gaps_on` shows it only\n * where it appears. Default: `barmerge.gaps_off`.\n * @param lookahead - `barmerge.lookahead_off` shows a period's value from the bar that completes it;\n * `barmerge.lookahead_on` from its first bar. Default: `barmerge.lookahead_off`.\n * @param ignore_invalid_symbol - True to get na for a symbol that does not exist instead of stopping the script.\n * Default: false.\n * @returns A Series on the chart bars, or one Series per element when the expression returns an array.\n * @example\n * ```js\n * const dailyEma = request.security(\"\", \"D\", () => ta.ema(close, 20));\n * const [prevHigh, prevLow] = request.security(\"\", \"D\", () => [high.offset(1), low.offset(1)]);\n * plot(dailyEma, \"Daily EMA\");\n * ```\n */\n security<T extends SecurityValue>(\n symbol: string,\n timeframe: string,\n expression: () => T,\n gaps?: string,\n lookahead?: string,\n ignore_invalid_symbol?: boolean\n ): T extends unknown[] ? Series[] : Series;\n /**\n * Computes `expression` on the bars of another timeframe or symbol, with the other arguments by name.\n * @param symbol - Symbol id; `\"\"` is the chart symbol.\n * @param timeframe - Timeframe string; `\"\"` is the chart timeframe.\n * @param expression - Function that returns a Series, a number, or an array of them.\n * @param args - Named arguments: `gaps`, `lookahead`, `ignore_invalid_symbol`. `currency` (other than `\"\"`) and\n * `calc_bars_count` are not supported and stop the script.\n * @returns A Series on the chart bars, or one Series per element when the expression returns an array.\n * @example\n * ```js\n * const weekOpen = request.security(\"\", \"W\", () => open, { lookahead: barmerge.lookahead_on });\n * plot(weekOpen, \"Week open\", { style: plot.style_stepline });\n * ```\n */\n security<T extends SecurityValue>(\n symbol: string,\n timeframe: string,\n expression: () => T,\n args: SecurityArgs<T>\n ): T extends unknown[] ? Series[] : Series;\n /**\n * Computes `expression` on the bars of another timeframe or symbol, with every argument by name.\n * @param args - Named arguments: `symbol`, `timeframe`, `expression` (required), `gaps`, `lookahead`,\n * `ignore_invalid_symbol`.\n * @returns A Series on the chart bars, or one Series per element when the expression returns an array.\n * @example\n * ```js\n * const weekly = request.security({ symbol: \"\", timeframe: \"W\", expression: () => close });\n * plot(weekly, \"Weekly close\");\n * ```\n */\n security<T extends SecurityValue>(\n args: SecurityArgs<T> & { symbol: string; timeframe: string; expression: () => T }\n ): T extends unknown[] ? Series[] : Series;\n\n /**\n * Computes `expression` on the bars of a lower timeframe and gives, for each chart bar, the values of all the\n * lower bars inside it. The result is a plain array per chart bar (oldest first), not a Series: read it in a bar\n * loop with `values[c.i]`. A timeframe higher than the chart's stops the script.\n * @param symbol - Symbol id; `\"\"` or `syminfo.tickerid` is the chart symbol.\n * @param timeframe - Lower timeframe string, e.g. `\"1\"`, `\"15\"`, `\"1T\"`.\n * @param expression - Function that returns a Series, a number, or an array of them.\n * @param ignore_invalid_symbol - True to get empty arrays for a symbol that does not exist instead of stopping the\n * script. Default: false.\n * @returns One array of numbers per chart bar (empty when no lower bar is inside it), or one such list per element\n * when the expression returns an array.\n * @example\n * ```js\n * const vols = request.security_lower_tf(\"\", \"15\", () => volume);\n * const maxVolume = eachBar((c) => Math.max(0, ...vols[c.i]));\n * plot(maxVolume, \"Largest 15m volume\");\n * ```\n */\n security_lower_tf<T extends SecurityValue>(\n symbol: string,\n timeframe: string,\n expression: () => T,\n ignore_invalid_symbol?: boolean\n ): T extends unknown[] ? number[][][] : number[][];\n /**\n * Lower-timeframe values per chart bar, with the other arguments by name.\n * @param symbol - Symbol id; `\"\"` is the chart symbol.\n * @param timeframe - Lower timeframe string.\n * @param expression - Function that returns a Series, a number, or an array of them.\n * @param args - Named arguments: `ignore_invalid_symbol`. `currency`, `ignore_invalid_timeframe` and\n * `calc_bars_count` are not supported and stop the script.\n * @returns One array of numbers per chart bar, or one such list per element of an array expression.\n * @example\n * ```js\n * const closes = request.security_lower_tf(\"\", \"5\", () => close, { ignore_invalid_symbol: true });\n * const count = eachBar((c) => closes[c.i].length);\n * plot(count, \"5m bars\");\n * ```\n */\n security_lower_tf<T extends SecurityValue>(\n symbol: string,\n timeframe: string,\n expression: () => T,\n args: SecurityLowerTfArgs<T>\n ): T extends unknown[] ? number[][][] : number[][];\n /**\n * Lower-timeframe values per chart bar, with every argument by name.\n * @param args - Named arguments: `symbol`, `timeframe`, `expression` (required), `ignore_invalid_symbol`.\n * @returns One array of numbers per chart bar, or one such list per element of an array expression.\n * @example\n * ```js\n * const highs = request.security_lower_tf({ symbol: \"\", timeframe: \"1\", expression: () => high });\n * const first = eachBar((c) => highs[c.i][0] ?? NaN);\n * plot(first, \"First minute high\");\n * ```\n */\n security_lower_tf<T extends SecurityValue>(\n args: SecurityLowerTfArgs<T> & { symbol: string; timeframe: string; expression: () => T }\n ): T extends unknown[] ? number[][][] : number[][];\n\n /**\n * Computes `expression` on a seed data series (data published as a separate series), on the chart timeframe. It\n * is `request.security` on the symbol the app gives that series (by default `\"<SOURCE>:<SYMBOL>\"` upper-cased).\n * @param source - Name of the seed data source.\n * @param symbol - Name of the series in that source.\n * @param expression - Function that returns a Series, a number, or an array of them.\n * @param ignore_invalid_symbol - True to get na for a series that does not exist instead of stopping the script.\n * Default: false.\n * @returns A Series on the chart bars, or one Series per element when the expression returns an array.\n * @example\n * ```js\n * const activity = request.seed(\"seed_crypto_santiment\", \"BTC_DEV_ACTIVITY\", () => close);\n * plot(activity, \"Dev activity\");\n * ```\n */\n seed<T extends SecurityValue>(\n source: string,\n symbol: string,\n expression: () => T,\n ignore_invalid_symbol?: boolean\n ): T extends unknown[] ? Series[] : Series;\n /**\n * A seed data series, with the other arguments by name.\n * @param source - Name of the seed data source.\n * @param symbol - Name of the series in that source.\n * @param expression - Function that returns a Series, a number, or an array of them.\n * @param args - Named arguments: `ignore_invalid_symbol`. `calc_bars_count` is not supported and stops the script.\n * @returns A Series on the chart bars, or one Series per element when the expression returns an array.\n * @example\n * ```js\n * const options = { ignore_invalid_symbol: true };\n * const activity = request.seed(\"seed_crypto_santiment\", \"BTC_DEV_ACTIVITY\", () => close, options);\n * plot(activity, \"Dev activity\");\n * ```\n */\n seed<T extends SecurityValue>(\n source: string,\n symbol: string,\n expression: () => T,\n args: SeedArgs<T>\n ): T extends unknown[] ? Series[] : Series;\n /**\n * A seed data series, with every argument by name.\n * @param args - Named arguments: `source`, `symbol`, `expression` (required), `ignore_invalid_symbol`.\n * @returns A Series on the chart bars, or one Series per element when the expression returns an array.\n * @example\n * ```js\n * const source = \"seed_crypto_santiment\";\n * const activity = request.seed({ source, symbol: \"BTC_DEV_ACTIVITY\", expression: () => close });\n * plot(activity, \"Dev activity\");\n * ```\n */\n seed<T extends SecurityValue>(\n args: SeedArgs<T> & { source: string; symbol: string; expression: () => T }\n ): T extends unknown[] ? Series[] : Series;\n\n /**\n * The dividend per share of a symbol, as declared (not adjusted for later splits), on the chart bars. With the\n * default lookahead off, a dividend shows from the first bar that closes after the end of its ex-date's period\n * (the next day on a daily chart). na before the first dividend.\n * @param ticker - Symbol id; `\"\"` or `syminfo.tickerid` is the chart symbol.\n * @param field - `dividends.net` or `dividends.gross`. Default: `dividends.net`.\n * @param gaps - `barmerge.gaps_on` shows the value only on the bar where it appears. Default: `barmerge.gaps_off`.\n * @param lookahead - `barmerge.lookahead_on` shows it from the first bar of its period. Default:\n * `barmerge.lookahead_off`.\n * @param ignore_invalid_symbol - True to get na for a symbol that does not exist. Default: false.\n * @param currency - Currency conversion is not supported: leave it out (any value but `\"\"` or `\"NONE\"` stops the\n * script).\n * @returns Series of the last dividend.\n * @example\n * ```js\n * const dividend = request.dividends(syminfo.tickerid);\n * plot(dividend.mul(4).div(close).mul(100), \"Yield %\");\n * ```\n */\n dividends(\n ticker: string,\n field?: string,\n gaps?: string,\n lookahead?: string,\n ignore_invalid_symbol?: boolean,\n currency?: string\n ): Series;\n /**\n * The dividend per share of a symbol, with the arguments after `field` by name.\n * @param ticker - Symbol id; `\"\"` is the chart symbol.\n * @param field - `dividends.net` or `dividends.gross`.\n * @param args - Named arguments: `gaps`, `lookahead`, `ignore_invalid_symbol`.\n * @returns Series of the last dividend.\n * @example\n * ```js\n * const gross = request.dividends(\"\", dividends.gross, { gaps: barmerge.gaps_on });\n * plot(gross, \"Gross dividend\", { style: plot.style_circles });\n * ```\n */\n dividends(ticker: string, field: string, args: EventRequestArgs): Series;\n /**\n * The dividend per share of a symbol, with the arguments after `ticker` by name.\n * @param ticker - Symbol id; `\"\"` is the chart symbol.\n * @param args - Named arguments: `field`, `gaps`, `lookahead`, `ignore_invalid_symbol`.\n * @returns Series of the last dividend.\n * @example\n * ```js\n * const dividend = request.dividends(\"\", { field: dividends.net });\n * plot(dividend, \"Dividend\");\n * ```\n */\n dividends(ticker: string, args: EventRequestArgs): Series;\n /**\n * The dividend per share of a symbol, with every argument by name.\n * @param args - Named arguments: `ticker` (required), `field`, `gaps`, `lookahead`, `ignore_invalid_symbol`.\n * @returns Series of the last dividend.\n * @example\n * ```js\n * const dividend = request.dividends({ ticker: syminfo.tickerid });\n * plot(dividend, \"Dividend\");\n * ```\n */\n dividends(args: EventRequestArgs & { ticker: string }): Series;\n\n /**\n * One number of the last split ratio of a symbol on the chart bars (2 and 1 for a 2-for-1 split). With the\n * default lookahead off, a split shows from the first bar that closes after the end of its day's period. na\n * before the first split.\n * @param ticker - Symbol id; `\"\"` or `syminfo.tickerid` is the chart symbol.\n * @param field - `splits.numerator` or `splits.denominator` (required).\n * @param gaps - `barmerge.gaps_on` shows the value only on the bar where it appears. Default: `barmerge.gaps_off`.\n * @param lookahead - `barmerge.lookahead_on` shows it from the first bar of its period. Default:\n * `barmerge.lookahead_off`.\n * @param ignore_invalid_symbol - True to get na for a symbol that does not exist. Default: false.\n * @returns Series of the numerator or the denominator of the last split.\n * @example\n * ```js\n * const split = request.splits(syminfo.tickerid, splits.numerator, barmerge.gaps_on);\n * plotshape(split.gt(0), \"Split\", { location: location.bottom });\n * ```\n */\n splits(\n ticker: string,\n field: string,\n gaps?: string,\n lookahead?: string,\n ignore_invalid_symbol?: boolean\n ): Series;\n /**\n * One number of the last split ratio, with the arguments after `field` by name.\n * @param ticker - Symbol id; `\"\"` is the chart symbol.\n * @param field - `splits.numerator` or `splits.denominator`.\n * @param args - Named arguments: `gaps`, `lookahead`, `ignore_invalid_symbol`.\n * @returns Series of the numerator or the denominator of the last split.\n * @example\n * ```js\n * const ratio = request.splits(\"\", splits.denominator, { lookahead: barmerge.lookahead_off });\n * plot(ratio, \"Split denominator\");\n * ```\n */\n splits(ticker: string, field: string, args: SplitsRequestArgs): Series;\n /**\n * One number of the last split ratio, with the arguments after `ticker` by name.\n * @param ticker - Symbol id; `\"\"` is the chart symbol.\n * @param args - Named arguments: `field` (required), `gaps`, `lookahead`, `ignore_invalid_symbol`.\n * @returns Series of the numerator or the denominator of the last split.\n * @example\n * ```js\n * const ratio = request.splits(\"\", { field: splits.numerator });\n * plot(ratio, \"Split numerator\");\n * ```\n */\n splits(ticker: string, args: SplitsRequestArgs): Series;\n /**\n * One number of the last split ratio, with every argument by name.\n * @param args - Named arguments: `ticker` and `field` (required), `gaps`, `lookahead`, `ignore_invalid_symbol`.\n * @returns Series of the numerator or the denominator of the last split.\n * @example\n * ```js\n * const ratio = request.splits({ ticker: syminfo.tickerid, field: splits.numerator });\n * plot(ratio, \"Split numerator\");\n * ```\n */\n splits(args: SplitsRequestArgs & { ticker: string }): Series;\n\n /**\n * The earnings per share of the last release of a symbol (adjusted for later splits) on the chart bars. With the\n * default lookahead off, a release shows from the first bar after the period of the chart timeframe it was\n * published in (the next day on a daily chart). Releases still to come are left out; na before the first one.\n * A field the app has no data for stops the script.\n * @param ticker - Symbol id; `\"\"` or `syminfo.tickerid` is the chart symbol.\n * @param field - `earnings.actual`, `earnings.estimate` or `earnings.standardized`. Default: `earnings.actual`.\n * @param gaps - `barmerge.gaps_on` shows the value only on the bar where it appears. Default: `barmerge.gaps_off`.\n * @param lookahead - `barmerge.lookahead_on` shows it from the first bar of its period. Default:\n * `barmerge.lookahead_off`.\n * @param ignore_invalid_symbol - True to get na for a symbol that does not exist. Default: false.\n * @param currency - Currency conversion is not supported: leave it out (any value but `\"\"` or `\"NONE\"` stops the\n * script).\n * @returns Series of the last earnings per share.\n * @example\n * ```js\n * const eps = request.earnings(syminfo.tickerid, earnings.actual);\n * plot(eps, \"EPS\", { style: plot.style_stepline });\n * ```\n */\n earnings(\n ticker: string,\n field?: string,\n gaps?: string,\n lookahead?: string,\n ignore_invalid_symbol?: boolean,\n currency?: string\n ): Series;\n /**\n * The earnings per share of the last release, with the arguments after `field` by name.\n * @param ticker - Symbol id; `\"\"` is the chart symbol.\n * @param field - `earnings.actual`, `earnings.estimate` or `earnings.standardized`.\n * @param args - Named arguments: `gaps`, `lookahead`, `ignore_invalid_symbol`.\n * @returns Series of the last earnings per share.\n * @example\n * ```js\n * const estimate = request.earnings(\"\", earnings.estimate, { gaps: barmerge.gaps_on });\n * plot(estimate, \"EPS estimate\", { style: plot.style_circles });\n * ```\n */\n earnings(ticker: string, field: string, args: EventRequestArgs): Series;\n /**\n * The earnings per share of the last release, with the arguments after `ticker` by name.\n * @param ticker - Symbol id; `\"\"` is the chart symbol.\n * @param args - Named arguments: `field`, `gaps`, `lookahead`, `ignore_invalid_symbol`.\n * @returns Series of the last earnings per share.\n * @example\n * ```js\n * const eps = request.earnings(\"\", { field: earnings.actual });\n * plot(eps, \"EPS\");\n * ```\n */\n earnings(ticker: string, args: EventRequestArgs): Series;\n /**\n * The earnings per share of the last release, with every argument by name.\n * @param args - Named arguments: `ticker` (required), `field`, `gaps`, `lookahead`, `ignore_invalid_symbol`.\n * @returns Series of the last earnings per share.\n * @example\n * ```js\n * const eps = request.earnings({ ticker: syminfo.tickerid });\n * plot(eps, \"EPS\");\n * ```\n */\n earnings(args: EventRequestArgs & { ticker: string }): Series;\n}\n\n// \u2500\u2500 chart \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n/** `chart.point.*`: points (time or bar index, and price) for drawings such as polylines. */\nexport interface ChartPointNamespace {\n /**\n * A point with every coordinate. Give the time or the bar index (the other one can be null), as the drawing's\n * `xloc` expects.\n * @param time - UNIX time in ms, or null.\n * @param index - Bar index, or null.\n * @param price - Price of the point.\n * @returns The new point.\n * @example\n * ```js\n * eachBar((c) => {\n * if (c.i === c.n - 1) polyline.new([chart.point.new(null, c.i - 10, c.low), chart.point.new(null, c.i, c.high)]);\n * });\n * ```\n */\n 'new'(time: number | null, index: number | null, price: number): ChartPoint;\n\n /**\n * A point with every coordinate (the same as `chart.point.new`).\n * @param time - UNIX time in ms, or null.\n * @param index - Bar index, or null.\n * @param price - Price of the point.\n * @returns The new point.\n * @example\n * ```js\n * const p = chart.point.new_point(null, 0, 100);\n * ```\n */\n new_point(time: number | null, index: number | null, price: number): ChartPoint;\n\n /**\n * A point at a time and a price (its bar index is null), for drawings placed with `xloc.bar_time`.\n * @param time - UNIX time in ms.\n * @param price - Price of the point.\n * @returns The new point.\n * @example\n * ```js\n * eachBar((c) => {\n * const points = [chart.point.from_time(c.time, c.low), chart.point.from_time(c.time, c.high)];\n * if (c.i === c.n - 1) polyline.new(points, { xloc: xloc.bar_time });\n * });\n * ```\n */\n from_time(time: number, price: number): ChartPoint;\n\n /**\n * A point at a bar index and a price (its time is null), for drawings placed with `xloc.bar_index`.\n * @param index - Bar index.\n * @param price - Price of the point.\n * @returns The new point.\n * @example\n * ```js\n * eachBar((c) => {\n * const points = [chart.point.from_index(c.i - 20, c.low), chart.point.from_index(c.i, c.high)];\n * if (c.i === c.n - 1) polyline.new(points);\n * });\n * ```\n */\n from_index(index: number, price: number): ChartPoint;\n\n /**\n * A copy of a point.\n * @param point - The point to copy.\n * @returns A new point with the same time, index and price.\n * @example\n * ```js\n * const a = chart.point.from_index(0, 100);\n * const b = chart.point.copy(a);\n * ```\n */\n copy(point: ChartPoint): ChartPoint;\n\n /**\n * The point of the current bar: its time, its bar index and a price. Call it inside a bar loop.\n * @param price - Price of the point. Default: the close of the bar.\n * @returns The point of the current bar.\n * @example\n * ```js\n * eachBar((c) => {\n * if (c.i === c.n - 1) polyline.new([chart.point.from_index(c.i - 10, c.low), chart.point.now(c.high)]);\n * });\n * ```\n */\n now(price?: number): ChartPoint;\n}\n\n/** The chart the script runs on: its colours, the bars in view, its type, and chart points for drawings. */\nexport interface ChartNamespace {\n /** Foreground (text) colour of the chart, e.g. `\"#DBDBDB\"` on a dark chart. */\n readonly fg_color: string;\n\n /** Background colour of the chart, e.g. `\"#0F0F0F\"` on a dark chart. */\n readonly bg_color: string;\n\n /**\n * Time (UNIX ms) of the first bar in view; the first bar's time when the app does not give it. A script that reads\n * it is calculated again when the chart scrolls.\n */\n readonly left_visible_bar_time: number;\n\n /**\n * Time (UNIX ms) of the last bar in view; the last bar's time when the app does not give it. A script that reads\n * it is calculated again when the chart scrolls.\n */\n readonly right_visible_bar_time: number;\n\n /** True when the chart shows standard bars or candles (none of the types below). */\n readonly is_standard: boolean;\n\n /** True on a Heikin Ashi chart. */\n readonly is_heikinashi: boolean;\n\n /** True on a Renko chart. */\n readonly is_renko: boolean;\n\n /** True on a Kagi chart. */\n readonly is_kagi: boolean;\n\n /** True on a Line break chart. */\n readonly is_linebreak: boolean;\n\n /** True on a Point and figure chart. */\n readonly is_pnf: boolean;\n\n /** True on a Range chart. */\n readonly is_range: boolean;\n\n /** Chart points (time or bar index, and price) for drawings. */\n readonly point: ChartPointNamespace;\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;AAAA;AAAA;",
6
+ "names": []
7
+ }
@@ -0,0 +1,58 @@
1
+ /**
2
+ * @fileoverview The documented type of the `log` namespace of the script API (messages for the logs panel).
3
+ * @module script/api/log
4
+ */
5
+ /**
6
+ * Messages for the app's logs panel, at three levels: `log.info`, `log.warning` and `log.error`. Use them to follow
7
+ * values while you write a script. Inside `eachBar()` / `strategy.eachBar()` a call makes one message on the
8
+ * current bar; at the top level of the script it makes one message on every bar. A run keeps its newest 10,000
9
+ * messages.
10
+ */
11
+ export interface LogNamespace {
12
+ /**
13
+ * Writes an information message to the logs panel, on the current bar inside a bar loop, on every bar at the top
14
+ * level. With arguments, `message` is a pattern whose `{0}`, `{1}`... are replaced by the arguments, as in
15
+ * `str.format()`; a Series argument gives its value on the bar.
16
+ * @param message - The text, or a pattern with `{0}`, `{1}`... At the top level it can also be an array with one
17
+ * text per bar; a bar whose text is `undefined` gets no message.
18
+ * @param args - Values for the placeholders of the pattern: numbers, texts, Series... Default: none.
19
+ * @example
20
+ * ```js
21
+ * eachBar((c) => {
22
+ * if (c.i === c.n - 1) log.info("Last close {0}", c.close);
23
+ * });
24
+ * ```
25
+ */
26
+ info(message: string | ReadonlyArray<string | undefined>, ...args: unknown[]): void;
27
+ /**
28
+ * Writes a warning message to the logs panel, on the current bar inside a bar loop, on every bar at the top
29
+ * level. With arguments, `message` is a pattern whose `{0}`, `{1}`... are replaced by the arguments, as in
30
+ * `str.format()`; a Series argument gives its value on the bar.
31
+ * @param message - The text, or a pattern with `{0}`, `{1}`... At the top level it can also be an array with one
32
+ * text per bar; a bar whose text is `undefined` gets no message.
33
+ * @param args - Values for the placeholders of the pattern: numbers, texts, Series... Default: none.
34
+ * @example
35
+ * ```js
36
+ * eachBar((c) => {
37
+ * if (c.volume === 0) log.warning("No volume on bar {0}", c.i);
38
+ * });
39
+ * ```
40
+ */
41
+ warning(message: string | ReadonlyArray<string | undefined>, ...args: unknown[]): void;
42
+ /**
43
+ * Writes an error message to the logs panel, on the current bar inside a bar loop, on every bar at the top level.
44
+ * It does not stop the script. With arguments, `message` is a pattern whose `{0}`, `{1}`... are replaced by the
45
+ * arguments, as in `str.format()`; a Series argument gives its value on the bar.
46
+ * @param message - The text, or a pattern with `{0}`, `{1}`... At the top level it can also be an array with one
47
+ * text per bar; a bar whose text is `undefined` gets no message.
48
+ * @param args - Values for the placeholders of the pattern: numbers, texts, Series... Default: none.
49
+ * @example
50
+ * ```js
51
+ * eachBar((c) => {
52
+ * if (c.high < c.low) log.error("High below low on bar {0}", c.i);
53
+ * });
54
+ * ```
55
+ */
56
+ error(message: string | ReadonlyArray<string | undefined>, ...args: unknown[]): void;
57
+ }
58
+ //# sourceMappingURL=log.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"log.d.ts","sourceRoot":"","sources":["../../../../src/script/api/log.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;GAKG;AACH,MAAM,WAAW,YAAY;IAC3B;;;;;;;;;;;;;OAaG;IACH,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,aAAa,CAAC,MAAM,GAAG,SAAS,CAAC,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IAEpF;;;;;;;;;;;;;OAaG;IACH,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,aAAa,CAAC,MAAM,GAAG,SAAS,CAAC,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IAEvF;;;;;;;;;;;;;OAaG;IACH,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,aAAa,CAAC,MAAM,GAAG,SAAS,CAAC,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;CACtF"}
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __copyProps = (to, from, except, desc) => {
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from))
9
+ if (!__hasOwnProp.call(to, key) && key !== except)
10
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
+ }
12
+ return to;
13
+ };
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
+ var log_exports = {};
16
+ module.exports = __toCommonJS(log_exports);
17
+ //# sourceMappingURL=log.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/script/api/log.ts"],
4
+ "sourcesContent": ["/**\n * @fileoverview The documented type of the `log` namespace of the script API (messages for the logs panel).\n * @module script/api/log\n */\n\n/**\n * Messages for the app's logs panel, at three levels: `log.info`, `log.warning` and `log.error`. Use them to follow\n * values while you write a script. Inside `eachBar()` / `strategy.eachBar()` a call makes one message on the\n * current bar; at the top level of the script it makes one message on every bar. A run keeps its newest 10,000\n * messages.\n */\nexport interface LogNamespace {\n /**\n * Writes an information message to the logs panel, on the current bar inside a bar loop, on every bar at the top\n * level. With arguments, `message` is a pattern whose `{0}`, `{1}`... are replaced by the arguments, as in\n * `str.format()`; a Series argument gives its value on the bar.\n * @param message - The text, or a pattern with `{0}`, `{1}`... At the top level it can also be an array with one\n * text per bar; a bar whose text is `undefined` gets no message.\n * @param args - Values for the placeholders of the pattern: numbers, texts, Series... Default: none.\n * @example\n * ```js\n * eachBar((c) => {\n * if (c.i === c.n - 1) log.info(\"Last close {0}\", c.close);\n * });\n * ```\n */\n info(message: string | ReadonlyArray<string | undefined>, ...args: unknown[]): void;\n\n /**\n * Writes a warning message to the logs panel, on the current bar inside a bar loop, on every bar at the top\n * level. With arguments, `message` is a pattern whose `{0}`, `{1}`... are replaced by the arguments, as in\n * `str.format()`; a Series argument gives its value on the bar.\n * @param message - The text, or a pattern with `{0}`, `{1}`... At the top level it can also be an array with one\n * text per bar; a bar whose text is `undefined` gets no message.\n * @param args - Values for the placeholders of the pattern: numbers, texts, Series... Default: none.\n * @example\n * ```js\n * eachBar((c) => {\n * if (c.volume === 0) log.warning(\"No volume on bar {0}\", c.i);\n * });\n * ```\n */\n warning(message: string | ReadonlyArray<string | undefined>, ...args: unknown[]): void;\n\n /**\n * Writes an error message to the logs panel, on the current bar inside a bar loop, on every bar at the top level.\n * It does not stop the script. With arguments, `message` is a pattern whose `{0}`, `{1}`... are replaced by the\n * arguments, as in `str.format()`; a Series argument gives its value on the bar.\n * @param message - The text, or a pattern with `{0}`, `{1}`... At the top level it can also be an array with one\n * text per bar; a bar whose text is `undefined` gets no message.\n * @param args - Values for the placeholders of the pattern: numbers, texts, Series... Default: none.\n * @example\n * ```js\n * eachBar((c) => {\n * if (c.high < c.low) log.error(\"High below low on bar {0}\", c.i);\n * });\n * ```\n */\n error(message: string | ReadonlyArray<string | undefined>, ...args: unknown[]): void;\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;AAAA;AAAA;",
6
+ "names": []
7
+ }
@@ -0,0 +1,391 @@
1
+ /**
2
+ * @fileoverview Documented type of the `strategy` script global: the `strategy()` declaration and the `strategy.*`
3
+ * namespace (constants, order calls, results, trades, risk rules).
4
+ * @module script/api/strategy
5
+ */
6
+ import type { Series } from '../../runtime/series.js';
7
+ import type { StrategyCloseAllOptions, StrategyCloseOptions, StrategyDirection, StrategyEntryOptions, StrategyExitOptions, StrategyOptions, StrategyRiskDirection, StrategyRiskValueType, StrategyTrade } from '../../strategy/index.js';
8
+ import type { BarContext } from '../index.js';
9
+ /** `strategy.commission.*`: how `commission_value` of `strategy()` is counted. */
10
+ export interface StrategyCommissionConstants {
11
+ /** Commission in percent of the order value (`commission_value: 0.1` is 0.1 %). */
12
+ readonly percent: 'percent';
13
+ /** Commission in money for each contract (or share) traded. */
14
+ readonly cash_per_contract: 'cash_per_contract';
15
+ /** Commission in money for each filled order, whatever its size. */
16
+ readonly cash_per_order: 'cash_per_order';
17
+ }
18
+ /** `strategy.direction.*`: the directions allowed by `strategy.risk.allow_entry_in()`. */
19
+ export interface StrategyRiskDirectionConstants {
20
+ /** Long and short entries are both allowed. */
21
+ readonly all: 'all';
22
+ /** Only long entries open a position. */
23
+ readonly long: 'long';
24
+ /** Only short entries open a position. */
25
+ readonly short: 'short';
26
+ }
27
+ /** `strategy.oca.*`: how the orders of one OCA group (`oca_name`) act on each other. */
28
+ export interface StrategyOcaConstants {
29
+ /** No group: the order does not act on other orders. */
30
+ readonly none: 'none';
31
+ /** When one order of the group fills, the other orders of the group are cancelled. */
32
+ readonly cancel: 'cancel';
33
+ /** When one order of the group fills, the quantity of the other orders of the group is reduced by the filled quantity. */
34
+ readonly reduce: 'reduce';
35
+ }
36
+ /** `strategy.risk.*`: rules that stop or limit trading. Call them at the top level, after `strategy()`. */
37
+ export interface StrategyRiskNamespace {
38
+ /**
39
+ * Lets entries open positions in one direction only. An entry in the other direction then only closes the open
40
+ * position instead of reversing it.
41
+ * @param direction - `strategy.direction.all`, `strategy.direction.long` or `strategy.direction.short`.
42
+ * @returns Nothing.
43
+ * @example
44
+ * ```js
45
+ * strategy("Long only", { overlay: true });
46
+ * strategy.risk.allow_entry_in(strategy.direction.long);
47
+ * ```
48
+ */
49
+ allow_entry_in(direction: StrategyRiskDirection): void;
50
+ /**
51
+ * Stops trading after a number of losing days in a row: pending orders are cancelled, the position is closed
52
+ * and no new order is placed.
53
+ * @param count - Number of consecutive losing days that stops trading.
54
+ * @param alert_message - Message of the alert sent when the rule fires. Default: none.
55
+ * @returns Nothing.
56
+ * @example
57
+ * ```js
58
+ * strategy("Guarded", { overlay: true });
59
+ * strategy.risk.max_cons_loss_days(3);
60
+ * ```
61
+ */
62
+ max_cons_loss_days(count: number, alert_message?: string): void;
63
+ /**
64
+ * Stops trading when the drawdown of the equity reaches a limit: pending orders are cancelled, the position is
65
+ * closed and no new order is placed.
66
+ * @param value - Largest drawdown allowed, in percent of the equity or in money (see `type`).
67
+ * @param type - `"percent_of_equity"` or `"cash"` (`strategy.percent_of_equity`, `strategy.cash`).
68
+ * @param alert_message - Message of the alert sent when the rule fires. Default: none.
69
+ * @returns Nothing.
70
+ * @example
71
+ * ```js
72
+ * strategy("Guarded", { overlay: true });
73
+ * strategy.risk.max_drawdown(20, strategy.percent_of_equity);
74
+ * ```
75
+ */
76
+ max_drawdown(value: number, type: StrategyRiskValueType, alert_message?: string): void;
77
+ /**
78
+ * Limits the number of filled orders in one trading day: when it is reached, pending orders are cancelled, the
79
+ * position is closed and trading stops until the next day.
80
+ * @param count - Largest number of filled orders per day.
81
+ * @param alert_message - Message of the alert sent when the rule fires. Default: none.
82
+ * @returns Nothing.
83
+ * @example
84
+ * ```js
85
+ * strategy("Intraday", { overlay: true });
86
+ * strategy.risk.max_intraday_filled_orders(10);
87
+ * ```
88
+ */
89
+ max_intraday_filled_orders(count: number, alert_message?: string): void;
90
+ /**
91
+ * Limits the loss of one trading day: when it is reached, pending orders are cancelled, the position is closed
92
+ * and trading stops until the next day.
93
+ * @param value - Largest daily loss, in percent of the equity or in money (see `type`).
94
+ * @param type - `"percent_of_equity"` or `"cash"` (`strategy.percent_of_equity`, `strategy.cash`).
95
+ * @param alert_message - Message of the alert sent when the rule fires. Default: none.
96
+ * @returns Nothing.
97
+ * @example
98
+ * ```js
99
+ * strategy("Intraday", { overlay: true });
100
+ * strategy.risk.max_intraday_loss(500, strategy.cash);
101
+ * ```
102
+ */
103
+ max_intraday_loss(value: number, type: StrategyRiskValueType, alert_message?: string): void;
104
+ /**
105
+ * Caps the size of the position: an entry that would go past it is reduced to fit.
106
+ * @param contracts - Largest absolute position size, in contracts (shares, units).
107
+ * @returns Nothing.
108
+ * @example
109
+ * ```js
110
+ * strategy("Capped", { overlay: true });
111
+ * strategy.risk.max_position_size(100);
112
+ * ```
113
+ */
114
+ max_position_size(contracts: number): void;
115
+ }
116
+ /**
117
+ * The `strategy` global: call it to declare a strategy, and use its members to place orders and read the results.
118
+ *
119
+ * OakScript does not fill orders itself: the host (the app's backtester) supplies the order engine. Order calls and
120
+ * the per-bar results (`strategy.position_size`, `strategy.equity`...) work only inside `strategy.eachBar()`;
121
+ * `strategy.initial_capital`, `strategy.account_currency`, the constants and the risk rules work anywhere after
122
+ * `strategy()`. A value the engine does not provide throws "... is not provided by the strategy engine".
123
+ */
124
+ export interface StrategyNamespace {
125
+ /**
126
+ * Declares the script as a strategy and sets its name and its backtest properties (capital, order size,
127
+ * commission...). Call it once, at the top of the script, instead of `indicator()`.
128
+ * @param title - Name of the strategy, shown on the chart and in the lists.
129
+ * @param options - Strategy properties, e.g. `overlay` (default false: own pane), `initial_capital` (default
130
+ * 100000), `default_qty_type` (default `strategy.percent_of_equity`), `default_qty_value` (default 100),
131
+ * `pyramiding` (default 0), `commission_type`, `commission_value` (default 0), `slippage` (ticks, default 0),
132
+ * `process_orders_on_close` (default false). Default: all defaults.
133
+ * @returns Nothing.
134
+ * @example
135
+ * ```js
136
+ * strategy("MA Cross", { overlay: true, initial_capital: 10000, default_qty_type: strategy.percent_of_equity, default_qty_value: 50 });
137
+ * ```
138
+ */
139
+ (title: string, options?: StrategyOptions): void;
140
+ /** Direction of a long order: buys (`strategy.entry("L", strategy.long)`). */
141
+ readonly long: 'long';
142
+ /** Direction of a short order: sells (`strategy.entry("S", strategy.short)`). */
143
+ readonly short: 'short';
144
+ /** Order size type: `default_qty_value` is a number of contracts (shares, units). */
145
+ readonly fixed: 'fixed';
146
+ /** Order size type: `default_qty_value` is an amount of money; also the money type of the risk rules. */
147
+ readonly cash: 'cash';
148
+ /** Order size type: `default_qty_value` is a percent of the equity; also the percent type of the risk rules. */
149
+ readonly percent_of_equity: 'percent_of_equity';
150
+ /** Commission types for the `commission_type` property of `strategy()`. */
151
+ readonly commission: StrategyCommissionConstants;
152
+ /** Directions for `strategy.risk.allow_entry_in()`. */
153
+ readonly direction: StrategyRiskDirectionConstants;
154
+ /** One-cancels-all group types for the `oca_type` option of `strategy.entry()` / `strategy.order()`. */
155
+ readonly oca: StrategyOcaConstants;
156
+ /**
157
+ * The strategy's bar loop: runs the callback once per bar, oldest first, at the bar's close. Before each call the
158
+ * engine fills the orders placed earlier; place, change or cancel orders and read the results inside it. Compute
159
+ * every Series (`ta.*`) before it and read them with `c.get()`. A script has one `strategy.eachBar()`.
160
+ * @param fn - Called with the bar context `c` (`c.i`, `c.close`, `c.get(series)`...); what it returns becomes
161
+ * the value of that bar (true / false give 1 / 0, nothing gives NaN).
162
+ * @returns A Series of the values returned by `fn`, one per bar.
163
+ * @example
164
+ * ```js
165
+ * const up = ta.crossover(ta.sma(close, 10), ta.sma(close, 30));
166
+ * strategy.eachBar((c) => {
167
+ * if (c.get(up) === 1) strategy.entry("Long", strategy.long);
168
+ * });
169
+ * ```
170
+ */
171
+ eachBar(fn: (c: BarContext) => number | boolean | void): Series;
172
+ /**
173
+ * Places an order that opens or adds to a position. An entry in the other direction first closes the open
174
+ * position (a reversal); entries in the same direction beyond the first follow the `pyramiding` property. Without
175
+ * `limit` or `stop` it is a market order, filled at the next bar's open. Calling it again with the id of a pending
176
+ * order changes that order.
177
+ * @param id - Name of the entry; exits refer to it with `from_entry`.
178
+ * @param direction - `strategy.long` or `strategy.short`.
179
+ * @param options - `qty` (default: from `default_qty_type` / `default_qty_value`), `limit` and `stop` prices,
180
+ * `oca_name`, `oca_type`, `comment`, `alert_message`, `disable_alert`. NaN values count as not given. Default: {}.
181
+ * @returns Nothing.
182
+ * @example
183
+ * ```js
184
+ * const up = ta.crossover(ta.ema(close, 12), ta.ema(close, 26));
185
+ * strategy.eachBar((c) => {
186
+ * if (c.get(up) === 1) strategy.entry("Long", strategy.long, { comment: "EMA cross" });
187
+ * });
188
+ * ```
189
+ */
190
+ entry(id: string, direction: StrategyDirection, options?: StrategyEntryOptions): void;
191
+ /**
192
+ * Places a plain order: a buy (`strategy.long`) or a sell (`strategy.short`) that adds to or reduces the position,
193
+ * with no reversal and no `pyramiding` limit. Without `limit` or `stop` it is a market order. Calling it again with
194
+ * the id of a pending order changes that order.
195
+ * @param id - Name of the order.
196
+ * @param direction - `strategy.long` (buy) or `strategy.short` (sell).
197
+ * @param options - `qty` (default: from `default_qty_type` / `default_qty_value`), `limit` and `stop` prices,
198
+ * `oca_name`, `oca_type`, `comment`, `alert_message`, `disable_alert`. NaN values count as not given. Default: {}.
199
+ * @returns Nothing.
200
+ * @example
201
+ * ```js
202
+ * strategy.eachBar((c) => {
203
+ * if (c.close > c.get(close, 1)) strategy.order("Buy", strategy.long, { qty: 1 });
204
+ * });
205
+ * ```
206
+ */
207
+ order(id: string, direction: StrategyDirection, options?: StrategyEntryOptions): void;
208
+ /**
209
+ * Places the exit orders of an entry: a stop loss, a take profit and / or a trailing stop. They wait while the
210
+ * entry is pending and are cancelled with its position. Calling it again with the same id moves the orders (e.g.
211
+ * a stop updated on every bar).
212
+ * @param id - Name of the exit order.
213
+ * @param options - `from_entry` (default: every open entry), `qty` / `qty_percent` (default: 100 % of the
214
+ * position), prices `stop`, `limit`, `trail_price`, distances in ticks `loss`, `profit`, `trail_points`,
215
+ * `trail_offset`, comments and alert messages. Give at least one price or distance. NaN values count as not given.
216
+ * Default: {}.
217
+ * @returns Nothing.
218
+ * @example
219
+ * ```js
220
+ * strategy.eachBar((c) => {
221
+ * const avg = strategy.position_avg_price;
222
+ * if (strategy.position_size > 0) strategy.exit("Exit", { from_entry: "Long", stop: avg * 0.98, limit: avg * 1.04 });
223
+ * });
224
+ * ```
225
+ */
226
+ exit(id: string, options?: StrategyExitOptions): void;
227
+ /**
228
+ * Closes the open trades of an entry with a market order, filled at the next bar's open (or at this bar's close with
229
+ * `immediately: true`).
230
+ * @param id - Name of the entry to close.
231
+ * @param options - `qty` / `qty_percent` (default: the whole position of the entry), `comment`, `alert_message`,
232
+ * `immediately` (default false), `disable_alert`. Default: {}.
233
+ * @returns Nothing.
234
+ * @example
235
+ * ```js
236
+ * const down = ta.crossunder(ta.ema(close, 12), ta.ema(close, 26));
237
+ * strategy.eachBar((c) => {
238
+ * if (c.get(down) === 1) strategy.close("Long", { comment: "Cross down" });
239
+ * });
240
+ * ```
241
+ */
242
+ close(id: string, options?: StrategyCloseOptions): void;
243
+ /**
244
+ * Closes the whole position, whatever entries opened it, with a market order filled at the next bar's open (or at
245
+ * this bar's close with `immediately: true`).
246
+ * @param options - `comment`, `alert_message`, `immediately` (default false), `disable_alert`. Default: {}.
247
+ * @returns Nothing.
248
+ * @example
249
+ * ```js
250
+ * const rsi = ta.rsi(close, 14);
251
+ * strategy.eachBar((c) => {
252
+ * if (c.get(rsi) > 70) strategy.close_all({ comment: "RSI > 70" });
253
+ * });
254
+ * ```
255
+ */
256
+ close_all(options?: StrategyCloseAllOptions): void;
257
+ /**
258
+ * Cancels the pending orders (entries, orders or exits) with this id. Filled orders are not affected.
259
+ * @param id - Name of the orders to cancel.
260
+ * @returns Nothing.
261
+ * @example
262
+ * ```js
263
+ * strategy.eachBar((c) => {
264
+ * if (c.close < c.open) strategy.cancel("Breakout");
265
+ * });
266
+ * ```
267
+ */
268
+ cancel(id: string): void;
269
+ /**
270
+ * Cancels every pending order of the strategy. Filled orders and the position are not affected.
271
+ * @returns Nothing.
272
+ * @example
273
+ * ```js
274
+ * strategy.eachBar((c) => {
275
+ * if (c.i === c.n - 1) strategy.cancel_all();
276
+ * });
277
+ * ```
278
+ */
279
+ cancel_all(): void;
280
+ /**
281
+ * Reads one open trade: its entry, size and profit so far.
282
+ * @param index - Number of the open trade, 0 for the oldest, `strategy.opentrades - 1` for the newest.
283
+ * @returns The trade (`entry_id`, `entry_price`, `entry_bar_index`, `entry_time`, `size`, `profit`, `commission`,
284
+ * `max_runup`, `max_drawdown`...), or undefined when there is no such trade.
285
+ * @example
286
+ * ```js
287
+ * strategy.eachBar((c) => {
288
+ * const trade = strategy.opentrade(0);
289
+ * if (trade && c.i - trade.entry_bar_index >= 10) strategy.close(trade.entry_id);
290
+ * });
291
+ * ```
292
+ */
293
+ opentrade(index: number): StrategyTrade | undefined;
294
+ /**
295
+ * Reads one closed trade: its entry, exit and result.
296
+ * @param index - Number of the closed trade, 0 for the oldest, `strategy.closedtrades - 1` for the newest.
297
+ * @returns The trade (`entry_*` and `exit_*` fields, `size`, `profit`, `profit_percent`, `commission`...), or
298
+ * undefined when there is no such trade.
299
+ * @example
300
+ * ```js
301
+ * strategy.eachBar((c) => {
302
+ * const last = strategy.closedtrade(strategy.closedtrades - 1);
303
+ * if (last && last.exit_bar_index === c.i && last.profit < 0) alert("Losing trade closed");
304
+ * });
305
+ * ```
306
+ */
307
+ closedtrade(index: number): StrategyTrade | undefined;
308
+ /**
309
+ * Gives the quantity an entry without `qty` would get if it filled at a price, from the `default_qty_type` and
310
+ * `default_qty_value` properties and the current equity. Not every engine provides it.
311
+ * @param fill_price - Price the order would fill at.
312
+ * @returns The quantity, in contracts (shares, units).
313
+ * @example
314
+ * ```js
315
+ * strategy.eachBar((c) => {
316
+ * const half = Math.floor(strategy.default_entry_qty(c.close) / 2);
317
+ * if (strategy.position_size === 0) strategy.entry("Half", strategy.long, { qty: half });
318
+ * });
319
+ * ```
320
+ */
321
+ default_entry_qty(fill_price: number): number;
322
+ /** Risk rules that stop or limit trading (drawdown, daily loss, position size...). */
323
+ readonly risk: StrategyRiskNamespace;
324
+ /** Size of the current position: positive when long, negative when short, 0 when flat. */
325
+ readonly position_size: number;
326
+ /** Average entry price of the current position; NaN when flat. */
327
+ readonly position_avg_price: number;
328
+ /** Current equity: initial capital + net profit + open profit, in the account currency. */
329
+ readonly equity: number;
330
+ /** Starting capital of the backtest (the `initial_capital` property); readable anywhere after `strategy()`. */
331
+ readonly initial_capital: number;
332
+ /** Profit of all closed trades, after commission, in the account currency. */
333
+ readonly netprofit: number;
334
+ /** `strategy.netprofit` in percent of the initial capital. */
335
+ readonly netprofit_percent: number;
336
+ /** Profit or loss of the open trades not yet realized, in the account currency. */
337
+ readonly openprofit: number;
338
+ /** `strategy.openprofit` in percent. */
339
+ readonly openprofit_percent: number;
340
+ /** Sum of the profits of the winning closed trades, in the account currency. */
341
+ readonly grossprofit: number;
342
+ /** `strategy.grossprofit` in percent of the initial capital. */
343
+ readonly grossprofit_percent: number;
344
+ /** Sum of the losses of the losing closed trades, as a positive amount in the account currency. */
345
+ readonly grossloss: number;
346
+ /** `strategy.grossloss` in percent of the initial capital. */
347
+ readonly grossloss_percent: number;
348
+ /** Number of open trades (a number, not a function: read a trade with `strategy.opentrade(i)`). */
349
+ readonly opentrades: number;
350
+ /** Number of closed trades (a number, not a function: read a trade with `strategy.closedtrade(i)`). */
351
+ readonly closedtrades: number;
352
+ /** Number of closed trades with a profit. */
353
+ readonly wintrades: number;
354
+ /** Number of closed trades with a loss. */
355
+ readonly losstrades: number;
356
+ /** Number of closed trades that broke even (profit 0). */
357
+ readonly eventrades: number;
358
+ /** Average profit per closed trade, in the account currency; NaN before the first closed trade. */
359
+ readonly avg_trade: number;
360
+ /** Average profit per closed trade, in percent; NaN before the first closed trade. */
361
+ readonly avg_trade_percent: number;
362
+ /** Average profit of the winning trades, in the account currency; NaN before the first one. */
363
+ readonly avg_winning_trade: number;
364
+ /** Average profit of the winning trades, in percent; NaN before the first one. */
365
+ readonly avg_winning_trade_percent: number;
366
+ /** Average loss of the losing trades, as a positive amount in the account currency; NaN before the first one. */
367
+ readonly avg_losing_trade: number;
368
+ /** Average loss of the losing trades, as a positive percent; NaN before the first one. */
369
+ readonly avg_losing_trade_percent: number;
370
+ /** Largest drop of the equity from a peak so far, in the account currency. */
371
+ readonly max_drawdown: number;
372
+ /** `strategy.max_drawdown` in percent. */
373
+ readonly max_drawdown_percent: number;
374
+ /** Largest rise of the equity from a low so far, in the account currency. */
375
+ readonly max_runup: number;
376
+ /** `strategy.max_runup` in percent. */
377
+ readonly max_runup_percent: number;
378
+ /** Largest position held so far, long or short, in contracts (shares, units). */
379
+ readonly max_contracts_held_all: number;
380
+ /** Largest long position held so far, in contracts (shares, units). */
381
+ readonly max_contracts_held_long: number;
382
+ /** Largest short position held so far, in contracts (shares, units). */
383
+ readonly max_contracts_held_short: number;
384
+ /** Price at which a margin call would close part of the current position; NaN when there is none. */
385
+ readonly margin_liquidation_price: number;
386
+ /** Id of the entry that opened the current position (its oldest open trade); empty when flat. */
387
+ readonly position_entry_name: string;
388
+ /** Currency of the account the results are counted in (e.g. "USD"); readable anywhere after `strategy()`. */
389
+ readonly account_currency: string;
390
+ }
391
+ //# sourceMappingURL=strategy.d.ts.map