oakscriptjs 0.8.2 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +31 -9
- package/dist/cjs/array/index.d.ts +701 -0
- package/dist/cjs/array/index.d.ts.map +1 -0
- package/dist/cjs/array/index.js +392 -0
- package/dist/cjs/array/index.js.map +7 -0
- package/dist/cjs/box/index.d.ts +444 -0
- package/dist/cjs/box/index.d.ts.map +1 -0
- package/dist/cjs/box/index.js +246 -0
- package/dist/cjs/box/index.js.map +7 -0
- package/dist/cjs/callsite/index.d.ts +61 -0
- package/dist/cjs/callsite/index.d.ts.map +1 -0
- package/dist/cjs/callsite/index.js +65 -0
- package/dist/cjs/callsite/index.js.map +7 -0
- package/dist/cjs/chartpoint/index.d.ts +90 -0
- package/dist/cjs/chartpoint/index.d.ts.map +1 -0
- package/dist/cjs/chartpoint/index.js +56 -0
- package/dist/cjs/chartpoint/index.js.map +7 -0
- package/dist/cjs/color/index.d.ts +285 -0
- package/dist/cjs/color/index.d.ts.map +1 -0
- package/dist/cjs/color/index.js +143 -0
- package/dist/cjs/color/index.js.map +7 -0
- package/dist/cjs/compare/index.d.ts +26 -0
- package/dist/cjs/compare/index.d.ts.map +1 -0
- package/dist/cjs/compare/index.js +50 -0
- package/dist/cjs/compare/index.js.map +7 -0
- package/dist/cjs/drawing/registry.d.ts +42 -0
- package/dist/cjs/drawing/registry.d.ts.map +1 -0
- package/dist/cjs/drawing/registry.js +87 -0
- package/dist/cjs/drawing/registry.js.map +7 -0
- package/dist/cjs/index.d.ts +85 -0
- package/dist/cjs/index.d.ts.map +1 -0
- package/dist/cjs/index.js +184 -0
- package/dist/cjs/index.js.map +7 -0
- package/dist/cjs/indicator.d.ts +117 -0
- package/dist/cjs/indicator.d.ts.map +1 -0
- package/dist/cjs/indicator.js +74 -0
- package/dist/cjs/indicator.js.map +7 -0
- package/dist/cjs/input.d.ts +196 -0
- package/dist/cjs/input.d.ts.map +1 -0
- package/dist/cjs/input.js +197 -0
- package/dist/cjs/input.js.map +7 -0
- package/dist/cjs/label/index.d.ts +303 -0
- package/dist/cjs/label/index.d.ts.map +1 -0
- package/dist/cjs/label/index.js +190 -0
- package/dist/cjs/label/index.js.map +7 -0
- package/dist/cjs/lib/index.d.ts +8 -0
- package/dist/cjs/lib/index.d.ts.map +1 -0
- package/dist/cjs/lib/index.js +19 -0
- package/dist/cjs/lib/index.js.map +7 -0
- package/dist/{lib → cjs/lib}/zigzag/index.d.ts +4 -1
- package/dist/cjs/lib/zigzag/index.d.ts.map +1 -0
- package/dist/cjs/lib/zigzag/index.js +27 -0
- package/dist/cjs/lib/zigzag/index.js.map +7 -0
- package/dist/cjs/lib/zigzag/zigzag.d.ts +100 -0
- package/dist/cjs/lib/zigzag/zigzag.d.ts.map +1 -0
- package/dist/cjs/lib/zigzag/zigzag.js +207 -0
- package/dist/cjs/lib/zigzag/zigzag.js.map +7 -0
- package/dist/cjs/line/index.d.ts +342 -0
- package/dist/cjs/line/index.d.ts.map +1 -0
- package/dist/cjs/line/index.js +193 -0
- package/dist/cjs/line/index.js.map +7 -0
- package/dist/cjs/linefill/index.d.ts +124 -0
- package/dist/cjs/linefill/index.d.ts.map +1 -0
- package/dist/cjs/linefill/index.js +56 -0
- package/dist/cjs/linefill/index.js.map +7 -0
- package/dist/cjs/map/index.d.ts +69 -0
- package/dist/cjs/map/index.d.ts.map +1 -0
- package/dist/cjs/map/index.js +80 -0
- package/dist/cjs/map/index.js.map +7 -0
- package/dist/cjs/math/index.d.ts +560 -0
- package/dist/cjs/math/index.d.ts.map +1 -0
- package/dist/cjs/math/index.js +441 -0
- package/dist/cjs/math/index.js.map +7 -0
- package/dist/cjs/matrix/index.d.ts +1231 -0
- package/dist/cjs/matrix/index.d.ts.map +1 -0
- package/dist/cjs/matrix/index.js +1200 -0
- package/dist/cjs/matrix/index.js.map +7 -0
- package/dist/cjs/package.json +1 -0
- package/dist/cjs/plot.d.ts +76 -0
- package/dist/cjs/plot.d.ts.map +1 -0
- package/dist/cjs/plot.js +51 -0
- package/dist/cjs/plot.js.map +7 -0
- package/dist/cjs/polyline/index.d.ts +115 -0
- package/dist/cjs/polyline/index.d.ts.map +1 -0
- package/dist/cjs/polyline/index.js +76 -0
- package/dist/cjs/polyline/index.js.map +7 -0
- package/dist/cjs/runtime/adapters/LightweightChartsAdapter.d.ts +86 -0
- package/dist/cjs/runtime/adapters/LightweightChartsAdapter.d.ts.map +1 -0
- package/dist/cjs/runtime/adapters/LightweightChartsAdapter.js +141 -0
- package/dist/cjs/runtime/adapters/LightweightChartsAdapter.js.map +7 -0
- package/dist/cjs/runtime/adapters/SimpleInputAdapter.d.ts +59 -0
- package/dist/cjs/runtime/adapters/SimpleInputAdapter.d.ts.map +1 -0
- package/dist/cjs/runtime/adapters/SimpleInputAdapter.js +117 -0
- package/dist/cjs/runtime/adapters/SimpleInputAdapter.js.map +7 -0
- package/dist/{runtime → cjs/runtime}/index.d.ts +12 -5
- package/dist/cjs/runtime/index.d.ts.map +1 -0
- package/dist/cjs/runtime/index.js +49 -0
- package/dist/cjs/runtime/index.js.map +7 -0
- package/dist/cjs/runtime/inputs.d.ts +91 -0
- package/dist/cjs/runtime/inputs.d.ts.map +1 -0
- package/dist/cjs/runtime/inputs.js +262 -0
- package/dist/cjs/runtime/inputs.js.map +7 -0
- package/dist/cjs/runtime/runtime.d.ts +70 -0
- package/dist/cjs/runtime/runtime.d.ts.map +1 -0
- package/dist/cjs/runtime/runtime.js +148 -0
- package/dist/cjs/runtime/runtime.js.map +7 -0
- package/dist/cjs/runtime/series.d.ts +362 -0
- package/dist/cjs/runtime/series.d.ts.map +1 -0
- package/dist/cjs/runtime/series.js +560 -0
- package/dist/cjs/runtime/series.js.map +7 -0
- package/dist/cjs/runtime/types.d.ts +282 -0
- package/dist/cjs/runtime/types.d.ts.map +1 -0
- package/dist/cjs/runtime/types.js +17 -0
- package/dist/cjs/runtime/types.js.map +7 -0
- package/dist/cjs/script/index.d.ts +987 -0
- package/dist/cjs/script/index.d.ts.map +1 -0
- package/dist/cjs/script/index.js +1169 -0
- package/dist/cjs/script/index.js.map +7 -0
- package/dist/cjs/security/resample.d.ts +63 -0
- package/dist/cjs/security/resample.d.ts.map +1 -0
- package/dist/cjs/security/resample.js +84 -0
- package/dist/cjs/security/resample.js.map +7 -0
- package/dist/cjs/session/bars.d.ts +80 -0
- package/dist/cjs/session/bars.d.ts.map +1 -0
- package/dist/cjs/session/bars.js +219 -0
- package/dist/cjs/session/bars.js.map +7 -0
- package/dist/cjs/session/calendar.d.ts +70 -0
- package/dist/cjs/session/calendar.d.ts.map +1 -0
- package/dist/cjs/session/calendar.js +164 -0
- package/dist/cjs/session/calendar.js.map +7 -0
- package/dist/cjs/str/dateformat.d.ts +15 -0
- package/dist/cjs/str/dateformat.d.ts.map +1 -0
- package/dist/cjs/str/dateformat.js +149 -0
- package/dist/cjs/str/dateformat.js.map +7 -0
- package/dist/cjs/str/index.d.ts +459 -0
- package/dist/cjs/str/index.d.ts.map +1 -0
- package/dist/cjs/str/index.js +143 -0
- package/dist/cjs/str/index.js.map +7 -0
- package/dist/cjs/str/messageformat.d.ts +14 -0
- package/dist/cjs/str/messageformat.d.ts.map +1 -0
- package/dist/cjs/str/messageformat.js +114 -0
- package/dist/cjs/str/messageformat.js.map +7 -0
- package/dist/cjs/str/numberformat.d.ts +19 -0
- package/dist/cjs/str/numberformat.d.ts.map +1 -0
- package/dist/cjs/str/numberformat.js +170 -0
- package/dist/cjs/str/numberformat.js.map +7 -0
- package/dist/{strategy → cjs/strategy}/index.d.ts +50 -0
- package/dist/cjs/strategy/index.d.ts.map +1 -0
- package/dist/cjs/strategy/index.js +92 -0
- package/dist/cjs/strategy/index.js.map +7 -0
- package/dist/cjs/ta/index.d.ts +1397 -0
- package/dist/cjs/ta/index.d.ts.map +1 -0
- package/dist/cjs/ta/index.js +1715 -0
- package/dist/cjs/ta/index.js.map +7 -0
- package/dist/cjs/ta/running-sum.d.ts +30 -0
- package/dist/cjs/ta/running-sum.d.ts.map +1 -0
- package/dist/cjs/ta/running-sum.js +99 -0
- package/dist/cjs/ta/running-sum.js.map +7 -0
- package/dist/cjs/ta-series.d.ts +558 -0
- package/dist/cjs/ta-series.d.ts.map +1 -0
- package/dist/cjs/ta-series.js +606 -0
- package/dist/cjs/ta-series.js.map +7 -0
- package/dist/cjs/text/index.d.ts +14 -0
- package/dist/cjs/text/index.d.ts.map +1 -0
- package/dist/cjs/text/index.js +29 -0
- package/dist/cjs/text/index.js.map +7 -0
- package/dist/cjs/time/datestring.d.ts +23 -0
- package/dist/cjs/time/datestring.d.ts.map +1 -0
- package/dist/cjs/time/datestring.js +106 -0
- package/dist/cjs/time/datestring.js.map +7 -0
- package/dist/cjs/time/index.d.ts +89 -0
- package/dist/cjs/time/index.d.ts.map +1 -0
- package/dist/cjs/time/index.js +85 -0
- package/dist/cjs/time/index.js.map +7 -0
- package/dist/cjs/time/session.d.ts +17 -0
- package/dist/cjs/time/session.d.ts.map +1 -0
- package/dist/cjs/time/session.js +65 -0
- package/dist/cjs/time/session.js.map +7 -0
- package/dist/cjs/time/timezone.d.ts +40 -0
- package/dist/cjs/time/timezone.d.ts.map +1 -0
- package/dist/cjs/time/timezone.js +125 -0
- package/dist/cjs/time/timezone.js.map +7 -0
- package/dist/cjs/timeframe/index.d.ts +73 -0
- package/dist/cjs/timeframe/index.d.ts.map +1 -0
- package/dist/cjs/timeframe/index.js +85 -0
- package/dist/cjs/timeframe/index.js.map +7 -0
- package/dist/cjs/types/index.d.ts +343 -0
- package/dist/cjs/types/index.d.ts.map +1 -0
- package/dist/cjs/types/index.js +32 -0
- package/dist/cjs/types/index.js.map +7 -0
- package/dist/cjs/types/metadata.d.ts +300 -0
- package/dist/cjs/types/metadata.d.ts.map +1 -0
- package/dist/cjs/types/metadata.js +17 -0
- package/dist/cjs/types/metadata.js.map +7 -0
- package/dist/cjs/utils/index.d.ts +167 -0
- package/dist/cjs/utils/index.d.ts.map +1 -0
- package/dist/cjs/utils/index.js +209 -0
- package/dist/cjs/utils/index.js.map +7 -0
- package/dist/esm/array/index.d.ts +701 -0
- package/dist/esm/array/index.d.ts.map +1 -0
- package/dist/esm/array/index.js +983 -0
- package/dist/esm/array/index.js.map +1 -0
- package/dist/esm/box/index.d.ts +444 -0
- package/dist/esm/box/index.d.ts.map +1 -0
- package/dist/esm/box/index.js +602 -0
- package/dist/esm/box/index.js.map +1 -0
- package/dist/esm/callsite/index.d.ts +61 -0
- package/dist/esm/callsite/index.d.ts.map +1 -0
- package/dist/esm/callsite/index.js +97 -0
- package/dist/esm/callsite/index.js.map +1 -0
- package/dist/esm/chartpoint/index.d.ts +90 -0
- package/dist/esm/chartpoint/index.d.ts.map +1 -0
- package/dist/esm/chartpoint/index.js +113 -0
- package/dist/esm/chartpoint/index.js.map +1 -0
- package/dist/esm/color/index.d.ts +285 -0
- package/dist/esm/color/index.d.ts.map +1 -0
- package/dist/esm/color/index.js +373 -0
- package/dist/esm/color/index.js.map +1 -0
- package/dist/esm/compare/index.d.ts +26 -0
- package/dist/esm/compare/index.d.ts.map +1 -0
- package/dist/esm/compare/index.js +39 -0
- package/dist/esm/compare/index.js.map +1 -0
- package/dist/esm/drawing/registry.d.ts +42 -0
- package/dist/esm/drawing/registry.d.ts.map +1 -0
- package/dist/esm/drawing/registry.js +89 -0
- package/dist/esm/drawing/registry.js.map +1 -0
- package/dist/esm/index.d.ts +85 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/esm/index.js +96 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/indicator.d.ts +117 -0
- package/dist/esm/indicator.d.ts.map +1 -0
- package/dist/esm/indicator.js +84 -0
- package/dist/esm/indicator.js.map +1 -0
- package/dist/esm/input.d.ts +196 -0
- package/dist/esm/input.d.ts.map +1 -0
- package/dist/esm/input.js +183 -0
- package/dist/esm/input.js.map +1 -0
- package/dist/esm/label/index.d.ts +303 -0
- package/dist/esm/label/index.d.ts.map +1 -0
- package/dist/esm/label/index.js +417 -0
- package/dist/esm/label/index.js.map +1 -0
- package/dist/esm/lib/index.d.ts +8 -0
- package/dist/esm/lib/index.d.ts.map +1 -0
- package/dist/esm/lib/index.js +8 -0
- package/dist/esm/lib/index.js.map +1 -0
- package/dist/esm/lib/zigzag/index.d.ts +5 -0
- package/dist/esm/lib/zigzag/index.d.ts.map +1 -0
- package/dist/esm/lib/zigzag/index.js +5 -0
- package/dist/esm/lib/zigzag/index.js.map +1 -0
- package/dist/esm/lib/zigzag/zigzag.d.ts +100 -0
- package/dist/esm/lib/zigzag/zigzag.d.ts.map +1 -0
- package/dist/esm/lib/zigzag/zigzag.js +229 -0
- package/dist/esm/lib/zigzag/zigzag.js.map +1 -0
- package/dist/esm/line/index.d.ts +342 -0
- package/dist/esm/line/index.d.ts.map +1 -0
- package/dist/esm/line/index.js +470 -0
- package/dist/esm/line/index.js.map +1 -0
- package/dist/esm/linefill/index.d.ts +124 -0
- package/dist/esm/linefill/index.d.ts.map +1 -0
- package/dist/esm/linefill/index.js +144 -0
- package/dist/esm/linefill/index.js.map +1 -0
- package/dist/esm/map/index.d.ts +69 -0
- package/dist/esm/map/index.d.ts.map +1 -0
- package/dist/esm/map/index.js +106 -0
- package/dist/esm/map/index.js.map +1 -0
- package/dist/esm/math/index.d.ts +560 -0
- package/dist/esm/math/index.d.ts.map +1 -0
- package/dist/esm/math/index.js +495 -0
- package/dist/esm/math/index.js.map +1 -0
- package/dist/esm/matrix/index.d.ts +1231 -0
- package/dist/esm/matrix/index.d.ts.map +1 -0
- package/dist/esm/matrix/index.js +2450 -0
- package/dist/esm/matrix/index.js.map +1 -0
- package/dist/esm/plot.d.ts +76 -0
- package/dist/esm/plot.d.ts.map +1 -0
- package/dist/esm/plot.js +63 -0
- package/dist/esm/plot.js.map +1 -0
- package/dist/esm/polyline/index.d.ts +115 -0
- package/dist/esm/polyline/index.d.ts.map +1 -0
- package/dist/esm/polyline/index.js +157 -0
- package/dist/esm/polyline/index.js.map +1 -0
- package/dist/esm/runtime/adapters/LightweightChartsAdapter.d.ts +86 -0
- package/dist/esm/runtime/adapters/LightweightChartsAdapter.d.ts.map +1 -0
- package/dist/esm/runtime/adapters/LightweightChartsAdapter.js +140 -0
- package/dist/esm/runtime/adapters/LightweightChartsAdapter.js.map +1 -0
- package/dist/esm/runtime/adapters/SimpleInputAdapter.d.ts +59 -0
- package/dist/esm/runtime/adapters/SimpleInputAdapter.d.ts.map +1 -0
- package/dist/esm/runtime/adapters/SimpleInputAdapter.js +115 -0
- package/dist/esm/runtime/adapters/SimpleInputAdapter.js.map +1 -0
- package/dist/esm/runtime/index.d.ts +13 -0
- package/dist/esm/runtime/index.d.ts.map +1 -0
- package/dist/esm/runtime/index.js +14 -0
- package/dist/esm/runtime/index.js.map +1 -0
- package/dist/esm/runtime/inputs.d.ts +91 -0
- package/dist/esm/runtime/inputs.d.ts.map +1 -0
- package/dist/esm/runtime/inputs.js +334 -0
- package/dist/esm/runtime/inputs.js.map +1 -0
- package/dist/esm/runtime/runtime.d.ts +70 -0
- package/dist/esm/runtime/runtime.d.ts.map +1 -0
- package/dist/esm/runtime/runtime.js +193 -0
- package/dist/esm/runtime/runtime.js.map +1 -0
- package/dist/esm/runtime/series.d.ts +362 -0
- package/dist/esm/runtime/series.d.ts.map +1 -0
- package/dist/esm/runtime/series.js +583 -0
- package/dist/esm/runtime/series.js.map +1 -0
- package/dist/esm/runtime/types.d.ts +282 -0
- package/dist/esm/runtime/types.d.ts.map +1 -0
- package/dist/esm/runtime/types.js +7 -0
- package/dist/esm/runtime/types.js.map +1 -0
- package/dist/esm/script/index.d.ts +987 -0
- package/dist/esm/script/index.d.ts.map +1 -0
- package/dist/esm/script/index.js +1289 -0
- package/dist/esm/script/index.js.map +1 -0
- package/dist/esm/security/resample.d.ts +63 -0
- package/dist/esm/security/resample.d.ts.map +1 -0
- package/dist/esm/security/resample.js +110 -0
- package/dist/esm/security/resample.js.map +1 -0
- package/dist/esm/session/bars.d.ts +80 -0
- package/dist/esm/session/bars.d.ts.map +1 -0
- package/dist/esm/session/bars.js +232 -0
- package/dist/esm/session/bars.js.map +1 -0
- package/dist/esm/session/calendar.d.ts +70 -0
- package/dist/esm/session/calendar.d.ts.map +1 -0
- package/dist/esm/session/calendar.js +172 -0
- package/dist/esm/session/calendar.js.map +1 -0
- package/dist/esm/str/dateformat.d.ts +15 -0
- package/dist/esm/str/dateformat.d.ts.map +1 -0
- package/dist/esm/str/dateformat.js +136 -0
- package/dist/esm/str/dateformat.js.map +1 -0
- package/dist/esm/str/index.d.ts +459 -0
- package/dist/esm/str/index.d.ts.map +1 -0
- package/dist/esm/str/index.js +540 -0
- package/dist/esm/str/index.js.map +1 -0
- package/dist/esm/str/messageformat.d.ts +14 -0
- package/dist/esm/str/messageformat.d.ts.map +1 -0
- package/dist/esm/str/messageformat.js +111 -0
- package/dist/esm/str/messageformat.js.map +1 -0
- package/dist/esm/str/numberformat.d.ts +19 -0
- package/dist/esm/str/numberformat.d.ts.map +1 -0
- package/dist/esm/str/numberformat.js +189 -0
- package/dist/esm/str/numberformat.js.map +1 -0
- package/dist/esm/strategy/index.d.ts +245 -0
- package/dist/esm/strategy/index.d.ts.map +1 -0
- package/dist/esm/strategy/index.js +84 -0
- package/dist/esm/strategy/index.js.map +1 -0
- package/dist/esm/ta/index.d.ts +1397 -0
- package/dist/esm/ta/index.d.ts.map +1 -0
- package/dist/esm/ta/index.js +3227 -0
- package/dist/esm/ta/index.js.map +1 -0
- package/dist/esm/ta/running-sum.d.ts +30 -0
- package/dist/esm/ta/running-sum.d.ts.map +1 -0
- package/dist/esm/ta/running-sum.js +113 -0
- package/dist/esm/ta/running-sum.js.map +1 -0
- package/dist/esm/ta-series.d.ts +558 -0
- package/dist/esm/ta-series.d.ts.map +1 -0
- package/dist/esm/ta-series.js +910 -0
- package/dist/esm/ta-series.js.map +1 -0
- package/dist/esm/text/index.d.ts +14 -0
- package/dist/esm/text/index.d.ts.map +1 -0
- package/dist/esm/text/index.js +14 -0
- package/dist/esm/text/index.js.map +1 -0
- package/dist/esm/time/datestring.d.ts +23 -0
- package/dist/esm/time/datestring.d.ts.map +1 -0
- package/dist/esm/time/datestring.js +94 -0
- package/dist/esm/time/datestring.js.map +1 -0
- package/dist/esm/time/index.d.ts +89 -0
- package/dist/esm/time/index.d.ts.map +1 -0
- package/dist/esm/time/index.js +108 -0
- package/dist/esm/time/index.js.map +1 -0
- package/dist/esm/time/session.d.ts +17 -0
- package/dist/esm/time/session.d.ts.map +1 -0
- package/dist/esm/time/session.js +69 -0
- package/dist/esm/time/session.js.map +1 -0
- package/dist/esm/time/timezone.d.ts +40 -0
- package/dist/esm/time/timezone.d.ts.map +1 -0
- package/dist/esm/time/timezone.js +144 -0
- package/dist/esm/time/timezone.js.map +1 -0
- package/dist/esm/timeframe/index.d.ts +73 -0
- package/dist/esm/timeframe/index.d.ts.map +1 -0
- package/dist/esm/timeframe/index.js +131 -0
- package/dist/esm/timeframe/index.js.map +1 -0
- package/dist/esm/types/index.d.ts +343 -0
- package/dist/esm/types/index.d.ts.map +1 -0
- package/dist/esm/types/index.js +17 -0
- package/dist/esm/types/index.js.map +1 -0
- package/dist/esm/types/metadata.d.ts +300 -0
- package/dist/esm/types/metadata.d.ts.map +1 -0
- package/dist/esm/types/metadata.js +7 -0
- package/dist/esm/types/metadata.js.map +1 -0
- package/dist/esm/utils/index.d.ts +167 -0
- package/dist/esm/utils/index.d.ts.map +1 -0
- package/dist/esm/utils/index.js +295 -0
- package/dist/esm/utils/index.js.map +1 -0
- package/package.json +53 -23
- package/src/array/index.ts +1056 -0
- package/src/box/index.ts +680 -0
- package/src/callsite/index.ts +104 -0
- package/src/chartpoint/index.ts +126 -0
- package/src/color/index.ts +411 -0
- package/src/compare/index.ts +46 -0
- package/src/drawing/registry.ts +106 -0
- package/src/index.ts +201 -0
- package/src/indicator.ts +185 -0
- package/src/input.ts +280 -0
- package/src/label/index.ts +490 -0
- package/src/lib/index.ts +8 -0
- package/src/lib/zigzag/index.ts +13 -0
- package/src/lib/zigzag/zigzag.ts +318 -0
- package/src/line/index.ts +530 -0
- package/src/linefill/index.ts +152 -0
- package/src/map/index.ts +115 -0
- package/src/math/index.ts +1071 -0
- package/src/matrix/index.ts +2697 -0
- package/src/plot.ts +121 -0
- package/src/polyline/index.ts +184 -0
- package/src/runtime/adapters/LightweightChartsAdapter.ts +201 -0
- package/src/runtime/adapters/SimpleInputAdapter.ts +132 -0
- package/src/runtime/index.ts +52 -0
- package/src/runtime/inputs.ts +377 -0
- package/src/runtime/runtime.ts +241 -0
- package/src/runtime/series.ts +644 -0
- package/src/runtime/types.ts +292 -0
- package/src/script/index.ts +1865 -0
- package/src/security/resample.ts +119 -0
- package/src/session/bars.ts +262 -0
- package/src/session/calendar.ts +199 -0
- package/src/str/dateformat.ts +104 -0
- package/src/str/index.ts +557 -0
- package/src/str/messageformat.ts +109 -0
- package/src/str/numberformat.ts +197 -0
- package/src/strategy/index.ts +281 -0
- package/src/ta/index.ts +3580 -0
- package/src/ta/running-sum.ts +117 -0
- package/src/ta-series.ts +1036 -0
- package/src/text/index.ts +14 -0
- package/src/time/datestring.ts +96 -0
- package/src/time/index.ts +161 -0
- package/src/time/session.ts +79 -0
- package/src/time/timezone.ts +180 -0
- package/src/timeframe/index.ts +144 -0
- package/src/types/index.ts +398 -0
- package/src/types/metadata.ts +334 -0
- package/src/utils/index.ts +334 -0
- package/dist/array/index.d.ts +0 -57
- package/dist/array/index.d.ts.map +0 -1
- package/dist/box/index.d.ts +0 -37
- package/dist/box/index.d.ts.map +0 -1
- package/dist/callsite/index.d.ts +0 -7
- package/dist/callsite/index.d.ts.map +0 -1
- package/dist/chartpoint/index.d.ts +0 -8
- package/dist/chartpoint/index.d.ts.map +0 -1
- package/dist/color/index.d.ts +0 -28
- package/dist/color/index.d.ts.map +0 -1
- package/dist/compare/index.d.ts +0 -8
- package/dist/compare/index.d.ts.map +0 -1
- package/dist/drawing/registry.d.ts +0 -19
- package/dist/drawing/registry.d.ts.map +0 -1
- package/dist/index.cjs +0 -7981
- package/dist/index.d.ts +0 -64
- package/dist/index.d.ts.map +0 -1
- package/dist/index.mjs +0 -7964
- package/dist/indicator.d.ts +0 -42
- package/dist/indicator.d.ts.map +0 -1
- package/dist/input.d.ts +0 -47
- package/dist/input.d.ts.map +0 -1
- package/dist/label/index.d.ts +0 -30
- package/dist/label/index.d.ts.map +0 -1
- package/dist/lib/index.d.ts +0 -2
- package/dist/lib/index.d.ts.map +0 -1
- package/dist/lib/zigzag/index.d.ts.map +0 -1
- package/dist/lib/zigzag/zigzag.d.ts +0 -47
- package/dist/lib/zigzag/zigzag.d.ts.map +0 -1
- package/dist/line/index.d.ts +0 -30
- package/dist/line/index.d.ts.map +0 -1
- package/dist/linefill/index.d.ts +0 -10
- package/dist/linefill/index.d.ts.map +0 -1
- package/dist/map/index.d.ts +0 -14
- package/dist/map/index.d.ts.map +0 -1
- package/dist/math/index.d.ts +0 -53
- package/dist/math/index.d.ts.map +0 -1
- package/dist/matrix/index.d.ts +0 -52
- package/dist/matrix/index.d.ts.map +0 -1
- package/dist/plot.d.ts +0 -20
- package/dist/plot.d.ts.map +0 -1
- package/dist/polyline/index.d.ts +0 -11
- package/dist/polyline/index.d.ts.map +0 -1
- package/dist/runtime/adapters/LightweightChartsAdapter.d.ts +0 -15
- package/dist/runtime/adapters/LightweightChartsAdapter.d.ts.map +0 -1
- package/dist/runtime/adapters/SimpleInputAdapter.d.ts +0 -16
- package/dist/runtime/adapters/SimpleInputAdapter.d.ts.map +0 -1
- package/dist/runtime/index.cjs +0 -600
- package/dist/runtime/index.d.ts.map +0 -1
- package/dist/runtime/index.mjs +0 -577
- package/dist/runtime/inputs.d.ts +0 -13
- package/dist/runtime/inputs.d.ts.map +0 -1
- package/dist/runtime/runtime.d.ts +0 -16
- package/dist/runtime/runtime.d.ts.map +0 -1
- package/dist/runtime/series.d.ts +0 -60
- package/dist/runtime/series.d.ts.map +0 -1
- package/dist/runtime/types.d.ts +0 -126
- package/dist/runtime/types.d.ts.map +0 -1
- package/dist/script/index.cjs +0 -6377
- package/dist/script/index.d.ts +0 -713
- package/dist/script/index.d.ts.map +0 -1
- package/dist/script/index.mjs +0 -6360
- package/dist/security/resample.d.ts +0 -13
- package/dist/security/resample.d.ts.map +0 -1
- package/dist/session/bars.d.ts +0 -34
- package/dist/session/bars.d.ts.map +0 -1
- package/dist/session/calendar.d.ts +0 -31
- package/dist/session/calendar.d.ts.map +0 -1
- package/dist/str/dateformat.d.ts +0 -2
- package/dist/str/dateformat.d.ts.map +0 -1
- package/dist/str/index.d.ts +0 -24
- package/dist/str/index.d.ts.map +0 -1
- package/dist/str/messageformat.d.ts +0 -2
- package/dist/str/messageformat.d.ts.map +0 -1
- package/dist/str/numberformat.d.ts +0 -3
- package/dist/str/numberformat.d.ts.map +0 -1
- package/dist/strategy/index.d.ts.map +0 -1
- package/dist/ta/index.d.ts +0 -72
- package/dist/ta/index.d.ts.map +0 -1
- package/dist/ta/running-sum.d.ts +0 -3
- package/dist/ta/running-sum.d.ts.map +0 -1
- package/dist/ta-series.d.ts +0 -143
- package/dist/ta-series.d.ts.map +0 -1
- package/dist/text/index.d.ts +0 -4
- package/dist/text/index.d.ts.map +0 -1
- package/dist/time/datestring.d.ts +0 -2
- package/dist/time/datestring.d.ts.map +0 -1
- package/dist/time/index.d.ts +0 -15
- package/dist/time/index.d.ts.map +0 -1
- package/dist/time/session.d.ts +0 -2
- package/dist/time/session.d.ts.map +0 -1
- package/dist/time/timezone.d.ts +0 -13
- package/dist/time/timezone.d.ts.map +0 -1
- package/dist/timeframe/index.d.ts +0 -17
- package/dist/timeframe/index.d.ts.map +0 -1
- package/dist/types/index.d.ts +0 -181
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/metadata.d.ts +0 -132
- package/dist/types/metadata.d.ts.map +0 -1
- package/dist/utils/index.d.ts +0 -26
- package/dist/utils/index.d.ts.map +0 -1
|
@@ -0,0 +1,987 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview PineScript-style script API — write an indicator as a flat
|
|
3
|
+
* script instead of the explicit calculate() convention.
|
|
4
|
+
*
|
|
5
|
+
* ```typescript
|
|
6
|
+
* import { indicator, input, plot, ta } from 'oakscriptjs/script';
|
|
7
|
+
*
|
|
8
|
+
* indicator('My SMA', { overlay: true });
|
|
9
|
+
* const length = input.int(20, 'Length', { minval: 1 });
|
|
10
|
+
* const src = input.source('close', 'Source');
|
|
11
|
+
* plot(ta.sma(src, length), 'SMA', { color: '#2962FF' });
|
|
12
|
+
* ```
|
|
13
|
+
*
|
|
14
|
+
* Execution model: the host calls {@link executeScript} with the script body,
|
|
15
|
+
* the bars and the current input values. Declaration calls (indicator, input.*,
|
|
16
|
+
* plot, hline, fill, alertcondition) run as the body executes and are collected
|
|
17
|
+
* into a {@link ScriptRunResult}: the declarative configs (inputConfig,
|
|
18
|
+
* plotConfig, hlineConfig, fillConfig) plus an IndicatorResult with the plot
|
|
19
|
+
* data. Re-running the body with new bars or inputs is PineScript's
|
|
20
|
+
* recalculation model.
|
|
21
|
+
*
|
|
22
|
+
* `input.*` is idempotent like PineScript: it declares the input AND returns
|
|
23
|
+
* its current value (the host-supplied override, else the default).
|
|
24
|
+
*
|
|
25
|
+
* The OHLCV builtins (open/high/low/close/volume/hl2/hlc3/ohlc4/hlcc4) are
|
|
26
|
+
* Series bound to a module-level BarData that the host swaps per run, so
|
|
27
|
+
* derived Series memoize between identical runs and recompute when the bars
|
|
28
|
+
* version bumps.
|
|
29
|
+
*
|
|
30
|
+
* One script executes at a time (module-level context) — hosts that run many
|
|
31
|
+
* scripts must serialize executions, which a Web Worker does naturally.
|
|
32
|
+
*
|
|
33
|
+
* @module script
|
|
34
|
+
*/
|
|
35
|
+
import type { Bar } from '../types/index.js';
|
|
36
|
+
import type { ArrowData, BarColorData, IndicatorResult, MarkerData, MarkerLocation, MarkerSize, ShapeStyle, TimeValue } from '../types/metadata.js';
|
|
37
|
+
import type { ArrowConfig, BarColorConfig, FillConfig, HLineConfig, InputConfig, PlotConfig, ShapeConfig } from '../runtime/types.js';
|
|
38
|
+
import { BarData, Series } from '../runtime/series.js';
|
|
39
|
+
import * as taSeries from '../ta-series.js';
|
|
40
|
+
import * as colorCore from '../color/index.js';
|
|
41
|
+
import { isNA, nz } from '../utils/index.js';
|
|
42
|
+
import * as lineCore from '../line/index.js';
|
|
43
|
+
import * as labelCore from '../label/index.js';
|
|
44
|
+
import * as boxCore from '../box/index.js';
|
|
45
|
+
import * as linefillCore from '../linefill/index.js';
|
|
46
|
+
import * as polylineCore from '../polyline/index.js';
|
|
47
|
+
import * as chartPointCore from '../chartpoint/index.js';
|
|
48
|
+
import * as mathCore from '../math/index.js';
|
|
49
|
+
import * as timeframeCore from '../timeframe/index.js';
|
|
50
|
+
import { type SessionSpec } from '../session/calendar.js';
|
|
51
|
+
import type { ChartPoint } from '../types/index.js';
|
|
52
|
+
import { STRATEGY_CONSTANTS, type StrategyCloseAllOptions, type StrategyCloseOptions, type StrategyDirection, type StrategyEngine, type StrategyEntryOptions, type StrategyExitOptions, type StrategyNumberVariable, type StrategyOptions, type StrategyProperties, type StrategyRiskDirection, type StrategyRiskValueType, type StrategyTextVariable, type StrategyTrade } from '../strategy/index.js';
|
|
53
|
+
/** Everything one run of a script produced. */
|
|
54
|
+
export interface ScriptRunResult {
|
|
55
|
+
metadata: {
|
|
56
|
+
title: string;
|
|
57
|
+
shortTitle?: string;
|
|
58
|
+
overlay: boolean;
|
|
59
|
+
precision?: number;
|
|
60
|
+
format?: string;
|
|
61
|
+
};
|
|
62
|
+
inputConfig: InputConfig[];
|
|
63
|
+
plotConfig: PlotConfig[];
|
|
64
|
+
hlineConfig: HLineConfig[];
|
|
65
|
+
fillConfig: FillConfig[];
|
|
66
|
+
shapeConfig: ShapeConfig[];
|
|
67
|
+
arrowConfig: ArrowConfig[];
|
|
68
|
+
barColorConfig: BarColorConfig[];
|
|
69
|
+
defaultInputs: Record<string, unknown>;
|
|
70
|
+
alertConfig: AlertConditionConfig[];
|
|
71
|
+
/** Strategy properties (declared values, else the PineScript defaults) when the script declares strategy(). */
|
|
72
|
+
strategyConfig?: StrategyProperties;
|
|
73
|
+
/** The renderable output (plots keyed by plotConfig ids, plot-pair fills). */
|
|
74
|
+
result: IndicatorResult & {
|
|
75
|
+
alerts?: AlertState[];
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
export interface AlertConditionConfig {
|
|
79
|
+
id: string;
|
|
80
|
+
title: string;
|
|
81
|
+
message?: string;
|
|
82
|
+
}
|
|
83
|
+
/** Per-run alert evaluation: whether the condition is true on the last bar. */
|
|
84
|
+
export interface AlertState {
|
|
85
|
+
id: string;
|
|
86
|
+
title: string;
|
|
87
|
+
message?: string;
|
|
88
|
+
triggered: boolean;
|
|
89
|
+
}
|
|
90
|
+
/** Handle returned by plot()/hline() so fill() can reference them. */
|
|
91
|
+
export interface PlotHandle {
|
|
92
|
+
id: string;
|
|
93
|
+
kind: 'plot' | 'hline';
|
|
94
|
+
}
|
|
95
|
+
/** What the host passes to its strategy engine factory when the script declares strategy(). */
|
|
96
|
+
export interface StrategySetup {
|
|
97
|
+
properties: StrategyProperties;
|
|
98
|
+
bars: readonly Bar[];
|
|
99
|
+
chart: Readonly<ChartContext>;
|
|
100
|
+
}
|
|
101
|
+
export interface ScriptOptions {
|
|
102
|
+
/** Creates the order engine of a strategy script; called by strategy(). */
|
|
103
|
+
strategyEngine?: (setup: StrategySetup) => StrategyEngine;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Runs a script body against `bars` with the given input overrides and
|
|
107
|
+
* collects everything it declared. `chart` describes the bars (chart timeframe,
|
|
108
|
+
* exchange time zone, session type) for the PineScript values that depend on them. `options.strategyEngine`
|
|
109
|
+
* supplies the order engine of strategy scripts. This is the host-side entry — editor
|
|
110
|
+
* panels, workers and tests call it; scripts never do.
|
|
111
|
+
*/
|
|
112
|
+
export declare function executeScript(body: () => void, barsInput: Bar[], inputs?: Record<string, unknown>, chart?: ChartContext, options?: ScriptOptions): ScriptRunResult;
|
|
113
|
+
export interface IndicatorOptions {
|
|
114
|
+
shorttitle?: string;
|
|
115
|
+
overlay?: boolean;
|
|
116
|
+
precision?: number;
|
|
117
|
+
format?: string;
|
|
118
|
+
/** Lines kept before the oldest are deleted (default 50; PineScript keeps up to 5 more). */
|
|
119
|
+
max_lines_count?: number;
|
|
120
|
+
/** Labels kept before the oldest are deleted (default 50). */
|
|
121
|
+
max_labels_count?: number;
|
|
122
|
+
/** Boxes kept before the oldest are deleted (default 50). */
|
|
123
|
+
max_boxes_count?: number;
|
|
124
|
+
/** Polylines kept before the oldest are deleted (default 50). */
|
|
125
|
+
max_polylines_count?: number;
|
|
126
|
+
}
|
|
127
|
+
/** PineScript `indicator()` — declares the script's metadata. */
|
|
128
|
+
export declare function indicator(title: string, options?: IndicatorOptions): void;
|
|
129
|
+
/** Options of every `input.*` kind (PineScript `group`, `inline`, `tooltip`, `confirm`, `display`). */
|
|
130
|
+
export interface InputOptions {
|
|
131
|
+
group?: string;
|
|
132
|
+
inline?: string;
|
|
133
|
+
tooltip?: string;
|
|
134
|
+
confirm?: boolean;
|
|
135
|
+
display?: InputConfig['display'];
|
|
136
|
+
}
|
|
137
|
+
export interface NumericInputOptions extends InputOptions {
|
|
138
|
+
minval?: number;
|
|
139
|
+
maxval?: number;
|
|
140
|
+
step?: number;
|
|
141
|
+
}
|
|
142
|
+
export interface StringInputOptions extends InputOptions {
|
|
143
|
+
options?: string[];
|
|
144
|
+
}
|
|
145
|
+
/** PineScript `input.*` — declares an input AND returns its current value. */
|
|
146
|
+
export declare const input: {
|
|
147
|
+
int(defval: number, title?: string, opts?: NumericInputOptions): number;
|
|
148
|
+
float(defval: number, title?: string, opts?: NumericInputOptions): number;
|
|
149
|
+
bool(defval: boolean, title?: string, opts?: InputOptions): boolean;
|
|
150
|
+
string(defval: string, title?: string, opts?: StringInputOptions): string;
|
|
151
|
+
color(defval: string, title?: string, opts?: InputOptions): string;
|
|
152
|
+
/** Declares a source input and returns it as a Series. */
|
|
153
|
+
source(defval?: string, title?: string, opts?: InputOptions): Series;
|
|
154
|
+
/** Timeframe string ("60", "1D", "W"). As in PineScript, "" means the chart timeframe. */
|
|
155
|
+
timeframe(defval: string, title?: string, opts?: StringInputOptions): string;
|
|
156
|
+
/** Session string ("0930-1600", "0930-1600:23456"). */
|
|
157
|
+
session(defval: string, title?: string, opts?: StringInputOptions): string;
|
|
158
|
+
/** Date and time as a UNIX time in milliseconds, e.g. `input.time(timestamp('2024-01-01'), 'Start')`. */
|
|
159
|
+
time(defval: number, title?: string, opts?: InputOptions): number;
|
|
160
|
+
};
|
|
161
|
+
export declare const open: Series;
|
|
162
|
+
export declare const high: Series;
|
|
163
|
+
export declare const low: Series;
|
|
164
|
+
export declare const close: Series;
|
|
165
|
+
export declare const volume: Series;
|
|
166
|
+
export declare const hl2: Series;
|
|
167
|
+
export declare const hlc3: Series;
|
|
168
|
+
export declare const ohlc4: Series;
|
|
169
|
+
export declare const hlcc4: Series;
|
|
170
|
+
/** ta.* with the chart-implicit (bars-first) functions bound to the context,
|
|
171
|
+
* so scripts call them like PineScript: `ta.tr(true)`, `ta.atr(14)`. */
|
|
172
|
+
export declare const ta: {
|
|
173
|
+
tr: (handleNa?: boolean) => Series;
|
|
174
|
+
atr: (length: number) => Series;
|
|
175
|
+
sar: (start?: number, inc?: number, max?: number) => Series;
|
|
176
|
+
wpr: (length?: number) => Series;
|
|
177
|
+
supertrend: (factor: number, atrLength: number) => [Series, Series];
|
|
178
|
+
dmi: (diLength: number, adxSmoothing: number) => [Series, Series, Series];
|
|
179
|
+
kc: (source: Series, length: number, mult: number, useTrueRange?: boolean) => [Series, Series, Series];
|
|
180
|
+
kcw: (source: Series, length?: number, mult?: number, useTrueRange?: boolean) => Series;
|
|
181
|
+
ichimoku: (conversionPeriods: number, basePeriods: number, laggingSpan2Periods: number, displacement: number) => [Series, Series, Series, Series, Series];
|
|
182
|
+
/** `ta.highest(source, length)` or `ta.highest(length)` (source = high). */
|
|
183
|
+
highest: (sourceOrLength: Series | number, length?: number) => Series;
|
|
184
|
+
/** `ta.lowest(source, length)` or `ta.lowest(length)` (source = low). */
|
|
185
|
+
lowest: (sourceOrLength: Series | number, length?: number) => Series;
|
|
186
|
+
/** `ta.highestbars(source, length)` or `ta.highestbars(length)` (source = high); offsets are 0 or negative. */
|
|
187
|
+
highestbars: (sourceOrLength: Series | number, length?: number) => Series;
|
|
188
|
+
/** `ta.lowestbars(source, length)` or `ta.lowestbars(length)` (source = low); offsets are 0 or negative. */
|
|
189
|
+
lowestbars: (sourceOrLength: Series | number, length?: number) => Series;
|
|
190
|
+
/** `ta.vwap(source, anchor?, stdev_mult?)` with the chart volume; the default anchor is a new trading
|
|
191
|
+
* day (`timeframe.change("1D")`), which needs the chart context (timeframe, time zone, session). */
|
|
192
|
+
vwap: {
|
|
193
|
+
(source: Series, anchor?: Series): Series;
|
|
194
|
+
(source: Series, anchor: Series | undefined, stdev_mult: number): [Series, Series, Series];
|
|
195
|
+
};
|
|
196
|
+
/** `ta.mfi(source, length)` with the chart volume (PineScript takes 2 arguments). */
|
|
197
|
+
mfi: (source: Series, length: number) => Series;
|
|
198
|
+
/** `ta.pivothigh(source, leftbars, rightbars)` or `ta.pivothigh(leftbars, rightbars)` (source = high).
|
|
199
|
+
* The value appears `rightbars` bars after the pivot bar, as in PineScript. */
|
|
200
|
+
pivothigh: (sourceOrLeft: Series | number, leftOrRight: number, rightbars?: number) => Series;
|
|
201
|
+
/** `ta.pivotlow(source, leftbars, rightbars)` or `ta.pivotlow(leftbars, rightbars)` (source = low). */
|
|
202
|
+
pivotlow: (sourceOrLeft: Series | number, leftOrRight: number, rightbars?: number) => Series;
|
|
203
|
+
obv: Series;
|
|
204
|
+
pvt: Series;
|
|
205
|
+
accdist: Series;
|
|
206
|
+
nvi: Series;
|
|
207
|
+
pvi: Series;
|
|
208
|
+
iii: Series;
|
|
209
|
+
wad: Series;
|
|
210
|
+
wvad: Series;
|
|
211
|
+
sma(source: Series, length: number): Series;
|
|
212
|
+
ema(source: Series, length: number): Series;
|
|
213
|
+
wma(source: Series, length: number): Series;
|
|
214
|
+
rma(source: Series, length: number): Series;
|
|
215
|
+
rsi(source: Series, length: number): Series;
|
|
216
|
+
macd(source: Series, fastLength: number, slowLength: number, signalLength: number): [Series, Series, Series];
|
|
217
|
+
bb(source: Series, length: number, mult: number): [Series, Series, Series];
|
|
218
|
+
stdev(source: Series, length: number, biased?: boolean): Series;
|
|
219
|
+
stoch(source: Series, high: Series, low: Series, length: number): Series;
|
|
220
|
+
crossover(source1: Series, source2: Series | number): Series;
|
|
221
|
+
crossunder(source1: Series, source2: Series | number): Series;
|
|
222
|
+
cross(source1: Series, source2: Series | number): Series;
|
|
223
|
+
change(source: Series, length?: number): Series;
|
|
224
|
+
mom(source: Series, length: number): Series;
|
|
225
|
+
roc(source: Series, length: number): Series;
|
|
226
|
+
rising(source: Series, length: number): Series;
|
|
227
|
+
falling(source: Series, length: number): Series;
|
|
228
|
+
cum(source: Series): Series;
|
|
229
|
+
vwapBands(source: Series, volume: Series, anchor: Series | undefined, stdev_mult: number): [Series, Series, Series];
|
|
230
|
+
vwma(source: Series, length: number, volume: Series): Series;
|
|
231
|
+
linreg(source: Series, length: number, offset?: number): Series;
|
|
232
|
+
alma(source: Series, length?: number, offset?: number, sigma?: number, floor?: boolean): Series;
|
|
233
|
+
zigzag(bars: Bar[], deviation?: number, depth?: number, backstep?: number): [Series, Series, Series];
|
|
234
|
+
cci(source: Series, length: number): Series;
|
|
235
|
+
dev(source: Series, length: number): Series;
|
|
236
|
+
variance(source: Series, length: number, biased?: boolean): Series;
|
|
237
|
+
median(source: Series, length: number): Series;
|
|
238
|
+
swma(source: Series): Series;
|
|
239
|
+
correlation(source1: Series, source2: Series, length: number): Series;
|
|
240
|
+
percentrank(source: Series, length: number): Series;
|
|
241
|
+
hma(source: Series, length: number): Series;
|
|
242
|
+
barssince(condition: Series): Series;
|
|
243
|
+
valuewhen(condition: Series, source: Series, occurrence: number): Series;
|
|
244
|
+
tsi(source: Series, shortLength: number, longLength: number): Series;
|
|
245
|
+
cmo(source: Series, length: number): Series;
|
|
246
|
+
bbw(source: Series, length: number, mult: number): Series;
|
|
247
|
+
range(source: Series, length: number): Series;
|
|
248
|
+
max(source: Series): Series;
|
|
249
|
+
min(source: Series): Series;
|
|
250
|
+
cog(source: Series, length?: number): Series;
|
|
251
|
+
mode(source: Series, length: number): Series;
|
|
252
|
+
percentile_linear_interpolation(source: Series, length: number, percentage: number): Series;
|
|
253
|
+
percentile_nearest_rank(source: Series, length: number, percentage: number): Series;
|
|
254
|
+
rci(source: Series, length: number): Series;
|
|
255
|
+
ta: {
|
|
256
|
+
sma: typeof taSeries.sma;
|
|
257
|
+
ema: typeof taSeries.ema;
|
|
258
|
+
wma: typeof taSeries.wma;
|
|
259
|
+
vwma: typeof taSeries.vwma;
|
|
260
|
+
rma: typeof taSeries.rma;
|
|
261
|
+
rsi: typeof taSeries.rsi;
|
|
262
|
+
macd: typeof taSeries.macd;
|
|
263
|
+
bb: typeof taSeries.bb;
|
|
264
|
+
stdev: typeof taSeries.stdev;
|
|
265
|
+
atr: typeof taSeries.atr;
|
|
266
|
+
tr: typeof taSeries.tr;
|
|
267
|
+
stoch: typeof taSeries.stoch;
|
|
268
|
+
crossover: typeof taSeries.crossover;
|
|
269
|
+
crossunder: typeof taSeries.crossunder;
|
|
270
|
+
cross: typeof taSeries.cross;
|
|
271
|
+
change: typeof taSeries.change;
|
|
272
|
+
mom: typeof taSeries.mom;
|
|
273
|
+
roc: typeof taSeries.roc;
|
|
274
|
+
highest: typeof taSeries.highest;
|
|
275
|
+
lowest: typeof taSeries.lowest;
|
|
276
|
+
rising: typeof taSeries.rising;
|
|
277
|
+
falling: typeof taSeries.falling;
|
|
278
|
+
cum: typeof taSeries.cum;
|
|
279
|
+
supertrend: typeof taSeries.supertrend;
|
|
280
|
+
vwap: typeof taSeries.vwap;
|
|
281
|
+
ichimoku: typeof taSeries.ichimoku;
|
|
282
|
+
linreg: typeof taSeries.linreg;
|
|
283
|
+
alma: typeof taSeries.alma;
|
|
284
|
+
zigzag: typeof taSeries.zigzag;
|
|
285
|
+
cci: typeof taSeries.cci;
|
|
286
|
+
sar: typeof taSeries.sar;
|
|
287
|
+
dev: typeof taSeries.dev;
|
|
288
|
+
variance: typeof taSeries.variance;
|
|
289
|
+
median: typeof taSeries.median;
|
|
290
|
+
swma: typeof taSeries.swma;
|
|
291
|
+
correlation: typeof taSeries.correlation;
|
|
292
|
+
percentrank: typeof taSeries.percentrank;
|
|
293
|
+
mfi: typeof taSeries.mfi;
|
|
294
|
+
hma: typeof taSeries.hma;
|
|
295
|
+
pivothigh: typeof taSeries.pivothigh;
|
|
296
|
+
pivotlow: typeof taSeries.pivotlow;
|
|
297
|
+
barssince: typeof taSeries.barssince;
|
|
298
|
+
valuewhen: typeof taSeries.valuewhen;
|
|
299
|
+
dmi: typeof taSeries.dmi;
|
|
300
|
+
tsi: typeof taSeries.tsi;
|
|
301
|
+
cmo: typeof taSeries.cmo;
|
|
302
|
+
kc: typeof taSeries.kc;
|
|
303
|
+
bbw: typeof taSeries.bbw;
|
|
304
|
+
wpr: typeof taSeries.wpr;
|
|
305
|
+
kcw: typeof taSeries.kcw;
|
|
306
|
+
range: typeof taSeries.range;
|
|
307
|
+
highestbars: typeof taSeries.highestbars;
|
|
308
|
+
lowestbars: typeof taSeries.lowestbars;
|
|
309
|
+
max: typeof taSeries.max;
|
|
310
|
+
min: typeof taSeries.min;
|
|
311
|
+
vwapBands: typeof taSeries.vwapBands;
|
|
312
|
+
obv: typeof taSeries.obv;
|
|
313
|
+
pvt: typeof taSeries.pvt;
|
|
314
|
+
accdist: typeof taSeries.accdist;
|
|
315
|
+
nvi: typeof taSeries.nvi;
|
|
316
|
+
pvi: typeof taSeries.pvi;
|
|
317
|
+
iii: typeof taSeries.iii;
|
|
318
|
+
wad: typeof taSeries.wad;
|
|
319
|
+
wvad: typeof taSeries.wvad;
|
|
320
|
+
cog: typeof taSeries.cog;
|
|
321
|
+
mode: typeof taSeries.mode;
|
|
322
|
+
percentile_linear_interpolation: typeof taSeries.percentile_linear_interpolation;
|
|
323
|
+
percentile_nearest_rank: typeof taSeries.percentile_nearest_rank;
|
|
324
|
+
rci: typeof taSeries.rci;
|
|
325
|
+
};
|
|
326
|
+
};
|
|
327
|
+
/** PineScript `fixnan(source)`: each `na` value becomes the previous non-`na` value.
|
|
328
|
+
* Accepts a Series or a per-bar color array (`undefined` = `na`, as returned by `color.when`). */
|
|
329
|
+
export declare function fixnan(source: Series): Series;
|
|
330
|
+
export declare function fixnan(source: Array<string | undefined>): Array<string | undefined>;
|
|
331
|
+
/** Per-bar color selection: truthy → colorTrue, else colorFalse.
|
|
332
|
+
* colorFalse may be omitted (PineScript `na`): those bars get no color,
|
|
333
|
+
* which bgcolor()/barcolor() skip. */
|
|
334
|
+
declare function colorWhen(cond: Series, colorTrue: string, colorFalse: string): string[];
|
|
335
|
+
declare function colorWhen(cond: Series, colorTrue: string, colorFalse?: string): Array<string | undefined>;
|
|
336
|
+
/** color.* plus `when` — per-bar conditional colors for plot()/fill()/bgcolor()/barcolor(). */
|
|
337
|
+
export declare const color: {
|
|
338
|
+
new: typeof colorCore.new_color;
|
|
339
|
+
when: typeof colorWhen;
|
|
340
|
+
rgb(red: import("../index.js").simple_int, green: import("../index.js").simple_int, blue: import("../index.js").simple_int, transp?: import("../index.js").simple_float): string;
|
|
341
|
+
from_hex(hex: string, transp?: import("../index.js").simple_float): string;
|
|
342
|
+
new_color(baseColor: import("../types/index.js").color, transp: import("../index.js").simple_float): string;
|
|
343
|
+
r(clr: import("../types/index.js").color): import("../index.js").int;
|
|
344
|
+
g(clr: import("../types/index.js").color): import("../index.js").int;
|
|
345
|
+
b(clr: import("../types/index.js").color): import("../index.js").int;
|
|
346
|
+
t(clr: import("../types/index.js").color): import("../index.js").float;
|
|
347
|
+
from_gradient(value: import("../index.js").float, bottom_value: import("../index.js").float, top_value: import("../index.js").float, bottom_color: import("../types/index.js").color, top_color: import("../types/index.js").color): string;
|
|
348
|
+
aqua: "#00BCD4";
|
|
349
|
+
black: "#363A45";
|
|
350
|
+
blue: "#2962FF";
|
|
351
|
+
fuchsia: "#E040FB";
|
|
352
|
+
gray: "#787B86";
|
|
353
|
+
green: "#4CAF50";
|
|
354
|
+
lime: "#00E676";
|
|
355
|
+
maroon: "#880E4F";
|
|
356
|
+
navy: "#311B92";
|
|
357
|
+
olive: "#808000";
|
|
358
|
+
orange: "#FF9800";
|
|
359
|
+
purple: "#9C27B0";
|
|
360
|
+
red: "#F23645";
|
|
361
|
+
silver: "#B2B5BE";
|
|
362
|
+
teal: "#089981";
|
|
363
|
+
white: "#FFFFFF";
|
|
364
|
+
yellow: "#FDD835";
|
|
365
|
+
};
|
|
366
|
+
export interface ScriptPlotOptions {
|
|
367
|
+
/** Static color, or a per-bar color array from color.when(). */
|
|
368
|
+
color?: string | string[];
|
|
369
|
+
linewidth?: number;
|
|
370
|
+
style?: PlotConfig['style'];
|
|
371
|
+
/** Line style (PineScript `linestyle`); default solid. A constant or an input value, not per bar. */
|
|
372
|
+
linestyle?: PlotConfig['linestyle'];
|
|
373
|
+
display?: PlotConfig['display'];
|
|
374
|
+
histbase?: number;
|
|
375
|
+
/** Draw on the main chart pane even when the script is not an overlay (PineScript `force_overlay`); default false. */
|
|
376
|
+
force_overlay?: boolean;
|
|
377
|
+
}
|
|
378
|
+
/** PineScript `plot()` — declares the plot and supplies its data in one call. */
|
|
379
|
+
declare function plotImpl(series: Series, title?: string, options?: ScriptPlotOptions): PlotHandle;
|
|
380
|
+
/**
|
|
381
|
+
* PineScript `plot()`, with the `plot.style_*` and `plot.linestyle_*` constants:
|
|
382
|
+
* `plot(src, 'Level', { style: plot.style_stepline, linestyle: plot.linestyle_dashed })`.
|
|
383
|
+
*/
|
|
384
|
+
export declare const plot: typeof plotImpl & {
|
|
385
|
+
readonly style_line: "line";
|
|
386
|
+
readonly style_linebr: "linebr";
|
|
387
|
+
readonly style_stepline: "stepline";
|
|
388
|
+
readonly style_steplinebr: "steplinebr";
|
|
389
|
+
readonly style_stepline_diamond: "stepline_diamond";
|
|
390
|
+
readonly style_histogram: "histogram";
|
|
391
|
+
readonly style_columns: "columns";
|
|
392
|
+
readonly style_area: "area";
|
|
393
|
+
readonly style_areabr: "areabr";
|
|
394
|
+
readonly style_circles: "circles";
|
|
395
|
+
readonly style_cross: "cross";
|
|
396
|
+
readonly linestyle_solid: "solid";
|
|
397
|
+
readonly linestyle_dotted: "dotted";
|
|
398
|
+
readonly linestyle_dashed: "dashed";
|
|
399
|
+
};
|
|
400
|
+
export interface ScriptHLineOptions {
|
|
401
|
+
color?: string;
|
|
402
|
+
/** Line style; default dashed (PineScript). */
|
|
403
|
+
linestyle?: HLineConfig['linestyle'];
|
|
404
|
+
linewidth?: number;
|
|
405
|
+
}
|
|
406
|
+
/** PineScript `hline()` — a static horizontal level. Default line style: dashed (PineScript). */
|
|
407
|
+
declare function hlineImpl(price: number, title?: string, options?: ScriptHLineOptions): PlotHandle;
|
|
408
|
+
/** PineScript `hline()`, with the `hline.style_*` constants: `hline(0, 'Zero', { linestyle: hline.style_dotted })`. */
|
|
409
|
+
export declare const hline: typeof hlineImpl & {
|
|
410
|
+
readonly style_solid: "solid";
|
|
411
|
+
readonly style_dotted: "dotted";
|
|
412
|
+
readonly style_dashed: "dashed";
|
|
413
|
+
};
|
|
414
|
+
export interface ScriptFillOptions {
|
|
415
|
+
/** Static color, or a per-bar color array from color.when(). */
|
|
416
|
+
color?: string | string[];
|
|
417
|
+
title?: string;
|
|
418
|
+
}
|
|
419
|
+
/** A fill colour argument: a colour, na (null / undefined), or a per-bar array from color.when(). */
|
|
420
|
+
export type ScriptFillColor = string | null | undefined | Array<string | null | undefined>;
|
|
421
|
+
/** A gradient value argument: a number or a Series. */
|
|
422
|
+
export type ScriptFillValue = number | Series;
|
|
423
|
+
/**
|
|
424
|
+
* PineScript `fill()`, with the three PineScript overloads (positional arguments), for two plots or two hlines:
|
|
425
|
+
* - `fill(p1, p2, color?, title?, ...)`
|
|
426
|
+
* - `fill(p1, p2, top_value, bottom_value, top_color, bottom_color, title?, ...)`: gradient fill; values and colours
|
|
427
|
+
* can change per bar (a Series / a color.when() array)
|
|
428
|
+
* - `fill(p1, p2, { color, title })`: options object (oakscriptjs form, kept for existing scripts)
|
|
429
|
+
* Arguments that change only how the chart shows the fill (`editable`, `show_last`, `fillgaps`, `display`) are
|
|
430
|
+
* accepted and not used.
|
|
431
|
+
*/
|
|
432
|
+
export declare function fill(a: PlotHandle, b: PlotHandle, options?: ScriptFillOptions): void;
|
|
433
|
+
export declare function fill(a: PlotHandle, b: PlotHandle, color: ScriptFillColor, title?: string, ...rest: unknown[]): void;
|
|
434
|
+
export declare function fill(a: PlotHandle, b: PlotHandle, top_value: ScriptFillValue, bottom_value: ScriptFillValue, top_color: ScriptFillColor, bottom_color: ScriptFillColor, title?: string, ...rest: unknown[]): void;
|
|
435
|
+
export interface PlotShapeOptions {
|
|
436
|
+
style?: ShapeStyle;
|
|
437
|
+
location?: MarkerLocation;
|
|
438
|
+
color?: string;
|
|
439
|
+
text?: string;
|
|
440
|
+
textcolor?: string;
|
|
441
|
+
size?: MarkerSize;
|
|
442
|
+
/** Display offset in bars (marker shown at bar i + offset). */
|
|
443
|
+
offset?: number;
|
|
444
|
+
/** Hover tooltip (extension over PineScript, for label.new-style ports). */
|
|
445
|
+
tooltip?: string;
|
|
446
|
+
/** Draw on the main chart pane even when the script is not an overlay (PineScript `force_overlay`); default false. */
|
|
447
|
+
force_overlay?: boolean;
|
|
448
|
+
}
|
|
449
|
+
export interface PlotCharOptions extends Omit<PlotShapeOptions, 'style'> {
|
|
450
|
+
char?: string;
|
|
451
|
+
}
|
|
452
|
+
/** PineScript `plotshape()` — a marker on each bar where the condition holds. */
|
|
453
|
+
export declare function plotshape(condition: Series, title?: string, options?: PlotShapeOptions): void;
|
|
454
|
+
/** PineScript `plotchar()` — a character marker on each bar where the condition holds. */
|
|
455
|
+
export declare function plotchar(condition: Series, title?: string, options?: PlotCharOptions): void;
|
|
456
|
+
export interface PlotArrowOptions {
|
|
457
|
+
/** Color of the up arrows: a color or a per-bar array (default #00FF00, PineScript). */
|
|
458
|
+
colorup?: string | Array<string | undefined>;
|
|
459
|
+
/** Color of the down arrows: a color or a per-bar array (default #FF0000, PineScript). */
|
|
460
|
+
colordown?: string | Array<string | undefined>;
|
|
461
|
+
/** Display offset in bars (arrow shown at bar i + offset). */
|
|
462
|
+
offset?: number;
|
|
463
|
+
/** Minimal arrow height in pixels (default 5). */
|
|
464
|
+
minheight?: number;
|
|
465
|
+
/** Maximal arrow height in pixels (default 100). */
|
|
466
|
+
maxheight?: number;
|
|
467
|
+
display?: ArrowConfig['display'];
|
|
468
|
+
/** Draw on the main chart pane even when the script is not an overlay (PineScript `force_overlay`); default false. */
|
|
469
|
+
force_overlay?: boolean;
|
|
470
|
+
}
|
|
471
|
+
/**
|
|
472
|
+
* PineScript `plotarrow()` — an up arrow below the bar for a positive value, a down arrow above the bar for a
|
|
473
|
+
* negative value, nothing for 0 / na. The arrows go to `result.arrows` (value and color per bar), the declaration to
|
|
474
|
+
* `arrowConfig`; the renderer scales the height with the absolute value between minheight and maxheight.
|
|
475
|
+
*/
|
|
476
|
+
export declare function plotarrow(series: Series, title?: string, options?: PlotArrowOptions): void;
|
|
477
|
+
/**
|
|
478
|
+
* PineScript `bgcolor()` — per-bar background color. `force_overlay: true` colors the main chart pane even when the
|
|
479
|
+
* script is not an overlay.
|
|
480
|
+
*/
|
|
481
|
+
export declare function bgcolor(colors: string | Array<string | undefined>, options?: {
|
|
482
|
+
offset?: number;
|
|
483
|
+
title?: string;
|
|
484
|
+
force_overlay?: boolean;
|
|
485
|
+
}): void;
|
|
486
|
+
/** PineScript `barcolor()` — per-bar candle color override. */
|
|
487
|
+
export declare function barcolor(colors: string | Array<string | undefined>, options?: {
|
|
488
|
+
title?: string;
|
|
489
|
+
}): void;
|
|
490
|
+
/**
|
|
491
|
+
* The scalar view of one bar handed to an {@link eachBar} callback.
|
|
492
|
+
* All fields are plain numbers, so native JS operators work.
|
|
493
|
+
*/
|
|
494
|
+
export interface BarContext {
|
|
495
|
+
/** Bar index (PineScript bar_index). */
|
|
496
|
+
readonly i: number;
|
|
497
|
+
/** Total number of bars. */
|
|
498
|
+
readonly n: number;
|
|
499
|
+
/** Time of the current bar. */
|
|
500
|
+
readonly time: number;
|
|
501
|
+
readonly open: number;
|
|
502
|
+
readonly high: number;
|
|
503
|
+
readonly low: number;
|
|
504
|
+
readonly close: number;
|
|
505
|
+
readonly volume: number;
|
|
506
|
+
/** Value of any Series at the current bar minus `offset` (PineScript src[offset]). */
|
|
507
|
+
get(src: Series, offset?: number): number;
|
|
508
|
+
/** This block's own previous output (PineScript self-reference, offset >= 1). */
|
|
509
|
+
prev(offset?: number): number;
|
|
510
|
+
}
|
|
511
|
+
/**
|
|
512
|
+
* Runs the callback once per bar, in order, and collects the returned values
|
|
513
|
+
* into a Series. This is the escape hatch for PineScript logic the vectorized
|
|
514
|
+
* model cannot express:
|
|
515
|
+
*
|
|
516
|
+
* - `var x = 0` / `x := ...` → a plain `let` variable captured by the closure
|
|
517
|
+
* - per-bar `if` / `for` / `while` → native JS statements
|
|
518
|
+
* - `src[k]` → `c.get(src, k)`; self-reference → `c.prev()`
|
|
519
|
+
*
|
|
520
|
+
* Returning a boolean collects 1/0; returning nothing collects na (NaN).
|
|
521
|
+
*
|
|
522
|
+
* ```typescript
|
|
523
|
+
* let dir = 0; // var dir = 0
|
|
524
|
+
* const trend = eachBar((c) => {
|
|
525
|
+
* if (c.close > c.get(close, 1)) dir = 1; // dir := 1
|
|
526
|
+
* else if (c.close < c.get(close, 1)) dir = -1;
|
|
527
|
+
* return dir;
|
|
528
|
+
* });
|
|
529
|
+
* ```
|
|
530
|
+
*/
|
|
531
|
+
export declare function eachBar(fn: (c: BarContext) => number | boolean | void): Series;
|
|
532
|
+
/**
|
|
533
|
+
* Runs the strategy logic once per bar, in order, like {@link eachBar}. On each bar the engine first
|
|
534
|
+
* fills the pending orders (`processBar`), then the callback runs at the bar close (order calls,
|
|
535
|
+
* `strategy.*` variables), then `processClose` runs. A script has one strategy.eachBar() per run.
|
|
536
|
+
* The callback's return values are collected into a Series, as with eachBar().
|
|
537
|
+
*/
|
|
538
|
+
declare function strategyEachBar(fn: (c: BarContext) => number | boolean | void): Series;
|
|
539
|
+
/** Numeric `strategy.*` variables, read from the engine (current bar inside strategy.eachBar()). */
|
|
540
|
+
export type StrategyNumberVariables = {
|
|
541
|
+
readonly [K in StrategyNumberVariable]: number;
|
|
542
|
+
};
|
|
543
|
+
/** Text `strategy.*` variables, read from the engine. */
|
|
544
|
+
export type StrategyTextVariables = {
|
|
545
|
+
readonly [K in StrategyTextVariable]: string;
|
|
546
|
+
};
|
|
547
|
+
/** PineScript `strategy`: the `strategy()` declaration and the `strategy.*` namespace. */
|
|
548
|
+
export type StrategyApi = ((title: string, options?: StrategyOptions) => void) & typeof STRATEGY_CONSTANTS & StrategyNumberVariables & StrategyTextVariables & {
|
|
549
|
+
eachBar: typeof strategyEachBar;
|
|
550
|
+
entry(id: string, direction: StrategyDirection, options?: StrategyEntryOptions): void;
|
|
551
|
+
order(id: string, direction: StrategyDirection, options?: StrategyEntryOptions): void;
|
|
552
|
+
exit(id: string, options?: StrategyExitOptions): void;
|
|
553
|
+
close(id: string, options?: StrategyCloseOptions): void;
|
|
554
|
+
close_all(options?: StrategyCloseAllOptions): void;
|
|
555
|
+
cancel(id: string): void;
|
|
556
|
+
cancel_all(): void;
|
|
557
|
+
/** PineScript `strategy.opentrades.*(index)`: open trade `index` (0 = oldest), undefined when it does not exist. */
|
|
558
|
+
opentrade(index: number): StrategyTrade | undefined;
|
|
559
|
+
/** PineScript `strategy.closedtrades.*(index)`: closed trade `index` (0 = oldest), undefined when it does not exist. */
|
|
560
|
+
closedtrade(index: number): StrategyTrade | undefined;
|
|
561
|
+
default_entry_qty(fill_price: number): number;
|
|
562
|
+
risk: {
|
|
563
|
+
allow_entry_in(direction: StrategyRiskDirection): void;
|
|
564
|
+
max_cons_loss_days(count: number, alert_message?: string): void;
|
|
565
|
+
max_drawdown(value: number, type: StrategyRiskValueType, alert_message?: string): void;
|
|
566
|
+
max_intraday_filled_orders(count: number, alert_message?: string): void;
|
|
567
|
+
max_intraday_loss(value: number, type: StrategyRiskValueType, alert_message?: string): void;
|
|
568
|
+
max_position_size(contracts: number): void;
|
|
569
|
+
};
|
|
570
|
+
};
|
|
571
|
+
/**
|
|
572
|
+
* PineScript `strategy`: call it to declare a strategy, and use its members as the `strategy.*` namespace.
|
|
573
|
+
* OakScriptJS does not fill orders: the host passes an engine in `executeScript(..., { strategyEngine })`,
|
|
574
|
+
* and the order calls and `strategy.*` variables are forwarded to it.
|
|
575
|
+
*
|
|
576
|
+
* ```typescript
|
|
577
|
+
* strategy('MA Cross', { initial_capital: 10000, default_qty_type: strategy.percent_of_equity, default_qty_value: 100 });
|
|
578
|
+
* const up = ta.crossover(ta.sma(close, 9), ta.sma(close, 21));
|
|
579
|
+
* strategy.eachBar((c) => {
|
|
580
|
+
* if (c.get(up) && strategy.position_size === 0) {
|
|
581
|
+
* strategy.entry('L', strategy.long);
|
|
582
|
+
* strategy.exit('X', { from_entry: 'L', stop: c.close * 0.95, limit: c.close * 1.15 });
|
|
583
|
+
* }
|
|
584
|
+
* });
|
|
585
|
+
* ```
|
|
586
|
+
*/
|
|
587
|
+
export declare const strategy: StrategyApi;
|
|
588
|
+
/**
|
|
589
|
+
* What the caller knows about the loaded bars. PineScript reads these values from the chart and
|
|
590
|
+
* the symbol; nothing is fetched here. A script that needs a value the caller did not give throws.
|
|
591
|
+
*/
|
|
592
|
+
export interface ChartContext {
|
|
593
|
+
/** Chart timeframe: "5", "60", "1D", "1W"... (PineScript `timeframe.period`) */
|
|
594
|
+
timeframe?: string;
|
|
595
|
+
/** Exchange time zone: "America/New_York", "Etc/UTC"... (PineScript `syminfo.timezone`) */
|
|
596
|
+
timezone?: string;
|
|
597
|
+
/** Session type of the bars (PineScript `syminfo.session`); default "regular" */
|
|
598
|
+
sessionType?: 'regular' | 'extended';
|
|
599
|
+
/**
|
|
600
|
+
* Session of the loaded bars in the symbol session format: hours ("0930-1600", "1700-1600", "24x7"),
|
|
601
|
+
* corrections (early closes, days off) and holidays. Needed by `time(tf)`, `time_close`,
|
|
602
|
+
* `timeframe.change`, `time_tradingday`, `session.*` and the default anchor of `ta.vwap`.
|
|
603
|
+
*/
|
|
604
|
+
session?: SessionSpec | string;
|
|
605
|
+
/** Regular trading hours when the bars include extended hours (default: `session`); holidays default to `session`'s */
|
|
606
|
+
regularSession?: SessionSpec | string;
|
|
607
|
+
/** Chart symbol as PineScript `syminfo.tickerid` (e.g. "NASDAQ:AAPL"); needed by `request.security(syminfo.tickerid, ...)` */
|
|
608
|
+
tickerid?: string;
|
|
609
|
+
/** Unit of `Bar.time`: 's' (default, as lightweight-charts) or 'ms'. PineScript times are in ms. */
|
|
610
|
+
timeUnit?: 's' | 'ms';
|
|
611
|
+
/** Minimum price move of the symbol (PineScript `syminfo.mintick`), e.g. 0.01; used by `math.round_to_mintick` */
|
|
612
|
+
mintick?: number;
|
|
613
|
+
/** Currency value of one point of price move for one contract (PineScript `syminfo.pointvalue`); 1 for stocks */
|
|
614
|
+
pointvalue?: number;
|
|
615
|
+
/** Smallest tradable quantity (PineScript `syminfo.mincontract`); 1 for whole shares */
|
|
616
|
+
mincontract?: number;
|
|
617
|
+
/**
|
|
618
|
+
* The last bar is closed (`barstate.isconfirmed` on the last bar). Default false: PineScript treats the last bar
|
|
619
|
+
* of the data as not confirmed until the data feed closes it.
|
|
620
|
+
*/
|
|
621
|
+
lastBarConfirmed?: boolean;
|
|
622
|
+
/** The last bar receives live updates (`barstate.isrealtime`); default false (a calculation on history). */
|
|
623
|
+
realtime?: boolean;
|
|
624
|
+
/** On a realtime last bar: this run is the first update of the bar (`barstate.isnew`); default true. */
|
|
625
|
+
lastBarNew?: boolean;
|
|
626
|
+
}
|
|
627
|
+
/**
|
|
628
|
+
* PineScript `timeframe.*`: the chart timeframe variables (from the chart context), and
|
|
629
|
+
* `in_seconds(timeframe?)`, `from_seconds(seconds)`.
|
|
630
|
+
*/
|
|
631
|
+
export declare const timeframe: {
|
|
632
|
+
period: string;
|
|
633
|
+
main_period: string;
|
|
634
|
+
multiplier: number;
|
|
635
|
+
isintraday: boolean;
|
|
636
|
+
isdaily: boolean;
|
|
637
|
+
isweekly: boolean;
|
|
638
|
+
ismonthly: boolean;
|
|
639
|
+
isminutes: boolean;
|
|
640
|
+
isseconds: boolean;
|
|
641
|
+
isticks: boolean;
|
|
642
|
+
isdwm: boolean;
|
|
643
|
+
/** PineScript `timeframe.change(tf)`: 1 on bars that open a new `tf` period (0 on the first bar). */
|
|
644
|
+
change(tf: string): Series;
|
|
645
|
+
/** Seconds in `timeframe`; without it (or with "") the chart timeframe, as in PineScript. */
|
|
646
|
+
in_seconds(tf?: string): number;
|
|
647
|
+
from_seconds(seconds: import("../index.js").int): import("../index.js").simple_string;
|
|
648
|
+
info(timeframe: import("../index.js").simple_string): timeframeCore.TimeframeInfo;
|
|
649
|
+
};
|
|
650
|
+
/**
|
|
651
|
+
* PineScript `syminfo.timezone`, `syminfo.tickerid`, `syminfo.session` (session type), `syminfo.mintick`,
|
|
652
|
+
* `syminfo.pointvalue` and `syminfo.mincontract`, from the chart context.
|
|
653
|
+
*/
|
|
654
|
+
export declare const syminfo: {
|
|
655
|
+
readonly mintick: number;
|
|
656
|
+
readonly pointvalue: number;
|
|
657
|
+
readonly mincontract: number;
|
|
658
|
+
readonly timezone: string;
|
|
659
|
+
readonly tickerid: string;
|
|
660
|
+
readonly session: string;
|
|
661
|
+
};
|
|
662
|
+
/** A calendar function: `(time, timezone?)` on a UNIX time or on a Series of times. */
|
|
663
|
+
interface CalendarFunction {
|
|
664
|
+
(time: number, timezone?: string): number;
|
|
665
|
+
(time: Series, timezone?: string): Series;
|
|
666
|
+
}
|
|
667
|
+
/** PineScript `year(time, timezone?)`; the default time zone is the exchange time zone. */
|
|
668
|
+
export declare const year: CalendarFunction;
|
|
669
|
+
/** PineScript `month(time, timezone?)`; the default time zone is the exchange time zone. */
|
|
670
|
+
export declare const month: CalendarFunction;
|
|
671
|
+
/** PineScript `weekofyear(time, timezone?)`; the default time zone is the exchange time zone. */
|
|
672
|
+
export declare const weekofyear: CalendarFunction;
|
|
673
|
+
/** PineScript `dayofmonth(time, timezone?)`; the default time zone is the exchange time zone. */
|
|
674
|
+
export declare const dayofmonth: CalendarFunction;
|
|
675
|
+
/** PineScript `dayofweek(time, timezone?)`; the default time zone is the exchange time zone. */
|
|
676
|
+
export declare const dayofweek: CalendarFunction;
|
|
677
|
+
/** PineScript `hour(time, timezone?)`; the default time zone is the exchange time zone. */
|
|
678
|
+
export declare const hour: CalendarFunction;
|
|
679
|
+
/** PineScript `minute(time, timezone?)`; the default time zone is the exchange time zone. */
|
|
680
|
+
export declare const minute: CalendarFunction;
|
|
681
|
+
/** PineScript `second(time, timezone?)`; the default time zone is the exchange time zone. */
|
|
682
|
+
export declare const second: CalendarFunction;
|
|
683
|
+
/**
|
|
684
|
+
* PineScript `timestamp`: date string (GMT+0 by default), `(timezone, year, month, day, ...)`, or
|
|
685
|
+
* `(year, month, day, ...)` in the exchange time zone.
|
|
686
|
+
*/
|
|
687
|
+
export declare function timestamp(dateString: string): number;
|
|
688
|
+
export declare function timestamp(timezone: string, year: number, month: number, day: number, hour?: number, minute?: number, second?: number): number;
|
|
689
|
+
export declare function timestamp(year: number, month: number, day: number, hour?: number, minute?: number, second?: number): number;
|
|
690
|
+
/** Session test of PineScript `time(timeframe, session, timezone)`; the default time zone is the exchange time zone. */
|
|
691
|
+
export declare function inSession(time: number, session: string, timezone?: string): boolean;
|
|
692
|
+
/** PineScript `str.*`; `format_time` and the dates of `format` use the exchange time zone by default. */
|
|
693
|
+
export declare const str: {
|
|
694
|
+
format_time(time: number, format?: string, timezone?: string): string;
|
|
695
|
+
format(pattern: string, ...args: unknown[]): string;
|
|
696
|
+
length(str: import("../index.js").simple_string): import("../index.js").int;
|
|
697
|
+
tostring(value: any, format?: import("../index.js").simple_string): string;
|
|
698
|
+
tonumber(str: import("../index.js").simple_string): import("../index.js").float | null;
|
|
699
|
+
substring(str: import("../index.js").simple_string, begin: import("../index.js").simple_int, end?: import("../index.js").simple_int): string;
|
|
700
|
+
upper(str: import("../index.js").simple_string): string;
|
|
701
|
+
lower(str: import("../index.js").simple_string): string;
|
|
702
|
+
contains(source: import("../index.js").simple_string, str: import("../index.js").simple_string): import("../index.js").bool;
|
|
703
|
+
pos(source: import("../index.js").simple_string, str: import("../index.js").simple_string): import("../index.js").int;
|
|
704
|
+
replace(source: import("../index.js").simple_string, target: import("../index.js").simple_string, replacement: import("../index.js").simple_string, occurrence?: import("../index.js").simple_int): string;
|
|
705
|
+
replace_all(source: import("../index.js").simple_string, target: import("../index.js").simple_string, replacement: import("../index.js").simple_string): string;
|
|
706
|
+
split(str: import("../index.js").simple_string, separator: import("../index.js").simple_string): string[];
|
|
707
|
+
concat(...strings: import("../index.js").simple_string[]): string;
|
|
708
|
+
startswith(source: import("../index.js").simple_string, str: import("../index.js").simple_string): import("../index.js").bool;
|
|
709
|
+
endswith(source: import("../index.js").simple_string, str: import("../index.js").simple_string): import("../index.js").bool;
|
|
710
|
+
charAt(str: import("../index.js").simple_string, pos: import("../index.js").simple_int): string;
|
|
711
|
+
trim(str: import("../index.js").simple_string): string;
|
|
712
|
+
trimLeft(str: import("../index.js").simple_string): string;
|
|
713
|
+
trimRight(str: import("../index.js").simple_string): string;
|
|
714
|
+
match(source: import("../index.js").simple_string, regex: import("../index.js").simple_string): import("../index.js").bool;
|
|
715
|
+
repeat(source: import("../index.js").simple_string, count: import("../index.js").simple_int, separator?: import("../index.js").simple_string): string | null;
|
|
716
|
+
};
|
|
717
|
+
declare function timeFunction(tf?: string, session?: string, timezone?: string): Series;
|
|
718
|
+
declare function timeCloseFunction(tf?: string, session?: string, timezone?: string): Series;
|
|
719
|
+
/**
|
|
720
|
+
* PineScript `time`: the bar open time in ms (a Series), and `time(timeframe?, session?, timezone?)`:
|
|
721
|
+
* the open time of the `timeframe` period that contains the bar, `na` outside `session`.
|
|
722
|
+
*/
|
|
723
|
+
export declare const time: Series & typeof timeFunction;
|
|
724
|
+
/**
|
|
725
|
+
* PineScript `time_close`: the bar close time in ms (a Series), and `time_close(timeframe?, session?, timezone?)`.
|
|
726
|
+
* Needs the chart timeframe and session.
|
|
727
|
+
*/
|
|
728
|
+
export declare const time_close: Series & typeof timeCloseFunction;
|
|
729
|
+
/** PineScript `time_tradingday`: 00:00 UTC of the trading day of each bar, in ms. */
|
|
730
|
+
export declare const time_tradingday: Series;
|
|
731
|
+
/**
|
|
732
|
+
* PineScript `barstate.*` (1 / 0 per bar). All bars but the last are confirmed history bars. The last bar is
|
|
733
|
+
* confirmed only when the host says so (`ChartContext.lastBarConfirmed`, e.g. the closing update of a realtime
|
|
734
|
+
* bar), and is a realtime bar only when it receives live updates (`ChartContext.realtime`); without live updates
|
|
735
|
+
* it is a history bar, as in PineScript.
|
|
736
|
+
* `islastconfirmedhistory` is the last bar when it is confirmed and not realtime, else the bar before it.
|
|
737
|
+
*/
|
|
738
|
+
export declare const barstate: {
|
|
739
|
+
readonly isfirst: Series;
|
|
740
|
+
readonly islast: Series;
|
|
741
|
+
readonly isconfirmed: Series;
|
|
742
|
+
readonly isrealtime: Series;
|
|
743
|
+
readonly ishistory: Series;
|
|
744
|
+
readonly isnew: Series;
|
|
745
|
+
readonly islastconfirmedhistory: Series;
|
|
746
|
+
};
|
|
747
|
+
/**
|
|
748
|
+
* PineScript `session.*` (1 / 0 per bar) and the constants `session.regular` / `session.extended`.
|
|
749
|
+
* First and last bars are per session period; market / pre / post market use the regular hours.
|
|
750
|
+
*/
|
|
751
|
+
export declare const session: {
|
|
752
|
+
regular: string;
|
|
753
|
+
extended: string;
|
|
754
|
+
readonly isfirstbar: Series;
|
|
755
|
+
readonly islastbar: Series;
|
|
756
|
+
readonly ismarket: Series;
|
|
757
|
+
readonly ispremarket: Series;
|
|
758
|
+
readonly ispostmarket: Series;
|
|
759
|
+
readonly isfirstbar_regular: Series;
|
|
760
|
+
readonly islastbar_regular: Series;
|
|
761
|
+
};
|
|
762
|
+
/** PineScript `barmerge.*` constants of `request.security`. */
|
|
763
|
+
export declare const barmerge: {
|
|
764
|
+
readonly gaps_on: "gaps_on";
|
|
765
|
+
readonly gaps_off: "gaps_off";
|
|
766
|
+
readonly lookahead_on: "lookahead_on";
|
|
767
|
+
readonly lookahead_off: "lookahead_off";
|
|
768
|
+
};
|
|
769
|
+
/** PineScript `ticker.heikinashi(symbol)` / `ticker.standard(symbol)` for the chart symbol. */
|
|
770
|
+
export declare const ticker: {
|
|
771
|
+
heikinashi(symbol: string): string;
|
|
772
|
+
standard(symbol: string): string;
|
|
773
|
+
};
|
|
774
|
+
/** What an expression of `request.security` may return. */
|
|
775
|
+
export type SecurityValue = Series | number | boolean | Array<Series | number | boolean>;
|
|
776
|
+
/**
|
|
777
|
+
* PineScript `request.security` for the chart symbol (`syminfo.tickerid`, `""`, `ticker.heikinashi(...)`,
|
|
778
|
+
* `ticker.standard(...)`) and a timeframe equal to or higher than the chart's. The higher-timeframe bars are
|
|
779
|
+
* built by grouping the chart bars, and `expression` runs on them (its `ta.*` calls, tuples and `timeframe.*`
|
|
780
|
+
* see the higher timeframe). Other symbols need external data and throw; a lower timeframe throws.
|
|
781
|
+
*
|
|
782
|
+
* PineScript rules: lookahead off shows a period's value from the
|
|
783
|
+
* bar that completes it; lookahead on from its first bar; gaps on keeps only the bar where the value appears.
|
|
784
|
+
* Built bars can differ from the exchange's bars (official open / close, volume).
|
|
785
|
+
*/
|
|
786
|
+
declare function security<T extends SecurityValue>(symbol: string, timeframe: string, expression: () => T, gaps?: string, lookahead?: string): T extends unknown[] ? Series[] : Series;
|
|
787
|
+
/** PineScript `request.*`: `security` for the chart symbol (issue #101). */
|
|
788
|
+
export declare const request: {
|
|
789
|
+
security: typeof security;
|
|
790
|
+
};
|
|
791
|
+
/** PineScript `line.*`; `line.all` lists the live lines in creation order. */
|
|
792
|
+
export declare const line: {
|
|
793
|
+
all: import("../index.js").Line[];
|
|
794
|
+
new_line(first_point: ChartPoint, second_point: ChartPoint, xloc?: "bar_index" | "bar_time", extend?: "none" | "left" | "right" | "both", lineColor?: import("../types/index.js").color, style?: "solid" | "dotted" | "dashed" | "arrow_left" | "arrow_right" | "arrow_both", width?: number, force_overlay?: boolean): import("../index.js").Line;
|
|
795
|
+
new_line(x1: number, y1: number, x2: number, y2: number, xloc?: "bar_index" | "bar_time", extend?: "none" | "left" | "right" | "both", lineColor?: import("../types/index.js").color, style?: "solid" | "dotted" | "dashed" | "arrow_left" | "arrow_right" | "arrow_both", width?: number, force_overlay?: boolean): import("../index.js").Line;
|
|
796
|
+
get_price(id: import("../index.js").Line, x: number): number;
|
|
797
|
+
get_x1(id: import("../index.js").Line): number;
|
|
798
|
+
get_x2(id: import("../index.js").Line): number;
|
|
799
|
+
get_y1(id: import("../index.js").Line): number;
|
|
800
|
+
get_y2(id: import("../index.js").Line): number;
|
|
801
|
+
copy(id: import("../index.js").Line): import("../index.js").Line;
|
|
802
|
+
set_x1(id: import("../index.js").Line, x: number): import("../index.js").Line;
|
|
803
|
+
set_x2(id: import("../index.js").Line, x: number): import("../index.js").Line;
|
|
804
|
+
set_y1(id: import("../index.js").Line, y: number): import("../index.js").Line;
|
|
805
|
+
set_y2(id: import("../index.js").Line, y: number): import("../index.js").Line;
|
|
806
|
+
set_xy1(id: import("../index.js").Line, x: number, y: number): import("../index.js").Line;
|
|
807
|
+
set_xy2(id: import("../index.js").Line, x: number, y: number): import("../index.js").Line;
|
|
808
|
+
set_xloc(id: import("../index.js").Line, x1: number, x2: number, xloc: "bar_index" | "bar_time"): import("../index.js").Line;
|
|
809
|
+
set_extend(id: import("../index.js").Line, extend: "none" | "left" | "right" | "both"): import("../index.js").Line;
|
|
810
|
+
set_color(id: import("../index.js").Line, lineColor: import("../types/index.js").color): import("../index.js").Line;
|
|
811
|
+
set_style(id: import("../index.js").Line, style: "solid" | "dotted" | "dashed" | "arrow_left" | "arrow_right" | "arrow_both"): import("../index.js").Line;
|
|
812
|
+
set_width(id: import("../index.js").Line, width: number): import("../index.js").Line;
|
|
813
|
+
delete_line(id: import("../index.js").Line): void;
|
|
814
|
+
set_first_point(id: import("../index.js").Line, point: ChartPoint): import("../index.js").Line;
|
|
815
|
+
set_second_point(id: import("../index.js").Line, point: ChartPoint): import("../index.js").Line;
|
|
816
|
+
new: typeof lineCore.new_line;
|
|
817
|
+
delete: typeof lineCore.delete_line;
|
|
818
|
+
};
|
|
819
|
+
/** PineScript `label.*`; `label.all` lists the live labels in creation order. */
|
|
820
|
+
export declare const label: {
|
|
821
|
+
all: import("../index.js").Label[];
|
|
822
|
+
new_label(point: ChartPoint, text?: string, xloc?: "bar_index" | "bar_time", yloc?: "price" | "abovebar" | "belowbar", labelColor?: import("../types/index.js").color, style?: "none" | "xcross" | "cross" | "triangleup" | "triangledown" | "flag" | "circle" | "arrowup" | "arrowdown" | "label_up" | "label_down" | "label_left" | "label_right" | "label_lower_left" | "label_lower_right" | "label_upper_left" | "label_upper_right" | "label_center" | "square" | "diamond" | "text_outline", textcolor?: import("../types/index.js").color, size?: string | number, textalign?: "left" | "center" | "right", tooltip?: string, text_font_family?: "default" | "monospace", force_overlay?: boolean, text_formatting?: number): import("../index.js").Label;
|
|
823
|
+
new_label(x: number, y: number, text?: string, xloc?: "bar_index" | "bar_time", yloc?: "price" | "abovebar" | "belowbar", labelColor?: import("../types/index.js").color, style?: "none" | "xcross" | "cross" | "triangleup" | "triangledown" | "flag" | "circle" | "arrowup" | "arrowdown" | "label_up" | "label_down" | "label_left" | "label_right" | "label_lower_left" | "label_lower_right" | "label_upper_left" | "label_upper_right" | "label_center" | "square" | "diamond" | "text_outline", textcolor?: import("../types/index.js").color, size?: string | number, textalign?: "left" | "center" | "right", tooltip?: string, text_font_family?: "default" | "monospace", force_overlay?: boolean, text_formatting?: number): import("../index.js").Label;
|
|
824
|
+
get_x(id: import("../index.js").Label): number;
|
|
825
|
+
get_y(id: import("../index.js").Label): number;
|
|
826
|
+
get_text(id: import("../index.js").Label): string | undefined;
|
|
827
|
+
copy(id: import("../index.js").Label): import("../index.js").Label;
|
|
828
|
+
set_x(id: import("../index.js").Label, x: number): import("../index.js").Label;
|
|
829
|
+
set_y(id: import("../index.js").Label, y: number): import("../index.js").Label;
|
|
830
|
+
set_xy(id: import("../index.js").Label, x: number, y: number): import("../index.js").Label;
|
|
831
|
+
set_xloc(id: import("../index.js").Label, x: number, xloc: "bar_index" | "bar_time"): import("../index.js").Label;
|
|
832
|
+
set_yloc(id: import("../index.js").Label, yloc: "price" | "abovebar" | "belowbar"): import("../index.js").Label;
|
|
833
|
+
set_text(id: import("../index.js").Label, text: string): import("../index.js").Label;
|
|
834
|
+
set_tooltip(id: import("../index.js").Label, tooltip: string): import("../index.js").Label;
|
|
835
|
+
set_color(id: import("../index.js").Label, labelColor: import("../types/index.js").color): import("../index.js").Label;
|
|
836
|
+
set_textcolor(id: import("../index.js").Label, textColor: import("../types/index.js").color): import("../index.js").Label;
|
|
837
|
+
set_style(id: import("../index.js").Label, style: "none" | "xcross" | "cross" | "triangleup" | "triangledown" | "flag" | "circle" | "arrowup" | "arrowdown" | "label_up" | "label_down" | "label_left" | "label_right" | "label_lower_left" | "label_lower_right" | "label_upper_left" | "label_upper_right" | "label_center" | "square" | "diamond" | "text_outline"): import("../index.js").Label;
|
|
838
|
+
set_size(id: import("../index.js").Label, size: string | number): import("../index.js").Label;
|
|
839
|
+
set_textalign(id: import("../index.js").Label, align: "left" | "center" | "right"): import("../index.js").Label;
|
|
840
|
+
set_text_font_family(id: import("../index.js").Label, font: "default" | "monospace"): import("../index.js").Label;
|
|
841
|
+
delete_label(id: import("../index.js").Label): void;
|
|
842
|
+
set_point(id: import("../index.js").Label, point: ChartPoint): import("../index.js").Label;
|
|
843
|
+
set_text_formatting(id: import("../index.js").Label, formatting: number): import("../index.js").Label;
|
|
844
|
+
new: typeof labelCore.new_label;
|
|
845
|
+
delete: typeof labelCore.delete_label;
|
|
846
|
+
};
|
|
847
|
+
/** PineScript `box.*`; `box.all` lists the live boxes in creation order. */
|
|
848
|
+
export declare const box: {
|
|
849
|
+
all: import("../index.js").Box[];
|
|
850
|
+
new_box(top_left: ChartPoint, bottom_right: ChartPoint, border_color?: import("../types/index.js").color, border_width?: number, border_style?: "solid" | "dotted" | "dashed", extend?: "none" | "left" | "right" | "both", xloc?: "bar_index" | "bar_time", bgcolor?: import("../types/index.js").color, text?: string, text_size?: string | number, text_color?: import("../types/index.js").color, text_halign?: "left" | "center" | "right", text_valign?: "top" | "center" | "bottom", text_wrap?: "none" | "auto", text_font_family?: "default" | "monospace", force_overlay?: boolean, text_formatting?: number): import("../index.js").Box;
|
|
851
|
+
new_box(left: number, top: number, right: number, bottom: number, border_color?: import("../types/index.js").color, border_width?: number, border_style?: "solid" | "dotted" | "dashed", extend?: "none" | "left" | "right" | "both", xloc?: "bar_index" | "bar_time", bgcolor?: import("../types/index.js").color, text?: string, text_size?: string | number, text_color?: import("../types/index.js").color, text_halign?: "left" | "center" | "right", text_valign?: "top" | "center" | "bottom", text_wrap?: "none" | "auto", text_font_family?: "default" | "monospace", force_overlay?: boolean, text_formatting?: number): import("../index.js").Box;
|
|
852
|
+
get_left(id: import("../index.js").Box): number;
|
|
853
|
+
get_right(id: import("../index.js").Box): number;
|
|
854
|
+
get_top(id: import("../index.js").Box): number;
|
|
855
|
+
get_bottom(id: import("../index.js").Box): number;
|
|
856
|
+
copy(id: import("../index.js").Box): import("../index.js").Box;
|
|
857
|
+
set_left(id: import("../index.js").Box, left: number): import("../index.js").Box;
|
|
858
|
+
set_right(id: import("../index.js").Box, right: number): import("../index.js").Box;
|
|
859
|
+
set_top(id: import("../index.js").Box, top: number): import("../index.js").Box;
|
|
860
|
+
set_bottom(id: import("../index.js").Box, bottom: number): import("../index.js").Box;
|
|
861
|
+
set_lefttop(id: import("../index.js").Box, left: number, top: number): import("../index.js").Box;
|
|
862
|
+
set_rightbottom(id: import("../index.js").Box, right: number, bottom: number): import("../index.js").Box;
|
|
863
|
+
set_xloc(id: import("../index.js").Box, left: number, right: number, xloc: "bar_index" | "bar_time"): import("../index.js").Box;
|
|
864
|
+
set_extend(id: import("../index.js").Box, extend: "none" | "left" | "right" | "both"): import("../index.js").Box;
|
|
865
|
+
set_border_color(id: import("../index.js").Box, borderColor: import("../types/index.js").color): import("../index.js").Box;
|
|
866
|
+
set_border_width(id: import("../index.js").Box, width: number): import("../index.js").Box;
|
|
867
|
+
set_border_style(id: import("../index.js").Box, style: "solid" | "dotted" | "dashed"): import("../index.js").Box;
|
|
868
|
+
set_bgcolor(id: import("../index.js").Box, bgColor: import("../types/index.js").color): import("../index.js").Box;
|
|
869
|
+
set_text(id: import("../index.js").Box, text: string): import("../index.js").Box;
|
|
870
|
+
set_text_color(id: import("../index.js").Box, textColor: import("../types/index.js").color): import("../index.js").Box;
|
|
871
|
+
set_text_size(id: import("../index.js").Box, size: string | number): import("../index.js").Box;
|
|
872
|
+
set_text_halign(id: import("../index.js").Box, align: "left" | "center" | "right"): import("../index.js").Box;
|
|
873
|
+
set_text_valign(id: import("../index.js").Box, align: "top" | "center" | "bottom"): import("../index.js").Box;
|
|
874
|
+
set_text_wrap(id: import("../index.js").Box, wrap: "none" | "auto"): import("../index.js").Box;
|
|
875
|
+
set_text_font_family(id: import("../index.js").Box, font: "default" | "monospace"): import("../index.js").Box;
|
|
876
|
+
delete_box(id: import("../index.js").Box): void;
|
|
877
|
+
set_top_left_point(id: import("../index.js").Box, point: ChartPoint): import("../index.js").Box;
|
|
878
|
+
set_bottom_right_point(id: import("../index.js").Box, point: ChartPoint): import("../index.js").Box;
|
|
879
|
+
set_text_formatting(id: import("../index.js").Box, formatting: number): import("../index.js").Box;
|
|
880
|
+
new: typeof boxCore.new_box;
|
|
881
|
+
delete: typeof boxCore.delete_box;
|
|
882
|
+
};
|
|
883
|
+
/** PineScript `linefill.*`; `linefill.all` lists the live linefills in creation order. */
|
|
884
|
+
export declare const linefill: {
|
|
885
|
+
all: import("../index.js").Linefill[];
|
|
886
|
+
new_linefill(line1: import("../index.js").Line, line2: import("../index.js").Line, fillColor?: import("../types/index.js").color): import("../index.js").Linefill;
|
|
887
|
+
get_line1(id: import("../index.js").Linefill): import("../index.js").Line;
|
|
888
|
+
get_line2(id: import("../index.js").Linefill): import("../index.js").Line;
|
|
889
|
+
set_color(id: import("../index.js").Linefill, fillColor: import("../types/index.js").color): import("../index.js").Linefill;
|
|
890
|
+
delete_linefill(id: import("../index.js").Linefill): void;
|
|
891
|
+
new: typeof linefillCore.new_linefill;
|
|
892
|
+
delete: typeof linefillCore.delete_linefill;
|
|
893
|
+
};
|
|
894
|
+
/** PineScript `polyline.*`; `polyline.all` lists the live polylines in creation order. */
|
|
895
|
+
export declare const polyline: {
|
|
896
|
+
all: polylineCore.Polyline[];
|
|
897
|
+
new_polyline(points: ChartPoint[], curved?: boolean, closed?: boolean, xloc?: "bar_index" | "bar_time", line_color?: import("../types/index.js").color, fill_color?: import("../types/index.js").color | null, line_style?: "solid" | "dotted" | "dashed", line_width?: number, force_overlay?: boolean): polylineCore.Polyline;
|
|
898
|
+
delete_polyline(id: polylineCore.Polyline): void;
|
|
899
|
+
get_all(): readonly polylineCore.Polyline[];
|
|
900
|
+
clear_all(): void;
|
|
901
|
+
reset_id_counter(): void;
|
|
902
|
+
new: typeof polylineCore.new_polyline;
|
|
903
|
+
delete: typeof polylineCore.delete_polyline;
|
|
904
|
+
};
|
|
905
|
+
/** PineScript `text.format_*` constants. */
|
|
906
|
+
export declare const text: {
|
|
907
|
+
format_none: 0;
|
|
908
|
+
format_bold: 1;
|
|
909
|
+
format_italic: 2;
|
|
910
|
+
};
|
|
911
|
+
/**
|
|
912
|
+
* PineScript `chart.point.*`. `chart.point.now(price?)` is the point of the current bar
|
|
913
|
+
* (index, time, and `price`, default the close), so it runs inside eachBar().
|
|
914
|
+
*/
|
|
915
|
+
export declare const chart: {
|
|
916
|
+
point: {
|
|
917
|
+
now(price?: number): ChartPoint;
|
|
918
|
+
new_point(time: number | null, index: number | null, price: number): ChartPoint;
|
|
919
|
+
from_time(time: number, price: number): ChartPoint;
|
|
920
|
+
from_index(index: number, price: number): ChartPoint;
|
|
921
|
+
copy(point: ChartPoint): ChartPoint;
|
|
922
|
+
new: typeof chartPointCore.new_point;
|
|
923
|
+
};
|
|
924
|
+
};
|
|
925
|
+
/** Wraps a plain value array (e.g. a side output accumulated inside eachBar)
|
|
926
|
+
* into a Series aligned with the current bars. */
|
|
927
|
+
export declare function seriesOf(values: number[]): Series;
|
|
928
|
+
/** PineScript `alertcondition()` — collected for the host's alert engine. */
|
|
929
|
+
export declare function alertcondition(condition: Series, title: string, message?: string): void;
|
|
930
|
+
export { Series, BarData, isNA as na, nz };
|
|
931
|
+
export { STRATEGY_DEFAULTS } from '../strategy/index.js';
|
|
932
|
+
export type { StrategyCloseAllOptions, StrategyCloseOptions, StrategyCommissionType, StrategyDirection, StrategyEngine, StrategyEntryOptions, StrategyExitOptions, StrategyNumberVariable, StrategyOcaType, StrategyOptions, StrategyProperties, StrategyQtyType, StrategyRiskDirection, StrategyRiskRule, StrategyRiskValueType, StrategyTextVariable, StrategyTrade, StrategyVariable, } from '../strategy/index.js';
|
|
933
|
+
/** PineScript `math.*`; `math.round_to_mintick(x)` uses `syminfo.mintick` of the chart context. */
|
|
934
|
+
export declare const math: {
|
|
935
|
+
round_to_mintick: typeof mathCore.round_to_mintick;
|
|
936
|
+
abs(value: Series): Series;
|
|
937
|
+
abs(value: import("../index.js").float): import("../index.js").float;
|
|
938
|
+
ceil(value: Series): Series;
|
|
939
|
+
ceil(value: import("../index.js").float): import("../index.js").int;
|
|
940
|
+
floor(value: Series): Series;
|
|
941
|
+
floor(value: import("../index.js").float): import("../index.js").int;
|
|
942
|
+
round(value: Series, precision?: import("../index.js").int): Series;
|
|
943
|
+
round(value: import("../index.js").float, precision?: import("../index.js").int): import("../index.js").float;
|
|
944
|
+
max(...values: (import("../index.js").float | Series)[]): import("../index.js").float | Series;
|
|
945
|
+
min(...values: (import("../index.js").float | Series)[]): import("../index.js").float | Series;
|
|
946
|
+
avg(...values: (import("../index.js").float | Series)[]): import("../index.js").float | Series;
|
|
947
|
+
sum(source: Series, length: import("../index.js").simple_int): Series;
|
|
948
|
+
sum(source: import("../index.js").series_float, length: import("../index.js").simple_int): import("../index.js").series_float;
|
|
949
|
+
sqrt(value: Series): Series;
|
|
950
|
+
sqrt(value: import("../index.js").float): import("../index.js").float;
|
|
951
|
+
pow(base: Series, exponent: import("../index.js").float): Series;
|
|
952
|
+
pow(base: import("../index.js").float, exponent: Series): Series;
|
|
953
|
+
pow(base: Series, exponent: Series): Series;
|
|
954
|
+
pow(base: import("../index.js").float, exponent: import("../index.js").float): import("../index.js").float;
|
|
955
|
+
exp(value: Series): Series;
|
|
956
|
+
exp(value: import("../index.js").float): import("../index.js").float;
|
|
957
|
+
log(value: Series): Series;
|
|
958
|
+
log(value: import("../index.js").float): import("../index.js").float;
|
|
959
|
+
log10(value: Series): Series;
|
|
960
|
+
log10(value: import("../index.js").float): import("../index.js").float;
|
|
961
|
+
sin(value: Series): Series;
|
|
962
|
+
sin(value: import("../index.js").float): import("../index.js").float;
|
|
963
|
+
cos(value: Series): Series;
|
|
964
|
+
cos(value: import("../index.js").float): import("../index.js").float;
|
|
965
|
+
tan(value: Series): Series;
|
|
966
|
+
tan(value: import("../index.js").float): import("../index.js").float;
|
|
967
|
+
asin(value: Series): Series;
|
|
968
|
+
asin(value: import("../index.js").float): import("../index.js").float;
|
|
969
|
+
acos(value: Series): Series;
|
|
970
|
+
acos(value: import("../index.js").float): import("../index.js").float;
|
|
971
|
+
atan(value: Series): Series;
|
|
972
|
+
atan(value: import("../index.js").float): import("../index.js").float;
|
|
973
|
+
toradians(degrees: Series): Series;
|
|
974
|
+
toradians(degrees: import("../index.js").float): import("../index.js").float;
|
|
975
|
+
todegrees(radians: Series): Series;
|
|
976
|
+
todegrees(radians: import("../index.js").float): import("../index.js").float;
|
|
977
|
+
random(min?: import("../index.js").float, max?: import("../index.js").float, _seed?: import("../index.js").int): import("../index.js").float;
|
|
978
|
+
sign(value: Series): Series;
|
|
979
|
+
sign(value: import("../index.js").float): import("../index.js").int;
|
|
980
|
+
pi: number;
|
|
981
|
+
e: number;
|
|
982
|
+
phi: 1.618033988749895;
|
|
983
|
+
rphi: 0.618033988749895;
|
|
984
|
+
};
|
|
985
|
+
export * as compare from '../compare/index.js';
|
|
986
|
+
export type { Bar, IndicatorResult, TimeValue, InputConfig, PlotConfig, HLineConfig, FillConfig, ShapeConfig, ArrowConfig, BarColorConfig, MarkerData, ArrowData, BarColorData, MarkerLocation, MarkerSize, ShapeStyle, };
|
|
987
|
+
//# sourceMappingURL=index.d.ts.map
|