oakscriptjs 0.11.1 → 0.11.2
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.
- package/dist/cjs/callsite/index.d.ts.map +1 -1
- package/dist/cjs/callsite/index.js +5 -2
- package/dist/cjs/callsite/index.js.map +2 -2
- package/dist/cjs/index.d.ts +2 -2
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +2 -1
- package/dist/cjs/index.js.map +2 -2
- package/dist/cjs/script/index.d.ts +1 -1
- package/dist/cjs/script/index.d.ts.map +1 -1
- package/dist/cjs/script/index.js +6 -51
- package/dist/cjs/script/index.js.map +2 -2
- package/dist/cjs/session/calendar.d.ts.map +1 -1
- package/dist/cjs/session/calendar.js +1 -0
- package/dist/cjs/session/calendar.js.map +2 -2
- package/dist/cjs/session/context.d.ts +20 -4
- package/dist/cjs/session/context.d.ts.map +1 -1
- package/dist/cjs/session/context.js +65 -5
- package/dist/cjs/session/context.js.map +2 -2
- package/dist/cjs/ta/index.d.ts +31 -29
- package/dist/cjs/ta/index.d.ts.map +1 -1
- package/dist/cjs/ta/index.js +10 -12
- package/dist/cjs/ta/index.js.map +3 -3
- package/dist/cjs/table/index.d.ts +10 -5
- package/dist/cjs/table/index.d.ts.map +1 -1
- package/dist/cjs/table/index.js +11 -2
- package/dist/cjs/table/index.js.map +2 -2
- package/dist/esm/callsite/index.d.ts.map +1 -1
- package/dist/esm/callsite/index.js +5 -2
- package/dist/esm/callsite/index.js.map +1 -1
- package/dist/esm/index.d.ts +2 -2
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +5 -4
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/script/index.d.ts +1 -1
- package/dist/esm/script/index.d.ts.map +1 -1
- package/dist/esm/script/index.js +7 -62
- package/dist/esm/script/index.js.map +1 -1
- package/dist/esm/session/calendar.d.ts.map +1 -1
- package/dist/esm/session/calendar.js +4 -0
- package/dist/esm/session/calendar.js.map +1 -1
- package/dist/esm/session/context.d.ts +20 -4
- package/dist/esm/session/context.d.ts.map +1 -1
- package/dist/esm/session/context.js +81 -7
- package/dist/esm/session/context.js.map +1 -1
- package/dist/esm/ta/index.d.ts +31 -29
- package/dist/esm/ta/index.d.ts.map +1 -1
- package/dist/esm/ta/index.js +45 -45
- package/dist/esm/ta/index.js.map +1 -1
- package/dist/esm/table/index.d.ts +10 -5
- package/dist/esm/table/index.d.ts.map +1 -1
- package/dist/esm/table/index.js +23 -8
- package/dist/esm/table/index.js.map +1 -1
- package/package.json +1 -1
- package/src/callsite/index.ts +5 -2
- package/src/index.ts +6 -3
- package/src/script/index.ts +7 -65
- package/src/session/calendar.ts +3 -0
- package/src/session/context.ts +99 -7
- package/src/ta/index.ts +46 -45
- package/src/table/index.ts +22 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calendar.d.ts","sourceRoot":"","sources":["../../../src/session/calendar.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAKH,sEAAsE;AACtE,MAAM,WAAW,WAAW;IAC1B,uEAAuE;IACvE,OAAO,EAAE,MAAM,CAAC;IAChB,2GAA2G;IAC3G,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,uGAAuG;IACvG,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;CAC9B;AAED,wBAAwB;AACxB,MAAM,MAAM,OAAO,GAAG,MAAM,CAAC;AAoB7B,eAAO,MAAM,SAAS,GAAI,GAAG,MAAM,EAAE,GAAG,MAAM,EAAE,GAAG,MAAM,KAAG,OAAkC,CAAC;AAM/F,eAAO,MAAM,OAAO,GAAI,MAAM,OAAO,EAAE,GAAG,MAAM,KAAG,OAAgD,CAAC;AACpG,kCAAkC;AAClC,eAAO,MAAM,SAAS,GAAI,MAAM,OAAO,KAAG,MAA+C,CAAC;AAC1F,mEAAmE;AACnE,eAAO,MAAM,SAAS,SATD,OAAO,KAAG,MASD,CAAC;AAsE/B,4E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,OAAiE,CAAC"}
|
|
@@ -145,6 +145,7 @@ class TradingCalendar {
|
|
|
145
145
|
out = periods.map(
|
|
146
146
|
(p) => this.pine ? [at(d - p.startOffset, p.start, true), at(d - p.endOffset, p.end - 1, true) + 6e4] : [at(d - p.startOffset, p.start), at(d - p.endOffset, p.end)]
|
|
147
147
|
);
|
|
148
|
+
if (this.pine && out.length > 1) out = [[Math.min(...out.map((p) => p[0])), Math.max(...out.map((p) => p[1]))]];
|
|
148
149
|
this.cache.set(date, out);
|
|
149
150
|
return out;
|
|
150
151
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/session/calendar.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Trading calendar: the session periods of each trading day of a symbol, from the symbol session\n * information (issue #100).\n *\n * Session format (symbol session information, also PineScript session strings):\n * - periods \"HHMM-HHMM\", several separated by commas; \"24x7\" is the whole day, every day\n * - a period whose end is not after its start (\"1700-1600\", \"1700-1700\") starts the day before the\n * trading day: the session that opens Sunday 17:00 is Monday's\n * - \"HHMMF<n>\" moves a time <n> days before the trading day (\"1700F2-1200F1\"); \"F\" alone is one day (\"1700F-1900\":\n * 17:00 of the day before to 19:00)\n * - several sections joined by \"|\", each with its own days (\"1900-1900:3456|1700F-1900:2\": Monday opens on Sunday\n * 17:00, the other days at 19:00 of the day before)\n * - optional days after \":\" (1 = Sunday ... 7 = Saturday); without days a symbol session trades Monday to\n * Friday (\"24x7\": every day), and a PineScript session string follows PineScript's rules (one period:\n * every day; several periods: Monday to Friday)\n * - \"#YYYYMMDD/<session>\" changes the session from that date (\"0900-1746#20251201/0800-2200\")\n * - corrections (\"session-correction\"): \"<session>:<dates>;dayoff:<dates>\" replace the session of these\n * dates (early closes, days off); holidays (\"session_holidays\") are dates without session\n */\n\nimport { zonedFields, zonedToUnix } from '../time/timezone.js';\nimport { parsePineSession } from '../time/session.js';\n\n/** Session information of a symbol (hours, corrections, holidays). */\nexport interface SessionSpec {\n /** Session hours: \"0930-1600\", \"1700-1600\", \"24x7\", \"0400-2000\" ... */\n session: string;\n /** Exceptions by date (symbol info \"session-correction\"): \"0930-1300:20251128,20251224;dayoff:20250109\" */\n corrections?: string;\n /** Exchange holidays as \"YYYYMMDD\" (symbol info \"session_holidays\"), comma-separated or as an array */\n holidays?: string | string[];\n}\n\n/** Date as YYYYMMDD. */\nexport type DateNum = number;\n\ninterface Period {\n /** Minutes after midnight */\n start: number;\n end: number;\n /** Days before the trading day */\n startOffset: number;\n endOffset: number;\n}\n\ninterface Version {\n from: DateNum;\n periods: Period[];\n /** Index 1 (Sunday) to 7 (Saturday) */\n days: boolean[];\n /** PineScript session strings: the periods of each weekday (index 1 to 7), from the \"|\" sections */\n byDay?: Period[][];\n}\n\nexport const toDateNum = (y: number, m: number, d: number): DateNum => y * 10000 + m * 100 + d;\nconst utcOf = (date: DateNum): number => Date.UTC(Math.floor(date / 10000), Math.floor(date / 100) % 100 - 1, date % 100);\nconst fromUtc = (ms: number): DateNum => {\n const d = new Date(ms);\n return toDateNum(d.getUTCFullYear(), d.getUTCMonth() + 1, d.getUTCDate());\n};\nexport const addDays = (date: DateNum, n: number): DateNum => fromUtc(utcOf(date) + n * 86_400_000);\n/** 1 = Sunday ... 7 = Saturday */\nexport const weekdayOf = (date: DateNum): number => new Date(utcOf(date)).getUTCDay() + 1;\n/** 00:00 UTC of the date, in ms (PineScript `time_tradingday`). */\nexport const dateUtcMs = utcOf;\n\nfunction parseTime(token: string, spec: string): { minutes: number; offset?: number } {\n const m = /^(\\d{2})(\\d{2})(?:F(\\d*))?$/.exec(token.trim());\n if (!m) throw new SyntaxError(`Invalid session \"${spec}\"`);\n // \"F\" without a number is one day before the trading day\n return { minutes: Number(m[1]) * 60 + Number(m[2]), offset: m[3] === undefined ? undefined : Number(m[3] || 1) };\n}\n\nfunction parsePeriods(text: string, spec: string): Period[] {\n if (text.trim() === '24x7') return [{ start: 0, end: 1440, startOffset: 0, endOffset: 0 }];\n return text.split(',').map((p) => {\n const [a = '', b = ''] = p.split('-');\n const s = parseTime(a, spec);\n const e = parseTime(b, spec);\n if (s.minutes === 0 && e.minutes === 0 && s.offset === undefined && e.offset === undefined) {\n return { start: 0, end: 1440, startOffset: 0, endOffset: 0 };\n }\n return {\n start: s.minutes,\n end: e.minutes,\n startOffset: s.offset ?? (e.minutes <= s.minutes ? 1 : 0),\n endOffset: e.offset ?? 0,\n };\n });\n}\n\n/** A PineScript session string as periods per weekday (rules in time/session.ts). */\nfunction pineVersion(text: string, from: DateNum): Version {\n const ranges = parsePineSession(text);\n if (ranges === null) throw new SyntaxError(`Session \"${text}\" is the symbol session`);\n const byDay: Period[][] = Array.from({ length: 8 }, () => []);\n for (const { start, end, days, startDays } of ranges) {\n // a run that ends at 0000 ends at 24:00 of the day it starts and belongs to that day (#173)\n const period: Period =\n start === 0 && end === 0\n ? { start: 0, end: 1440, startOffset: 0, endOffset: 0 }\n : startDays !== undefined\n ? { start, end, startOffset: startDays, endOffset: 0 }\n : end === 0\n ? { start, end: 1440, startOffset: 0, endOffset: 0 }\n : { start, end, startOffset: end <= start ? 1 : 0, endOffset: 0 };\n for (const d of days) byDay[d]!.push(period);\n }\n return { from, periods: [], days: byDay.map((p) => p.length > 0), byDay };\n}\n\nfunction parseVersion(text: string, from: DateNum, spec: string, rule: 'symbol' | 'pine'): Version {\n if (rule === 'pine') return pineVersion(text, from);\n if (text.includes('|')) {\n // sections with their own days\n const byDay: Period[][] = Array.from({ length: 8 }, () => []);\n for (const section of text.split('|').filter((part) => part.trim())) {\n const one = parseVersion(section, from, spec, rule);\n one.days.forEach((on, d) => {\n if (on) byDay[d] = one.periods;\n });\n }\n return { from, periods: [], days: byDay.map((p) => p.length > 0), byDay };\n }\n const [periodText = '', dayText] = text.trim().split(':');\n const periods = parsePeriods(periodText, spec);\n const allDays = periodText.trim() === '24x7';\n const digits = dayText ?? (allDays ? '1234567' : '23456');\n if (!/^[1-7]+$/.test(digits)) throw new SyntaxError(`Invalid session days in \"${spec}\"`);\n const days = new Array<boolean>(8).fill(false);\n for (const d of digits) days[Number(d)] = true;\n return { from, periods, days };\n}\n\n/** Session periods of every trading day of a symbol, as UNIX times (ms). */\nexport class TradingCalendar {\n private readonly versions: Version[];\n private readonly corrections = new Map<DateNum, Period[] | null>();\n private readonly holidays: Set<DateNum>;\n private readonly cache = new Map<DateNum, Array<[number, number]>>();\n private readonly pine: boolean;\n\n /**\n * @param timezone - Time zone of the session hours (the exchange time zone)\n * @param spec - Session information (hours, corrections, holidays)\n * @param rule - Days without \":days\": 'symbol' (Monday to Friday) or 'pine' (PineScript session strings)\n * @param dayPlacement - PineScript session strings read for `time(\"D\", session)`: the wall times of a clock-change\n * day are placed as the JVM does (see `periods`); without it, as `time.inSession` places them\n */\n constructor(\n readonly timezone: string,\n spec: SessionSpec,\n rule: 'symbol' | 'pine' = 'symbol',\n dayPlacement = false\n ) {\n this.pine = rule === 'pine' && dayPlacement;\n const [first = '', ...changes] = spec.session.split('#');\n this.versions = [parseVersion(first, 0, spec.session, rule)];\n for (const change of changes) {\n const m = /^(\\d{8})\\/(.+)$/.exec(change.trim());\n if (!m) throw new SyntaxError(`Invalid session change in \"${spec.session}\"`);\n this.versions.push(parseVersion(m[2]!, Number(m[1]), spec.session, rule));\n }\n for (const part of (spec.corrections ?? '').split(';').filter((p) => p.trim())) {\n const i = part.lastIndexOf(':');\n const text = part.slice(0, i).trim();\n const periods = text === 'dayoff' ? null : parsePeriods(text, part);\n for (const date of part.slice(i + 1).split(',')) this.corrections.set(Number(date), periods);\n }\n const holidays = Array.isArray(spec.holidays) ? spec.holidays : (spec.holidays ?? '').split(',');\n this.holidays = new Set(holidays.filter((h) => h.trim()).map(Number));\n }\n\n /** Session periods [start, end) of the trading day `date`; empty when the day has no session. */\n periods(date: DateNum): Array<[number, number]> {\n let out = this.cache.get(date);\n if (out) return out;\n let periods: Period[] = [];\n const correction = this.corrections.get(date);\n if (correction !== undefined) {\n periods = correction ?? [];\n } else if (!this.holidays.has(date)) {\n const version = [...this.versions].reverse().find((v) => v.from <= date)!;\n if (version.byDay) periods = version.byDay[weekdayOf(date)]!;\n else if (version.days[weekdayOf(date)]) periods = version.periods;\n }\n const y = Math.floor(date / 10000);\n const m = Math.floor(date / 100) % 100;\n const d = date % 100;\n const at = (dd: number, minutes: number, earlier = false): number =>\n zonedToUnix(this.timezone, y, m, dd, Math.floor(minutes / 60), minutes % 60, 0, earlier);\n // for \"D\", PineScript session strings place the wall times of a clock-change day as the JVM does: a skipped time moves\n // past the gap, a repeated time is its first pass, and the end is the minute before it plus one minute (\"0000-0300\"\n // on a 02:00 -> 03:00 night ends at 03:00 of the old offset, \"0000-0400\" at 04:00 of the new one) (#173)\n out = periods.map((p) =>\n this.pine\n ? [at(d - p.startOffset, p.start, true), at(d - p.endOffset, p.end - 1, true) + 60_000]\n : [at(d - p.startOffset, p.start), at(d - p.endOffset, p.end)]\n );\n this.cache.set(date, out);\n return out;\n }\n\n isTradingDay(date: DateNum): boolean {\n return this.periods(date).length > 0;\n }\n\n /**\n * True for a bar that opens after the session of its day was cut by a correction (an early close) but inside the\n * usual hours of that day: PineScript has no period for such a bar (`time(\"D\")` is na on it).\n */\n afterEarlyClose(time: number): boolean {\n const at = this.locate(time);\n if (!at || at.inside || !this.corrections.get(at.date)) return false;\n const version = [...this.versions].reverse().find((v) => v.from <= at.date)!;\n const usual = version.byDay ? version.byDay[weekdayOf(at.date)]! : version.days[weekdayOf(at.date)] ? version.periods : [];\n const y = Math.floor(at.date / 10000);\n const m = Math.floor(at.date / 100) % 100;\n const d = at.date % 100;\n return usual.some(\n (p) =>\n zonedToUnix(this.timezone, y, m, d - p.startOffset, Math.floor(p.start / 60), p.start % 60) <= time &&\n time < zonedToUnix(this.timezone, y, m, d - p.endOffset, Math.floor(p.end / 60), p.end % 60)\n );\n }\n\n /**\n * Trading day and period of a time: the period that contains it, else the last period that started\n * before it. Null when no trading day is found near the time.\n */\n locate(time: number): { date: DateNum; index: number; inside: boolean } | null {\n const f = zonedFields(time, this.timezone);\n const local = toDateNum(f.year, f.month, f.day);\n for (let k = 0; k <= 5; k++) {\n const date = addDays(local, k);\n const index = this.periods(date).findIndex(([s, e]) => s <= time && time < e);\n if (index !== -1) return { date, index, inside: true };\n }\n for (let k = 5; k >= -7; k--) {\n const date = addDays(local, k);\n const periods = this.periods(date);\n let index = -1;\n periods.forEach(([s], i) => {\n if (s <= time) index = i;\n });\n if (index !== -1) return { date, index, inside: false };\n }\n return null;\n }\n\n /** First trading day in [from, to] (dates), or null. */\n firstTradingDay(from: DateNum, to: DateNum): DateNum | null {\n for (let date = from; date <= to; date = addDays(date, 1)) if (this.isTradingDay(date)) return date;\n return null;\n }\n\n /** Last trading day in [from, to] (dates), or null. */\n lastTradingDay(from: DateNum, to: DateNum): DateNum | null {\n for (let date = to; date >= from; date = addDays(date, -1)) if (this.isTradingDay(date)) return date;\n return null;\n }\n}\n\n/** Monday of the week of `date` (weeks run Monday to Sunday). */\nexport const weekStart = (date: DateNum): DateNum => addDays(date, -((weekdayOf(date) + 5) % 7));\n/** First day of the month of `date`. */\nexport const monthStart = (date: DateNum): DateNum => Math.floor(date / 100) * 100 + 1;\n/** Last day of the month of `date`. */\nexport const monthEnd = (date: DateNum): DateNum => addDays(monthStart(addDays(monthStart(date), 32)), -1);\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAoBA,sBAAyC;AACzC,qBAAiC;AAiC1B,MAAM,YAAY,CAAC,GAAW,GAAW,MAAuB,IAAI,MAAQ,IAAI,MAAM;AAC7F,MAAM,QAAQ,CAAC,SAA0B,KAAK,IAAI,KAAK,MAAM,OAAO,GAAK,GAAG,KAAK,MAAM,OAAO,GAAG,IAAI,MAAM,GAAG,OAAO,GAAG;AACxH,MAAM,UAAU,CAAC,OAAwB;AACvC,QAAM,IAAI,IAAI,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,KAAK,MAAM,UAAU,EAAE,GAAG,UAAU,IAAI,GAAG,OAAO;AAIzF,UAAM,QAAQ;AAAA,MAAI,CAAC,MACjB,KAAK,OACD,CAAC,GAAG,IAAI,EAAE,aAAa,EAAE,OAAO,IAAI,GAAG,GAAG,IAAI,EAAE,WAAW,EAAE,MAAM,GAAG,IAAI,IAAI,GAAM,IACpF,CAAC,GAAG,IAAI,EAAE,aAAa,EAAE,KAAK,GAAG,GAAG,IAAI,EAAE,WAAW,EAAE,GAAG,CAAC;AAAA,IACjE;
|
|
4
|
+
"sourcesContent": ["/**\n * Trading calendar: the session periods of each trading day of a symbol, from the symbol session\n * information (issue #100).\n *\n * Session format (symbol session information, also PineScript session strings):\n * - periods \"HHMM-HHMM\", several separated by commas; \"24x7\" is the whole day, every day\n * - a period whose end is not after its start (\"1700-1600\", \"1700-1700\") starts the day before the\n * trading day: the session that opens Sunday 17:00 is Monday's\n * - \"HHMMF<n>\" moves a time <n> days before the trading day (\"1700F2-1200F1\"); \"F\" alone is one day (\"1700F-1900\":\n * 17:00 of the day before to 19:00)\n * - several sections joined by \"|\", each with its own days (\"1900-1900:3456|1700F-1900:2\": Monday opens on Sunday\n * 17:00, the other days at 19:00 of the day before)\n * - optional days after \":\" (1 = Sunday ... 7 = Saturday); without days a symbol session trades Monday to\n * Friday (\"24x7\": every day), and a PineScript session string follows PineScript's rules (one period:\n * every day; several periods: Monday to Friday)\n * - \"#YYYYMMDD/<session>\" changes the session from that date (\"0900-1746#20251201/0800-2200\")\n * - corrections (\"session-correction\"): \"<session>:<dates>;dayoff:<dates>\" replace the session of these\n * dates (early closes, days off); holidays (\"session_holidays\") are dates without session\n */\n\nimport { zonedFields, zonedToUnix } from '../time/timezone.js';\nimport { parsePineSession } from '../time/session.js';\n\n/** Session information of a symbol (hours, corrections, holidays). */\nexport interface SessionSpec {\n /** Session hours: \"0930-1600\", \"1700-1600\", \"24x7\", \"0400-2000\" ... */\n session: string;\n /** Exceptions by date (symbol info \"session-correction\"): \"0930-1300:20251128,20251224;dayoff:20250109\" */\n corrections?: string;\n /** Exchange holidays as \"YYYYMMDD\" (symbol info \"session_holidays\"), comma-separated or as an array */\n holidays?: string | string[];\n}\n\n/** Date as YYYYMMDD. */\nexport type DateNum = number;\n\ninterface Period {\n /** Minutes after midnight */\n start: number;\n end: number;\n /** Days before the trading day */\n startOffset: number;\n endOffset: number;\n}\n\ninterface Version {\n from: DateNum;\n periods: Period[];\n /** Index 1 (Sunday) to 7 (Saturday) */\n days: boolean[];\n /** PineScript session strings: the periods of each weekday (index 1 to 7), from the \"|\" sections */\n byDay?: Period[][];\n}\n\nexport const toDateNum = (y: number, m: number, d: number): DateNum => y * 10000 + m * 100 + d;\nconst utcOf = (date: DateNum): number => Date.UTC(Math.floor(date / 10000), Math.floor(date / 100) % 100 - 1, date % 100);\nconst fromUtc = (ms: number): DateNum => {\n const d = new Date(ms);\n return toDateNum(d.getUTCFullYear(), d.getUTCMonth() + 1, d.getUTCDate());\n};\nexport const addDays = (date: DateNum, n: number): DateNum => fromUtc(utcOf(date) + n * 86_400_000);\n/** 1 = Sunday ... 7 = Saturday */\nexport const weekdayOf = (date: DateNum): number => new Date(utcOf(date)).getUTCDay() + 1;\n/** 00:00 UTC of the date, in ms (PineScript `time_tradingday`). */\nexport const dateUtcMs = utcOf;\n\nfunction parseTime(token: string, spec: string): { minutes: number; offset?: number } {\n const m = /^(\\d{2})(\\d{2})(?:F(\\d*))?$/.exec(token.trim());\n if (!m) throw new SyntaxError(`Invalid session \"${spec}\"`);\n // \"F\" without a number is one day before the trading day\n return { minutes: Number(m[1]) * 60 + Number(m[2]), offset: m[3] === undefined ? undefined : Number(m[3] || 1) };\n}\n\nfunction parsePeriods(text: string, spec: string): Period[] {\n if (text.trim() === '24x7') return [{ start: 0, end: 1440, startOffset: 0, endOffset: 0 }];\n return text.split(',').map((p) => {\n const [a = '', b = ''] = p.split('-');\n const s = parseTime(a, spec);\n const e = parseTime(b, spec);\n if (s.minutes === 0 && e.minutes === 0 && s.offset === undefined && e.offset === undefined) {\n return { start: 0, end: 1440, startOffset: 0, endOffset: 0 };\n }\n return {\n start: s.minutes,\n end: e.minutes,\n startOffset: s.offset ?? (e.minutes <= s.minutes ? 1 : 0),\n endOffset: e.offset ?? 0,\n };\n });\n}\n\n/** A PineScript session string as periods per weekday (rules in time/session.ts). */\nfunction pineVersion(text: string, from: DateNum): Version {\n const ranges = parsePineSession(text);\n if (ranges === null) throw new SyntaxError(`Session \"${text}\" is the symbol session`);\n const byDay: Period[][] = Array.from({ length: 8 }, () => []);\n for (const { start, end, days, startDays } of ranges) {\n // a run that ends at 0000 ends at 24:00 of the day it starts and belongs to that day (#173)\n const period: Period =\n start === 0 && end === 0\n ? { start: 0, end: 1440, startOffset: 0, endOffset: 0 }\n : startDays !== undefined\n ? { start, end, startOffset: startDays, endOffset: 0 }\n : end === 0\n ? { start, end: 1440, startOffset: 0, endOffset: 0 }\n : { start, end, startOffset: end <= start ? 1 : 0, endOffset: 0 };\n for (const d of days) byDay[d]!.push(period);\n }\n return { from, periods: [], days: byDay.map((p) => p.length > 0), byDay };\n}\n\nfunction parseVersion(text: string, from: DateNum, spec: string, rule: 'symbol' | 'pine'): Version {\n if (rule === 'pine') return pineVersion(text, from);\n if (text.includes('|')) {\n // sections with their own days\n const byDay: Period[][] = Array.from({ length: 8 }, () => []);\n for (const section of text.split('|').filter((part) => part.trim())) {\n const one = parseVersion(section, from, spec, rule);\n one.days.forEach((on, d) => {\n if (on) byDay[d] = one.periods;\n });\n }\n return { from, periods: [], days: byDay.map((p) => p.length > 0), byDay };\n }\n const [periodText = '', dayText] = text.trim().split(':');\n const periods = parsePeriods(periodText, spec);\n const allDays = periodText.trim() === '24x7';\n const digits = dayText ?? (allDays ? '1234567' : '23456');\n if (!/^[1-7]+$/.test(digits)) throw new SyntaxError(`Invalid session days in \"${spec}\"`);\n const days = new Array<boolean>(8).fill(false);\n for (const d of digits) days[Number(d)] = true;\n return { from, periods, days };\n}\n\n/** Session periods of every trading day of a symbol, as UNIX times (ms). */\nexport class TradingCalendar {\n private readonly versions: Version[];\n private readonly corrections = new Map<DateNum, Period[] | null>();\n private readonly holidays: Set<DateNum>;\n private readonly cache = new Map<DateNum, Array<[number, number]>>();\n private readonly pine: boolean;\n\n /**\n * @param timezone - Time zone of the session hours (the exchange time zone)\n * @param spec - Session information (hours, corrections, holidays)\n * @param rule - Days without \":days\": 'symbol' (Monday to Friday) or 'pine' (PineScript session strings)\n * @param dayPlacement - PineScript session strings read for `time(\"D\", session)`: the wall times of a clock-change\n * day are placed as the JVM does (see `periods`); without it, as `time.inSession` places them\n */\n constructor(\n readonly timezone: string,\n spec: SessionSpec,\n rule: 'symbol' | 'pine' = 'symbol',\n dayPlacement = false\n ) {\n this.pine = rule === 'pine' && dayPlacement;\n const [first = '', ...changes] = spec.session.split('#');\n this.versions = [parseVersion(first, 0, spec.session, rule)];\n for (const change of changes) {\n const m = /^(\\d{8})\\/(.+)$/.exec(change.trim());\n if (!m) throw new SyntaxError(`Invalid session change in \"${spec.session}\"`);\n this.versions.push(parseVersion(m[2]!, Number(m[1]), spec.session, rule));\n }\n for (const part of (spec.corrections ?? '').split(';').filter((p) => p.trim())) {\n const i = part.lastIndexOf(':');\n const text = part.slice(0, i).trim();\n const periods = text === 'dayoff' ? null : parsePeriods(text, part);\n for (const date of part.slice(i + 1).split(',')) this.corrections.set(Number(date), periods);\n }\n const holidays = Array.isArray(spec.holidays) ? spec.holidays : (spec.holidays ?? '').split(',');\n this.holidays = new Set(holidays.filter((h) => h.trim()).map(Number));\n }\n\n /** Session periods [start, end) of the trading day `date`; empty when the day has no session. */\n periods(date: DateNum): Array<[number, number]> {\n let out = this.cache.get(date);\n if (out) return out;\n let periods: Period[] = [];\n const correction = this.corrections.get(date);\n if (correction !== undefined) {\n periods = correction ?? [];\n } else if (!this.holidays.has(date)) {\n const version = [...this.versions].reverse().find((v) => v.from <= date)!;\n if (version.byDay) periods = version.byDay[weekdayOf(date)]!;\n else if (version.days[weekdayOf(date)]) periods = version.periods;\n }\n const y = Math.floor(date / 10000);\n const m = Math.floor(date / 100) % 100;\n const d = date % 100;\n const at = (dd: number, minutes: number, earlier = false): number =>\n zonedToUnix(this.timezone, y, m, dd, Math.floor(minutes / 60), minutes % 60, 0, earlier);\n // for \"D\", PineScript session strings place the wall times of a clock-change day as the JVM does: a skipped time moves\n // past the gap, a repeated time is its first pass, and the end is the minute before it plus one minute (\"0000-0300\"\n // on a 02:00 -> 03:00 night ends at 03:00 of the old offset, \"0000-0400\" at 04:00 of the new one) (#173)\n out = periods.map((p) =>\n this.pine\n ? [at(d - p.startOffset, p.start, true), at(d - p.endOffset, p.end - 1, true) + 60_000]\n : [at(d - p.startOffset, p.start), at(d - p.endOffset, p.end)]\n );\n // for \"D\", the runs of a PineScript session string on one day are one period, from the earliest start to the\n // latest end: the time between two runs is inside the day (#182)\n if (this.pine && out.length > 1) out = [[Math.min(...out.map((p) => p[0])), Math.max(...out.map((p) => p[1]))]];\n this.cache.set(date, out);\n return out;\n }\n\n isTradingDay(date: DateNum): boolean {\n return this.periods(date).length > 0;\n }\n\n /**\n * True for a bar that opens after the session of its day was cut by a correction (an early close) but inside the\n * usual hours of that day: PineScript has no period for such a bar (`time(\"D\")` is na on it).\n */\n afterEarlyClose(time: number): boolean {\n const at = this.locate(time);\n if (!at || at.inside || !this.corrections.get(at.date)) return false;\n const version = [...this.versions].reverse().find((v) => v.from <= at.date)!;\n const usual = version.byDay ? version.byDay[weekdayOf(at.date)]! : version.days[weekdayOf(at.date)] ? version.periods : [];\n const y = Math.floor(at.date / 10000);\n const m = Math.floor(at.date / 100) % 100;\n const d = at.date % 100;\n return usual.some(\n (p) =>\n zonedToUnix(this.timezone, y, m, d - p.startOffset, Math.floor(p.start / 60), p.start % 60) <= time &&\n time < zonedToUnix(this.timezone, y, m, d - p.endOffset, Math.floor(p.end / 60), p.end % 60)\n );\n }\n\n /**\n * Trading day and period of a time: the period that contains it, else the last period that started\n * before it. Null when no trading day is found near the time.\n */\n locate(time: number): { date: DateNum; index: number; inside: boolean } | null {\n const f = zonedFields(time, this.timezone);\n const local = toDateNum(f.year, f.month, f.day);\n for (let k = 0; k <= 5; k++) {\n const date = addDays(local, k);\n const index = this.periods(date).findIndex(([s, e]) => s <= time && time < e);\n if (index !== -1) return { date, index, inside: true };\n }\n for (let k = 5; k >= -7; k--) {\n const date = addDays(local, k);\n const periods = this.periods(date);\n let index = -1;\n periods.forEach(([s], i) => {\n if (s <= time) index = i;\n });\n if (index !== -1) return { date, index, inside: false };\n }\n return null;\n }\n\n /** First trading day in [from, to] (dates), or null. */\n firstTradingDay(from: DateNum, to: DateNum): DateNum | null {\n for (let date = from; date <= to; date = addDays(date, 1)) if (this.isTradingDay(date)) return date;\n return null;\n }\n\n /** Last trading day in [from, to] (dates), or null. */\n lastTradingDay(from: DateNum, to: DateNum): DateNum | null {\n for (let date = to; date >= from; date = addDays(date, -1)) if (this.isTradingDay(date)) return date;\n return null;\n }\n}\n\n/** Monday of the week of `date` (weeks run Monday to Sunday). */\nexport const weekStart = (date: DateNum): DateNum => addDays(date, -((weekdayOf(date) + 5) % 7));\n/** First day of the month of `date`. */\nexport const monthStart = (date: DateNum): DateNum => Math.floor(date / 100) * 100 + 1;\n/** Last day of the month of `date`. */\nexport const monthEnd = (date: DateNum): DateNum => addDays(monthStart(addDays(monthStart(date), 32)), -1);\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAoBA,sBAAyC;AACzC,qBAAiC;AAiC1B,MAAM,YAAY,CAAC,GAAW,GAAW,MAAuB,IAAI,MAAQ,IAAI,MAAM;AAC7F,MAAM,QAAQ,CAAC,SAA0B,KAAK,IAAI,KAAK,MAAM,OAAO,GAAK,GAAG,KAAK,MAAM,OAAO,GAAG,IAAI,MAAM,GAAG,OAAO,GAAG;AACxH,MAAM,UAAU,CAAC,OAAwB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AO;AAAA,EACT;AAAA;AAAA,EAGA,eAAe,MAAe,IAA6B;AACzD,aAAS,OAAO,IAAI,QAAQ,MAAM,OAAO,QAAQ,MAAM,EAAE,EAAG,KAAI,KAAK,aAAa,IAAI,EAAG,QAAO;AAChG,WAAO;AAAA,EACT;AACF;AAGO,MAAM,YAAY,CAAC,SAA2B,QAAQ,MAAM,GAAG,UAAU,IAAI,IAAI,KAAK,EAAE;AAExF,MAAM,aAAa,CAAC,SAA2B,KAAK,MAAM,OAAO,GAAG,IAAI,MAAM;AAE9E,MAAM,WAAW,CAAC,SAA2B,QAAQ,WAAW,QAAQ,WAAW,IAAI,GAAG,EAAE,CAAC,GAAG,EAAE;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -35,10 +35,26 @@ export interface ChartSessions {
|
|
|
35
35
|
* @throws Error when the context has no timeframe, time zone or session
|
|
36
36
|
*/
|
|
37
37
|
export declare function chartSessions(chart: SessionContext): ChartSessions;
|
|
38
|
-
/**
|
|
39
|
-
export
|
|
40
|
-
|
|
41
|
-
|
|
38
|
+
/** Open and close (ms) of the period that contains a bar opening at a time in ms; NaN outside the session. */
|
|
39
|
+
export interface SessionPeriods {
|
|
40
|
+
open: (time: number) => number;
|
|
41
|
+
close: (time: number) => number;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* `time(tf, session, timezone)` / `time_close(tf, session, timezone)` of a bar, as PineScript computes them (#173):
|
|
45
|
+
* an intraday timeframe tests the bar with the session rules of time.inSession and aligns its periods on the start
|
|
46
|
+
* of the run that contains the bar; "D" tests the bar against the day's session period (the calendar; the time
|
|
47
|
+
* between two runs of a day is inside it, #182); a timeframe of more than one day ("2D", "W", "M") has no test and
|
|
48
|
+
* keeps the period's time. `bars` is the calendar of the loaded session (`chartSessions(chart).bars`).
|
|
49
|
+
*/
|
|
50
|
+
export declare function sessionPeriods(bars: SessionBars, chart: SessionContext, timeframe: string, session?: string, timezone?: string): SessionPeriods;
|
|
51
|
+
/**
|
|
52
|
+
* PineScript `time(timeframe, session, timezone)` (ms) of a bar that opens at `time`: the start of its period; NaN
|
|
53
|
+
* without one or outside `session` (#182). Without `session` and `timezone`, the periods of the loaded session.
|
|
54
|
+
*/
|
|
55
|
+
export declare function periodTime(time: number, timeframe: string, chart: SessionContext, session?: string, timezone?: string): number;
|
|
56
|
+
/** PineScript `time_close(timeframe, session, timezone)` (ms) of a bar that opens at `time` (#182). */
|
|
57
|
+
export declare function periodClose(time: number, timeframe: string, chart: SessionContext, session?: string, timezone?: string): number;
|
|
42
58
|
/** PineScript `time_tradingday` (ms, 00:00 UTC of the trading day) of a bar that opens at `time`. */
|
|
43
59
|
export declare function tradingDayTime(time: number, chart: SessionContext): number;
|
|
44
60
|
/** PineScript `session.*` flags of bars that open at `times` (in order). */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../src/session/context.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../src/session/context.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAI7C,OAAO,EAAE,WAAW,EAA8B,KAAK,YAAY,EAAE,MAAM,WAAW,CAAC;AACvF,OAAO,EAAmB,KAAK,WAAW,EAAE,MAAM,eAAe,CAAC;AAElE,6GAA6G;AAC7G,MAAM,WAAW,cAAc;IAC7B,0CAA0C;IAC1C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,2DAA2D;IAC3D,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,+DAA+D;IAC/D,OAAO,CAAC,EAAE,WAAW,GAAG,MAAM,CAAC;IAC/B,sFAAsF;IACtF,cAAc,CAAC,EAAE,WAAW,GAAG,MAAM,CAAC;IACtC,mDAA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AY,CAG/F;AAED,6GAA6G;AAC7G,MAAM,WAAW,eAAe;IAC9B,qDAAqD;IACrD,IAAI,EAAE,GAAG,EAAE,CAAC;IACZ,qCAAqC;IACrC,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,gDAAgD;IAChD,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,GAAG,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,cAAc,GAAG,eAAe,CA0BtG;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,cAAc,GAAG,MAAM,CAKvF;AAED;;;;;;GAMG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,cAAc,GAAG,MAAM,CAWjF"}
|
|
@@ -25,11 +25,13 @@ __export(context_exports, {
|
|
|
25
25
|
periodClose: () => periodClose,
|
|
26
26
|
periodTime: () => periodTime,
|
|
27
27
|
resampleSession: () => resampleSession,
|
|
28
|
+
sessionPeriods: () => sessionPeriods,
|
|
28
29
|
tradingDayTime: () => tradingDayTime
|
|
29
30
|
});
|
|
30
31
|
module.exports = __toCommonJS(context_exports);
|
|
31
32
|
var import_timeframe = require("../timeframe/index.js");
|
|
32
33
|
var import_resample = require("../security/resample.js");
|
|
34
|
+
var import_session = require("../time/session.js");
|
|
33
35
|
var import_bars = require("./bars.js");
|
|
34
36
|
var import_calendar = require("./calendar.js");
|
|
35
37
|
const toSpec = (s) => typeof s === "string" ? { session: s } : s;
|
|
@@ -51,13 +53,71 @@ function chartSessions(chart) {
|
|
|
51
53
|
cache.set(chart, out);
|
|
52
54
|
return out;
|
|
53
55
|
}
|
|
54
|
-
function
|
|
55
|
-
|
|
56
|
-
|
|
56
|
+
function calendarFor(bars, chart, session, timezone, dayPlacement) {
|
|
57
|
+
if (!session && !timezone) return { bars, test: false };
|
|
58
|
+
const tz = timezone ?? chart.timezone;
|
|
59
|
+
if (session !== void 0 && (0, import_session.parsePineSession)(session) === null) {
|
|
60
|
+
const name = session.trim();
|
|
61
|
+
const symbol = name === "regular" && chart.regularSession ? chart.regularSession : chart.session;
|
|
62
|
+
return { bars: new import_bars.SessionBars(new import_calendar.TradingCalendar(tz, { session: toSpec(symbol).session }, "symbol"), bars.chart.period), test: true };
|
|
63
|
+
}
|
|
64
|
+
const spec = session ? { session } : { session: toSpec(chart.session).session };
|
|
65
|
+
return {
|
|
66
|
+
bars: new import_bars.SessionBars(new import_calendar.TradingCalendar(tz, spec, session ? "pine" : "symbol", dayPlacement), bars.chart.period),
|
|
67
|
+
test: true,
|
|
68
|
+
// a PineScript session string: the rules of time.inSession (runs ending at 0000, days around a clock change)
|
|
69
|
+
inside: session ? (time) => (0, import_session.sessionRun)(time, session, tz, (0, import_timeframe.in_seconds)(bars.chart.period) * 1e3) !== null : void 0
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
function sessionPeriods(bars, chart, timeframe, session, timezone) {
|
|
73
|
+
const tf = (0, import_timeframe.info)(timeframe);
|
|
74
|
+
const { bars: calendar, test, inside } = calendarFor(bars, chart, session, timezone, !tf.isintraday);
|
|
75
|
+
const open = (t) => calendar.timeOf(t, timeframe);
|
|
76
|
+
const close = (t) => calendar.closeOf(t, timeframe);
|
|
77
|
+
if (!test) return { open, close };
|
|
78
|
+
if (tf.isintraday) {
|
|
79
|
+
if (session !== void 0 && (0, import_session.parsePineSession)(session) !== null && !calendar.chart.isdwm) {
|
|
80
|
+
const tz = timezone ?? chart.timezone;
|
|
81
|
+
const barMs = (0, import_timeframe.in_seconds)(calendar.chart.period) * 1e3;
|
|
82
|
+
const ms = (0, import_timeframe.in_seconds)(tf.period) * 1e3;
|
|
83
|
+
const run = (t) => (0, import_session.sessionRun)(t, session, tz, barMs);
|
|
84
|
+
const start = (t, r) => r[0] + Math.floor((t - r[0]) / ms) * ms;
|
|
85
|
+
return {
|
|
86
|
+
open: (t) => {
|
|
87
|
+
const r = run(t);
|
|
88
|
+
return r ? start(t, r) : NaN;
|
|
89
|
+
},
|
|
90
|
+
close: (t) => {
|
|
91
|
+
const r = run(t);
|
|
92
|
+
return r ? Math.min(start(t, r) + ms, r[1]) : NaN;
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
const isIn = (t) => inside ? inside(t) : calendar.inside(t);
|
|
97
|
+
return { open: (t) => isIn(t) ? open(t) : NaN, close: (t) => isIn(t) ? close(t) : NaN };
|
|
98
|
+
}
|
|
99
|
+
if (tf.isdaily && tf.multiplier === 1) {
|
|
100
|
+
return { open: (t) => calendar.inside(t) ? open(t) : NaN, close: (t) => calendar.inside(t) ? close(t) : NaN };
|
|
101
|
+
}
|
|
102
|
+
return { open, close };
|
|
57
103
|
}
|
|
58
|
-
|
|
104
|
+
const periodCache = /* @__PURE__ */ new WeakMap();
|
|
105
|
+
function periodsOfChart(chart, timeframe, session, timezone) {
|
|
59
106
|
const s = chartSessions(chart);
|
|
60
|
-
|
|
107
|
+
let byKey = periodCache.get(chart);
|
|
108
|
+
if (!byKey) periodCache.set(chart, byKey = /* @__PURE__ */ new Map());
|
|
109
|
+
const key = `${timeframe}|${session ?? ""}|${timezone ?? ""}`;
|
|
110
|
+
let p = byKey.get(key);
|
|
111
|
+
if (!p) byKey.set(key, p = sessionPeriods(s.bars, chart, timeframe, session, timezone));
|
|
112
|
+
return { s, p };
|
|
113
|
+
}
|
|
114
|
+
function periodTime(time, timeframe, chart, session, timezone) {
|
|
115
|
+
const { s, p } = periodsOfChart(chart, timeframe, session, timezone);
|
|
116
|
+
return p.open(time * s.unit);
|
|
117
|
+
}
|
|
118
|
+
function periodClose(time, timeframe, chart, session, timezone) {
|
|
119
|
+
const { s, p } = periodsOfChart(chart, timeframe, session, timezone);
|
|
120
|
+
return p.close(time * s.unit);
|
|
61
121
|
}
|
|
62
122
|
function tradingDayTime(time, chart) {
|
|
63
123
|
const s = chartSessions(chart);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/session/context.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * The session of a chart context, for code that does not run a whole script (a port with its own bar loop).\n *\n * The same values as the script API gives (`time(tf)`, `time_close(tf)`, `time_tradingday`, `session.*`, the periods\n * of `request.security`), from the session, corrections and holidays of the context. Bar times are in the unit of\n * the context (`timeUnit`, seconds by default, as `Bar.time`); PineScript time values are returned in ms.\n *\n * @module session/context\n */\n\nimport type { Bar } from '../types/index.js';\nimport { info, in_seconds } from '../timeframe/index.js';\nimport { afterCompletion, periodsOf, resample } from '../security/resample.js';\nimport { SessionBars, sessionFlags, strayPeriods, type SessionFlags } from './bars.js';\nimport { TradingCalendar, type SessionSpec } from './calendar.js';\n\n/** The part of a chart context that the session functions read (a `ChartContext` of the script API fits). */\nexport interface SessionContext {\n /** Chart timeframe: \"5\", \"60\", \"1D\"... */\n timeframe?: string;\n /** Exchange time zone: \"America/New_York\", \"Etc/UTC\"... */\n timezone?: string;\n /** Session of the loaded bars: hours, corrections, holidays */\n session?: SessionSpec | string;\n /** Regular trading hours when the bars include extended hours (default: `session`) */\n regularSession?: SessionSpec | string;\n /** Unit of the bar times: 's' (default) or 'ms' */\n timeUnit?: 's' | 'ms';\n}\n\n/** The session calendars of a context: the loaded bars and the regular hours. */\nexport interface ChartSessions {\n bars: SessionBars;\n regular: SessionBars;\n /** ms per unit of the bar times */\n unit: number;\n}\n\nconst toSpec = (s: SessionSpec | string): SessionSpec => (typeof s === 'string' ? { session: s } : s);\nconst cache = new WeakMap<object, ChartSessions>();\n\n/**\n * Session calendars of a chart context (cached per context object).\n * @throws Error when the context has no timeframe, time zone or session\n */\nexport function chartSessions(chart: SessionContext): ChartSessions {\n const cached = cache.get(chart);\n if (cached) return cached;\n const { timeframe, timezone, session } = chart;\n if (!timeframe || !timezone || !session) {\n throw new Error('The chart context needs timeframe, timezone and session for the session functions.');\n }\n const loaded = toSpec(session);\n const regular = chart.regularSession ? toSpec(chart.regularSession) : loaded;\n const out: ChartSessions = {\n bars: new SessionBars(new TradingCalendar(timezone, loaded), timeframe),\n regular: new SessionBars(new TradingCalendar(timezone, { holidays: loaded.holidays, ...regular }), timeframe),\n unit: chart.timeUnit === 'ms' ? 1 : 1000,\n };\n cache.set(chart, out);\n return out;\n}\n\n/** PineScript `time(timeframe)` (ms) of a bar that opens at `time`: the start of its period; NaN without one. */\nexport function periodTime(time: number, timeframe: string, chart: SessionContext): number {\n const s = chartSessions(chart);\n return s.bars.timeOf(time * s.unit, timeframe);\n}\n\n/** PineScript `time_close(timeframe)` (ms) of a bar that opens at `time`. */\nexport function periodClose(time: number, timeframe: string, chart: SessionContext): number {\n const s = chartSessions(chart);\n return s.bars.closeOf(time * s.unit, timeframe);\n}\n\n/** PineScript `time_tradingday` (ms, 00:00 UTC of the trading day) of a bar that opens at `time`. */\nexport function tradingDayTime(time: number, chart: SessionContext): number {\n const s = chartSessions(chart);\n return s.bars.tradingDayTime(time * s.unit);\n}\n\n/** PineScript `session.*` flags of bars that open at `times` (in order). */\nexport function chartSessionFlags(times: ArrayLike<number>, chart: SessionContext): SessionFlags {\n const s = chartSessions(chart);\n return sessionFlags(Array.from(times, (t) => t * s.unit), s.bars, s.regular);\n}\n\n/** Higher-timeframe bars of the chart bars and what `mapToChart` needs to bring values back to the chart. */\nexport interface SessionResample {\n /** Bars of `timeframe`, built from the chart bars */\n bars: Bar[];\n /** Period index of each chart bar */\n group: number[];\n /** Latest completed period at each chart bar */\n latest: number[];\n}\n\n/**\n * Same-symbol `request.security` on a timeframe equal to or higher than the chart's, with the session of the context:\n * D / W / M periods follow the regular hours, corrections and holidays; intraday periods the loaded session.\n * Compute on `bars`, then bring each value series back with `mapToChart(values, group, latest, lookahead, gaps)`.\n * @throws Error when `timeframe` is lower than the chart timeframe\n */\nexport function resampleSession(bars: Bar[], timeframe: string, chart: SessionContext): SessionResample {\n const s = chartSessions(chart);\n const chartTf = s.bars.chart;\n const tf = info(timeframe || chartTf.period);\n if (tf.period === chartTf.period) {\n const group = bars.map((_, i) => i);\n return { bars, group, latest: group };\n }\n if (in_seconds(tf.period) < in_seconds(chartTf.period)) {\n throw new Error(`resampleSession: timeframe \"${tf.period}\" is lower than the chart timeframe \"${chartTf.period}\".`);\n }\n const times = bars.map((b) => (b.time as number) * s.unit);\n const calendar = tf.isdwm ? s.regular : s.bars;\n const starts = times.map((t) => calendar.timeOf(t, tf.period));\n const dayPeriods = times.map((t, i) => {\n const at = s.bars.calendar.locate(t);\n const periods = at ? calendar.calendar.periods(at.date) : [];\n return periods.length ? calendar.timeOf(periods[0]![0], tf.period) : starts[i]!;\n });\n strayPeriods(starts, dayPeriods, times, s.bars, tf.isdwm ? null : in_seconds(tf.period) * 1000);\n const reaches = times.map((t) => s.bars.closeOf(t, chartTf.period) >= calendar.periodEnd(t, tf.period));\n const { group, latest } = periodsOf(starts, dayPeriods, reaches);\n // a higher-timeframe bar ends at the bar that completes it (no value from after the completion)\n const after = afterCompletion(group, latest);\n const kept = (_: unknown, i: number): boolean => !after[i];\n return { bars: resample(bars.filter(kept), starts.map((x) => x / s.unit).filter(kept)).bars, group, latest };\n}\n\n/**\n * Open time of the `count`-th bar after the bar that opens at `time`, on the trading calendar of the context: the\n * closed hours, weekends, holidays and days off are skipped. `count` 0 is the bar itself. For a drawing that ends\n * `count` bars after the last bar (PineScript `bar_index + count`).\n */\nexport function barTimeAfter(time: number, count: number, chart: SessionContext): number {\n const s = chartSessions(chart);\n let t = time * s.unit;\n for (let k = 0; k < count && !Number.isNaN(t); k++) t = s.bars.nextBarTime(t);\n return t / s.unit;\n}\n\n/**\n * Number of bars from the bar that opens at `from` to the bar that contains `to`, on the trading calendar of the\n * context (0 when `to` is in the bar of `from` or before it). For a drawing placed at a time after the last bar\n * (PineScript `time + n days` with `xloc.bar_time`): the chart shows it on the bar of that time, weekends and\n * holidays skipped. `to` is first rounded to the nearest second, a half second going up (#174: 15 ms before a bar\n * opens is on that bar, 501 ms before is on the bar before). NaN when no bar is found within 100,000 bars.\n */\nexport function barsUntil(from: number, to: number, chart: SessionContext): number {\n const s = chartSessions(chart);\n const target = Math.floor((to * s.unit) / 1000 + 0.5) * 1000;\n let t = from * s.unit;\n for (let k = 0; k < 100_000; k++) {\n const next = s.bars.nextBarTime(t);\n if (Number.isNaN(next)) return NaN;\n if (next > target) return k;\n t = next;\n }\n return NaN;\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAWA,uBAAiC;AACjC,sBAAqD;AACrD,kBAA2E;AAC3E,sBAAkD;AAwBlD,MAAM,SAAS,CAAC,MAA0C,OAAO,MAAM,WAAW,EAAE,SAAS,EAAE,IAAI;AACnG,MAAM,QAAQ,oBAAI,QAA+B;AAM1C,SAAS,cAAc,OAAsC;AAClE,QAAM,SAAS,MAAM,IAAI,KAAK;AAC9B,MAAI,OAAQ,QAAO;AACnB,QAAM,EAAE,WAAW,UAAU,QAAQ,IAAI;AACzC,MAAI,CAAC,aAAa,CAAC,YAAY,CAAC,SAAS;AACvC,UAAM,IAAI,MAAM,oFAAoF;AAAA,EACtG;AACA,QAAM,SAAS,OAAO,OAAO;AAC7B,QAAM,UAAU,MAAM,iBAAiB,OAAO,MAAM,cAAc,IAAI;AACtE,QAAM,MAAqB;AAAA,IACzB,MAAM,IAAI,wBAAY,IAAI,gCAAgB,UAAU,MAAM,GAAG,SAAS;AAAA,IACtE,SAAS,IAAI,wBAAY,IAAI,gCAAgB,UAAU,EAAE,UAAU,OAAO,UAAU,GAAG,QAAQ,CAAC,GAAG,SAAS;AAAA,IAC5G,MAAM,MAAM,aAAa,OAAO,IAAI;AAAA,EACtC;AACA,QAAM,IAAI,OAAO,GAAG;AACpB,SAAO;AACT;
|
|
4
|
+
"sourcesContent": ["/**\n * The session of a chart context, for code that does not run a whole script (a port with its own bar loop).\n *\n * The same values as the script API gives (`time(tf)`, `time_close(tf)`, `time_tradingday`, `session.*`, the periods\n * of `request.security`), from the session, corrections and holidays of the context. Bar times are in the unit of\n * the context (`timeUnit`, seconds by default, as `Bar.time`); PineScript time values are returned in ms.\n *\n * @module session/context\n */\n\nimport type { Bar } from '../types/index.js';\nimport { info, in_seconds } from '../timeframe/index.js';\nimport { afterCompletion, periodsOf, resample } from '../security/resample.js';\nimport { parsePineSession, sessionRun } from '../time/session.js';\nimport { SessionBars, sessionFlags, strayPeriods, type SessionFlags } from './bars.js';\nimport { TradingCalendar, type SessionSpec } from './calendar.js';\n\n/** The part of a chart context that the session functions read (a `ChartContext` of the script API fits). */\nexport interface SessionContext {\n /** Chart timeframe: \"5\", \"60\", \"1D\"... */\n timeframe?: string;\n /** Exchange time zone: \"America/New_York\", \"Etc/UTC\"... */\n timezone?: string;\n /** Session of the loaded bars: hours, corrections, holidays */\n session?: SessionSpec | string;\n /** Regular trading hours when the bars include extended hours (default: `session`) */\n regularSession?: SessionSpec | string;\n /** Unit of the bar times: 's' (default) or 'ms' */\n timeUnit?: 's' | 'ms';\n}\n\n/** The session calendars of a context: the loaded bars and the regular hours. */\nexport interface ChartSessions {\n bars: SessionBars;\n regular: SessionBars;\n /** ms per unit of the bar times */\n unit: number;\n}\n\nconst toSpec = (s: SessionSpec | string): SessionSpec => (typeof s === 'string' ? { session: s } : s);\nconst cache = new WeakMap<object, ChartSessions>();\n\n/**\n * Session calendars of a chart context (cached per context object).\n * @throws Error when the context has no timeframe, time zone or session\n */\nexport function chartSessions(chart: SessionContext): ChartSessions {\n const cached = cache.get(chart);\n if (cached) return cached;\n const { timeframe, timezone, session } = chart;\n if (!timeframe || !timezone || !session) {\n throw new Error('The chart context needs timeframe, timezone and session for the session functions.');\n }\n const loaded = toSpec(session);\n const regular = chart.regularSession ? toSpec(chart.regularSession) : loaded;\n const out: ChartSessions = {\n bars: new SessionBars(new TradingCalendar(timezone, loaded), timeframe),\n regular: new SessionBars(new TradingCalendar(timezone, { holidays: loaded.holidays, ...regular }), timeframe),\n unit: chart.timeUnit === 'ms' ? 1 : 1000,\n };\n cache.set(chart, out);\n return out;\n}\n\n/** Open and close (ms) of the period that contains a bar opening at a time in ms; NaN outside the session. */\nexport interface SessionPeriods {\n open: (time: number) => number;\n close: (time: number) => number;\n}\n\n/**\n * Calendar for the `session` / `timezone` arguments of `time(tf, session, timezone)`. Without both: the loaded\n * session. As in PineScript, an explicit time zone reads the symbol session hours in that zone without corrections\n * and holidays, and an explicit session follows PineScript's session string rules.\n */\nfunction calendarFor(\n bars: SessionBars,\n chart: SessionContext,\n session: string | undefined,\n timezone: string | undefined,\n dayPlacement: boolean\n): { bars: SessionBars; test: boolean; inside?: (time: number) => boolean } {\n if (!session && !timezone) return { bars, test: false };\n const tz = timezone ?? chart.timezone!;\n // a session string that is empty or does not start with a digit is the symbol session: \"regular\" the regular\n // hours, \"extended\" and any other name the loaded hours (PineScript)\n if (session !== undefined && parsePineSession(session) === null) {\n const name = session.trim();\n const symbol = name === 'regular' && chart.regularSession ? chart.regularSession : chart.session!;\n return { bars: new SessionBars(new TradingCalendar(tz, { session: toSpec(symbol).session }, 'symbol'), bars.chart.period), test: true };\n }\n const spec = session ? { session } : { session: toSpec(chart.session!).session };\n return {\n bars: new SessionBars(new TradingCalendar(tz, spec, session ? 'pine' : 'symbol', dayPlacement), bars.chart.period),\n test: true,\n // a PineScript session string: the rules of time.inSession (runs ending at 0000, days around a clock change)\n inside: session ? (time) => sessionRun(time, session, tz, in_seconds(bars.chart.period) * 1000) !== null : undefined,\n };\n}\n\n/**\n * `time(tf, session, timezone)` / `time_close(tf, session, timezone)` of a bar, as PineScript computes them (#173):\n * an intraday timeframe tests the bar with the session rules of time.inSession and aligns its periods on the start\n * of the run that contains the bar; \"D\" tests the bar against the day's session period (the calendar; the time\n * between two runs of a day is inside it, #182); a timeframe of more than one day (\"2D\", \"W\", \"M\") has no test and\n * keeps the period's time. `bars` is the calendar of the loaded session (`chartSessions(chart).bars`).\n */\nexport function sessionPeriods(\n bars: SessionBars,\n chart: SessionContext,\n timeframe: string,\n session?: string,\n timezone?: string\n): SessionPeriods {\n const tf = info(timeframe);\n const { bars: calendar, test, inside } = calendarFor(bars, chart, session, timezone, !tf.isintraday);\n const open = (t: number): number => calendar.timeOf(t, timeframe);\n const close = (t: number): number => calendar.closeOf(t, timeframe);\n if (!test) return { open, close };\n if (tf.isintraday) {\n if (session !== undefined && parsePineSession(session) !== null && !calendar.chart.isdwm) {\n const tz = timezone ?? chart.timezone!;\n const barMs = in_seconds(calendar.chart.period) * 1000;\n const ms = in_seconds(tf.period) * 1000;\n const run = (t: number) => sessionRun(t, session, tz, barMs);\n const start = (t: number, r: [number, number]) => r[0] + Math.floor((t - r[0]) / ms) * ms;\n return {\n open: (t) => { const r = run(t); return r ? start(t, r) : NaN; },\n close: (t) => { const r = run(t); return r ? Math.min(start(t, r) + ms, r[1]) : NaN; },\n };\n }\n const isIn = (t: number) => (inside ? inside(t) : calendar.inside(t));\n return { open: (t) => (isIn(t) ? open(t) : NaN), close: (t) => (isIn(t) ? close(t) : NaN) };\n }\n if (tf.isdaily && tf.multiplier === 1) {\n return { open: (t) => (calendar.inside(t) ? open(t) : NaN), close: (t) => (calendar.inside(t) ? close(t) : NaN) };\n }\n return { open, close };\n}\n\nconst periodCache = new WeakMap<object, Map<string, SessionPeriods>>();\n\nfunction periodsOfChart(chart: SessionContext, timeframe: string, session?: string, timezone?: string): { s: ChartSessions; p: SessionPeriods } {\n const s = chartSessions(chart);\n let byKey = periodCache.get(chart);\n if (!byKey) periodCache.set(chart, (byKey = new Map()));\n const key = `${timeframe}|${session ?? ''}|${timezone ?? ''}`;\n let p = byKey.get(key);\n if (!p) byKey.set(key, (p = sessionPeriods(s.bars, chart, timeframe, session, timezone)));\n return { s, p };\n}\n\n/**\n * PineScript `time(timeframe, session, timezone)` (ms) of a bar that opens at `time`: the start of its period; NaN\n * without one or outside `session` (#182). Without `session` and `timezone`, the periods of the loaded session.\n */\nexport function periodTime(time: number, timeframe: string, chart: SessionContext, session?: string, timezone?: string): number {\n const { s, p } = periodsOfChart(chart, timeframe, session, timezone);\n return p.open(time * s.unit);\n}\n\n/** PineScript `time_close(timeframe, session, timezone)` (ms) of a bar that opens at `time` (#182). */\nexport function periodClose(time: number, timeframe: string, chart: SessionContext, session?: string, timezone?: string): number {\n const { s, p } = periodsOfChart(chart, timeframe, session, timezone);\n return p.close(time * s.unit);\n}\n\n/** PineScript `time_tradingday` (ms, 00:00 UTC of the trading day) of a bar that opens at `time`. */\nexport function tradingDayTime(time: number, chart: SessionContext): number {\n const s = chartSessions(chart);\n return s.bars.tradingDayTime(time * s.unit);\n}\n\n/** PineScript `session.*` flags of bars that open at `times` (in order). */\nexport function chartSessionFlags(times: ArrayLike<number>, chart: SessionContext): SessionFlags {\n const s = chartSessions(chart);\n return sessionFlags(Array.from(times, (t) => t * s.unit), s.bars, s.regular);\n}\n\n/** Higher-timeframe bars of the chart bars and what `mapToChart` needs to bring values back to the chart. */\nexport interface SessionResample {\n /** Bars of `timeframe`, built from the chart bars */\n bars: Bar[];\n /** Period index of each chart bar */\n group: number[];\n /** Latest completed period at each chart bar */\n latest: number[];\n}\n\n/**\n * Same-symbol `request.security` on a timeframe equal to or higher than the chart's, with the session of the context:\n * D / W / M periods follow the regular hours, corrections and holidays; intraday periods the loaded session.\n * Compute on `bars`, then bring each value series back with `mapToChart(values, group, latest, lookahead, gaps)`.\n * @throws Error when `timeframe` is lower than the chart timeframe\n */\nexport function resampleSession(bars: Bar[], timeframe: string, chart: SessionContext): SessionResample {\n const s = chartSessions(chart);\n const chartTf = s.bars.chart;\n const tf = info(timeframe || chartTf.period);\n if (tf.period === chartTf.period) {\n const group = bars.map((_, i) => i);\n return { bars, group, latest: group };\n }\n if (in_seconds(tf.period) < in_seconds(chartTf.period)) {\n throw new Error(`resampleSession: timeframe \"${tf.period}\" is lower than the chart timeframe \"${chartTf.period}\".`);\n }\n const times = bars.map((b) => (b.time as number) * s.unit);\n const calendar = tf.isdwm ? s.regular : s.bars;\n const starts = times.map((t) => calendar.timeOf(t, tf.period));\n const dayPeriods = times.map((t, i) => {\n const at = s.bars.calendar.locate(t);\n const periods = at ? calendar.calendar.periods(at.date) : [];\n return periods.length ? calendar.timeOf(periods[0]![0], tf.period) : starts[i]!;\n });\n strayPeriods(starts, dayPeriods, times, s.bars, tf.isdwm ? null : in_seconds(tf.period) * 1000);\n const reaches = times.map((t) => s.bars.closeOf(t, chartTf.period) >= calendar.periodEnd(t, tf.period));\n const { group, latest } = periodsOf(starts, dayPeriods, reaches);\n // a higher-timeframe bar ends at the bar that completes it (no value from after the completion)\n const after = afterCompletion(group, latest);\n const kept = (_: unknown, i: number): boolean => !after[i];\n return { bars: resample(bars.filter(kept), starts.map((x) => x / s.unit).filter(kept)).bars, group, latest };\n}\n\n/**\n * Open time of the `count`-th bar after the bar that opens at `time`, on the trading calendar of the context: the\n * closed hours, weekends, holidays and days off are skipped. `count` 0 is the bar itself. For a drawing that ends\n * `count` bars after the last bar (PineScript `bar_index + count`).\n */\nexport function barTimeAfter(time: number, count: number, chart: SessionContext): number {\n const s = chartSessions(chart);\n let t = time * s.unit;\n for (let k = 0; k < count && !Number.isNaN(t); k++) t = s.bars.nextBarTime(t);\n return t / s.unit;\n}\n\n/**\n * Number of bars from the bar that opens at `from` to the bar that contains `to`, on the trading calendar of the\n * context (0 when `to` is in the bar of `from` or before it). For a drawing placed at a time after the last bar\n * (PineScript `time + n days` with `xloc.bar_time`): the chart shows it on the bar of that time, weekends and\n * holidays skipped. `to` is first rounded to the nearest second, a half second going up (#174: 15 ms before a bar\n * opens is on that bar, 501 ms before is on the bar before). NaN when no bar is found within 100,000 bars.\n */\nexport function barsUntil(from: number, to: number, chart: SessionContext): number {\n const s = chartSessions(chart);\n const target = Math.floor((to * s.unit) / 1000 + 0.5) * 1000;\n let t = from * s.unit;\n for (let k = 0; k < 100_000; k++) {\n const next = s.bars.nextBarTime(t);\n if (Number.isNaN(next)) return NaN;\n if (next > target) return k;\n t = next;\n }\n return NaN;\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAWA,uBAAiC;AACjC,sBAAqD;AACrD,qBAA6C;AAC7C,kBAA2E;AAC3E,sBAAkD;AAwBlD,MAAM,SAAS,CAAC,MAA0C,OAAO,MAAM,WAAW,EAAE,SAAS,EAAE,IAAI;AACnG,MAAM,QAAQ,oBAAI,QAA+B;AAM1C,SAAS,cAAc,OAAsC;AAClE,QAAM,SAAS,MAAM,IAAI,KAAK;AAC9B,MAAI,OAAQ,QAAO;AACnB,QAAM,EAAE,WAAW,UAAU,QAAQ,IAAI;AACzC,MAAI,CAAC,aAAa,CAAC,YAAY,CAAC,SAAS;AACvC,UAAM,IAAI,MAAM,oFAAoF;AAAA,EACtG;AACA,QAAM,SAAS,OAAO,OAAO;AAC7B,QAAM,UAAU,MAAM,iBAAiB,OAAO,MAAM,cAAc,IAAI;AACtE,QAAM,MAAqB;AAAA,IACzB,MAAM,IAAI,wBAAY,IAAI,gCAAgB,UAAU,MAAM,GAAG,SAAS;AAAA,IACtE,SAAS,IAAI,wBAAY,IAAI,gCAAgB,UAAU,EAAE,UAAU,OAAO,UAAU,GAAG,QAAQ,CAAC,GAAG,SAAS;AAAA,IAC5G,MAAM,MAAM,aAAa,OAAO,IAAI;AAAA,EACtC;AACA,QAAM,IAAI,OAAO,GAAG;AACpB,SAAO;AACT;AAaA,SAAS,YACP,MACA,OACA,SACA,UACA,cAC0E;AAC1E,MAAI,CAAC,WAAW,CAAC,SAAU,QAAO,EAAE,MAAM,MAAM,MAAM;AACtD,QAAM,KAAK,YAAY,MAAM;AAG7B,MAAI,YAAY,cAAa,iCAAiB,OAAO,MAAM,MAAM;AAC/D,UAA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QAAM,IAAI,cAAc,KAAK;AAC7B,QAAM,SAAS,KAAK,MAAO,KAAK,EAAE,OAAQ,MAAO,GAAG,IAAI;AACxD,MAAI,IAAI,OAAO,EAAE;AACjB,WAAS,IAAI,GAAG,IAAI,KAAS,KAAK;AAChC,UAAM,OAAO,EAAE,KAAK,YAAY,CAAC;AACjC,QAAI,OAAO,MAAM,IAAI,EAAG,QAAO;AAC/B,QAAI,OAAO,OAAQ,QAAO;AAC1B,QAAI;AAAA,EACN;AACA,SAAO;AACT;",
|
|
6
6
|
"names": ["group"]
|
|
7
7
|
}
|
package/dist/cjs/ta/index.d.ts
CHANGED
|
@@ -82,7 +82,8 @@ export declare function rsi(source: Source, length: simple_int): series_float;
|
|
|
82
82
|
/**
|
|
83
83
|
* PineScript v4 `rsi(x, y)` with two series (#180): `x` and `y` are the averages of the upward and downward changes,
|
|
84
84
|
* already computed. As in PineScript: 100 when `y` is within 1e-10 of zero (also with an na `x`), else 0 when `x` is,
|
|
85
|
-
* else `100 - 100 / (1 + x / y)
|
|
85
|
+
* else `100 - 100 / (1 + x / y)`: -Infinity when `x == -y` (#182), which `na()` and `nz()` treat as na while comparisons
|
|
86
|
+
* see it (`r < 30` is true). Versions 5 and 6 have the length form only.
|
|
86
87
|
*/
|
|
87
88
|
export declare function rsi(x: Source, y: Source): series_float;
|
|
88
89
|
/**
|
|
@@ -352,9 +353,9 @@ export declare function wma(source: Source, length: simple_int | ArrayLike<numbe
|
|
|
352
353
|
* @returns Highest value series (na on the first `length - 1` bars)
|
|
353
354
|
*
|
|
354
355
|
* @remarks
|
|
355
|
-
* As in PineScript: `na` values are skipped. The result is the highest of the last `length`
|
|
356
|
-
* of them when there are fewer), also on a bar whose own value is `na`; `na` before bar
|
|
357
|
-
* value was received. A fractional length is truncated (7.5 is 7 bars).
|
|
356
|
+
* As in PineScript: `na` values (also +/-Infinity, #183) are skipped. The result is the highest of the last `length`
|
|
357
|
+
* non-na values (of all of them when there are fewer), also on a bar whose own value is `na`; `na` before bar
|
|
358
|
+
* `length - 1` and while no value was received. A fractional length is truncated (7.5 is 7 bars).
|
|
358
359
|
* `length` can be an array (a length per bar, PineScript series length), also for `ta.lowest`, `ta.highestbars`
|
|
359
360
|
* and `ta.lowestbars`: each bar uses its own length.
|
|
360
361
|
* A length above 15,000 throws the PineScript runtime error (also `ta.lowest`, `ta.highestbars`, `ta.lowestbars`).
|
|
@@ -369,9 +370,9 @@ export declare function highest(source: Source, length: simple_int | ArrayLike<n
|
|
|
369
370
|
* @returns Lowest value series (na on the first `length - 1` bars)
|
|
370
371
|
*
|
|
371
372
|
* @remarks
|
|
372
|
-
* As in PineScript: `na` values are skipped. The result is the lowest of the last `length`
|
|
373
|
-
* of them when there are fewer), also on a bar whose own value is `na`; `na` before bar
|
|
374
|
-
* value was received.
|
|
373
|
+
* As in PineScript: `na` values (also +/-Infinity, #183) are skipped. The result is the lowest of the last `length`
|
|
374
|
+
* non-na values (of all of them when there are fewer), also on a bar whose own value is `na`; `na` before bar
|
|
375
|
+
* `length - 1` and while no value was received.
|
|
375
376
|
*/
|
|
376
377
|
export declare function lowest(source: Source, length: simple_int | ArrayLike<number>): series_float;
|
|
377
378
|
/**
|
|
@@ -427,8 +428,8 @@ export declare function cross(source1: Source, source2: Source): series_bool;
|
|
|
427
428
|
* PineScript rules:
|
|
428
429
|
* - a counter of rises from the previous bar (a rise is larger than the 1e-10 tolerance); a step that is not a rise
|
|
429
430
|
* resets it to 0
|
|
430
|
-
* - a step from or to an `na` bar leaves the counter unchanged (so an `na` bar, and the bar after
|
|
431
|
-
* result of the bar before the `na`)
|
|
431
|
+
* - a step from or to an `na` (or +/-Infinity) bar leaves the counter unchanged (so an `na` bar, and the bar after
|
|
432
|
+
* it, keep the result of the bar before the `na`)
|
|
432
433
|
* - true when the counter is at least `length` (false at the start)
|
|
433
434
|
*
|
|
434
435
|
* @example
|
|
@@ -449,8 +450,8 @@ export declare function rising(source: Source, length: simple_int): series_bool;
|
|
|
449
450
|
* PineScript rules:
|
|
450
451
|
* - a counter of falls from the previous bar (a fall is larger than the 1e-10 tolerance); a step that is not a fall
|
|
451
452
|
* resets it to 0
|
|
452
|
-
* - a step from or to an `na` bar leaves the counter unchanged (so an `na` bar, and the bar after
|
|
453
|
-
* result of the bar before the `na`)
|
|
453
|
+
* - a step from or to an `na` (or +/-Infinity) bar leaves the counter unchanged (so an `na` bar, and the bar after
|
|
454
|
+
* it, keep the result of the bar before the `na`)
|
|
454
455
|
* - true when the counter is at least `length` (false at the start)
|
|
455
456
|
*
|
|
456
457
|
* @example
|
|
@@ -562,7 +563,7 @@ export declare function variance(source: Source, length: simple_int | ArrayLike<
|
|
|
562
563
|
* @remarks
|
|
563
564
|
* - Returns the middle value when values are sorted
|
|
564
565
|
* - For an even length, returns the average of the two middle values
|
|
565
|
-
* - As in PineScript: `na` values are skipped, the window holds the last `length` non-na values
|
|
566
|
+
* - As in PineScript: `na` values (also +/-Infinity) are skipped, the window holds the last `length` non-na values
|
|
566
567
|
* (going back as many bars as needed), and a bar whose own value is `na` still gets a result
|
|
567
568
|
* - Returns NaN until `length` non-na values exist
|
|
568
569
|
* - More robust to outliers than mean (SMA)
|
|
@@ -743,8 +744,9 @@ export declare function cci(source: Source, length: simple_int): series_float;
|
|
|
743
744
|
* - Measures where close is relative to the high-low range
|
|
744
745
|
* - Values above 80 typically indicate overbought
|
|
745
746
|
* - Values below 20 typically indicate oversold
|
|
746
|
-
* - As PineScript: when the source, \`highest(high, length)\` or \`lowest(low, length)\` is \`na\`, or the range
|
|
747
|
-
* result is the previous result of the call (\`na\` until a first value)
|
|
747
|
+
* - As PineScript: when the source, \`highest(high, length)\` or \`lowest(low, length)\` is \`na\`, or the range and
|
|
748
|
+
* \`source - lowest\` are both 0, the result is the previous result of the call (\`na\` until a first value); a zero
|
|
749
|
+
* range with another source value gives +/-Infinity (plotted as \`na\`)
|
|
748
750
|
*
|
|
749
751
|
* @example
|
|
750
752
|
* \`\`\`typescript
|
|
@@ -848,8 +850,8 @@ type PivotLength = simple_int | ArrayLike<number>;
|
|
|
848
850
|
* - As in PineScript, the value appears `rightbars` bars after the pivot bar: the pivot bar
|
|
849
851
|
* index is `i - rightbars`
|
|
850
852
|
* - A pivot high may equal values on its left but must be higher than all values on its right
|
|
851
|
-
* - `na` values are skipped: the window is the last `leftbars + rightbars + 1` non-na values,
|
|
852
|
-
* them must be on the bar `rightbars` bars back
|
|
853
|
+
* - `na` values (also +/-Infinity) are skipped: the window is the last `leftbars + rightbars + 1` non-na values,
|
|
854
|
+
* and the highest of them must be on the bar `rightbars` bars back
|
|
853
855
|
* - `leftbars` / `rightbars` can be arrays (a length per bar, PineScript series length), also for `ta.pivotlow`:
|
|
854
856
|
* each bar uses its own lengths
|
|
855
857
|
*
|
|
@@ -874,8 +876,8 @@ export declare function pivothigh(sourceOrLeftbars: Source | simple_int, leftbar
|
|
|
874
876
|
* - As in PineScript, the value appears `rightbars` bars after the pivot bar: the pivot bar
|
|
875
877
|
* index is `i - rightbars`
|
|
876
878
|
* - A pivot low may equal values on its left but must be lower than all values on its right
|
|
877
|
-
* - `na` values are skipped: the window is the last `leftbars + rightbars + 1` non-na values,
|
|
878
|
-
* them must be on the bar `rightbars` bars back
|
|
879
|
+
* - `na` values (also +/-Infinity) are skipped: the window is the last `leftbars + rightbars + 1` non-na values,
|
|
880
|
+
* and the lowest of them must be on the bar `rightbars` bars back
|
|
879
881
|
*
|
|
880
882
|
* @example
|
|
881
883
|
* ```typescript
|
|
@@ -1139,7 +1141,7 @@ export declare function kcw(source: Source, length?: simple_int, mult?: simple_f
|
|
|
1139
1141
|
* (PineScript `ta.range(source, length)`).
|
|
1140
1142
|
*
|
|
1141
1143
|
* @remarks
|
|
1142
|
-
* As in PineScript: `na` values are skipped (the window holds the last `length` non-na
|
|
1144
|
+
* As in PineScript: `na` values (also +/-Infinity) are skipped (the window holds the last `length` non-na
|
|
1143
1145
|
* values), and a bar whose own value is `na` still gets a result.
|
|
1144
1146
|
*/
|
|
1145
1147
|
export declare function range(source: Source, length: simple_int): series_float;
|
|
@@ -1148,9 +1150,9 @@ export declare function range(source: Source, length: simple_int): series_float;
|
|
|
1148
1150
|
* -1 for the previous bar, and so on (as in PineScript, the offset is negative).
|
|
1149
1151
|
*
|
|
1150
1152
|
* @remarks
|
|
1151
|
-
* As in PineScript: the best of the last `length` non-na values, the newest one on equal
|
|
1152
|
-
* distance in bars to its bar, so it is below `-(length - 1)` when `na` values were
|
|
1153
|
-
* `length - 1` and while no value was received; a fractional length is truncated.
|
|
1153
|
+
* As in PineScript: the best of the last `length` non-na values (+/-Infinity skipped), the newest one on equal
|
|
1154
|
+
* values; the offset is the distance in bars to its bar, so it is below `-(length - 1)` when `na` values were
|
|
1155
|
+
* skipped. `na` before bar `length - 1` and while no value was received; a fractional length is truncated.
|
|
1154
1156
|
*/
|
|
1155
1157
|
export declare function highestbars(source: Source, length: simple_int | ArrayLike<number>): series_int;
|
|
1156
1158
|
/**
|
|
@@ -1158,16 +1160,16 @@ export declare function highestbars(source: Source, length: simple_int | ArrayLi
|
|
|
1158
1160
|
* -1 for the previous bar, and so on (as in PineScript, the offset is negative).
|
|
1159
1161
|
*
|
|
1160
1162
|
* @remarks
|
|
1161
|
-
* As in PineScript: the best of the last `length` non-na values, the newest one on equal
|
|
1162
|
-
* distance in bars to its bar, so it is below `-(length - 1)` when `na` values were
|
|
1163
|
-
* `length - 1` and while no value was received; a fractional length is truncated.
|
|
1163
|
+
* As in PineScript: the best of the last `length` non-na values (+/-Infinity skipped), the newest one on equal
|
|
1164
|
+
* values; the offset is the distance in bars to its bar, so it is below `-(length - 1)` when `na` values were
|
|
1165
|
+
* skipped. `na` before bar `length - 1` and while no value was received; a fractional length is truncated.
|
|
1164
1166
|
*/
|
|
1165
1167
|
export declare function lowestbars(source: Source, length: simple_int | ArrayLike<number>): series_int;
|
|
1166
1168
|
/**
|
|
1167
1169
|
* All-time highest value of `source` up to each bar (PineScript `ta.max(source)`).
|
|
1168
1170
|
*
|
|
1169
1171
|
* @remarks
|
|
1170
|
-
* As in PineScript: `na` values are skipped, the value carries over `na` bars, and the
|
|
1172
|
+
* As in PineScript: `na` values (also +/-Infinity) are skipped, the value carries over `na` bars, and the
|
|
1171
1173
|
* result is `na` until the first non-na value.
|
|
1172
1174
|
*/
|
|
1173
1175
|
export declare function max(source: Source): series_float;
|
|
@@ -1175,7 +1177,7 @@ export declare function max(source: Source): series_float;
|
|
|
1175
1177
|
* All-time lowest value of `source` up to each bar (PineScript `ta.min(source)`).
|
|
1176
1178
|
*
|
|
1177
1179
|
* @remarks
|
|
1178
|
-
* As in PineScript: `na` values are skipped, the value carries over `na` bars, and the
|
|
1180
|
+
* As in PineScript: `na` values (also +/-Infinity) are skipped, the value carries over `na` bars, and the
|
|
1179
1181
|
* result is `na` until the first non-na value.
|
|
1180
1182
|
*/
|
|
1181
1183
|
export declare function min(source: Source): series_float;
|
|
@@ -1220,8 +1222,8 @@ export declare function cog(source: Source, length?: simple_int): series_float;
|
|
|
1220
1222
|
*
|
|
1221
1223
|
* @remarks
|
|
1222
1224
|
* PineScript rules:
|
|
1223
|
-
* - the window is the last `length` non-`na` values (an `na` bar does not enter it, and gets the mode
|
|
1224
|
-
* window it keeps)
|
|
1225
|
+
* - the window is the last `length` non-`na` values (an `na` or +/-Infinity bar does not enter it, and gets the mode
|
|
1226
|
+
* of the window it keeps)
|
|
1225
1227
|
* - NaN until `length` non-`na` values exist
|
|
1226
1228
|
* - If no mode exists, returns the smallest value
|
|
1227
1229
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ta/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,UAAU,EAAO,MAAM,EAAE,UAAU,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAKnI;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,GAAG,C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