oakscriptjs 0.8.0 → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/array/index.d.ts.map +1 -1
- package/dist/callsite/index.d.ts +1 -0
- package/dist/callsite/index.d.ts.map +1 -1
- package/dist/color/index.d.ts +4 -4
- package/dist/color/index.d.ts.map +1 -1
- package/dist/index.cjs +95 -132
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +95 -132
- package/dist/runtime/index.cjs +1 -1
- package/dist/runtime/index.mjs +1 -1
- package/dist/runtime/types.d.ts +17 -1
- package/dist/runtime/types.d.ts.map +1 -1
- package/dist/script/index.cjs +185 -138
- package/dist/script/index.d.ts +67 -16
- package/dist/script/index.d.ts.map +1 -1
- package/dist/script/index.mjs +185 -138
- package/dist/strategy/index.d.ts.map +1 -1
- package/dist/ta/index.d.ts.map +1 -1
- package/dist/types/metadata.d.ts +9 -1
- package/dist/types/metadata.d.ts.map +1 -1
- package/dist/utils/index.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -125,7 +125,7 @@ function sma(source, length2) {
|
|
|
125
125
|
const window = [];
|
|
126
126
|
for (let i = 0; i < source.length; i++) {
|
|
127
127
|
const v = source[i];
|
|
128
|
-
if (v !== void 0 && v !== null &&
|
|
128
|
+
if (v !== void 0 && v !== null && Number.isFinite(v)) {
|
|
129
129
|
window.push(v);
|
|
130
130
|
if (window.length > len) window.shift();
|
|
131
131
|
}
|
|
@@ -469,7 +469,7 @@ function lowest(source, length2) {
|
|
|
469
469
|
function cum(source) {
|
|
470
470
|
let sum4 = 0;
|
|
471
471
|
return source.map((v) => {
|
|
472
|
-
if (Number.
|
|
472
|
+
if (!Number.isFinite(v)) return NaN;
|
|
473
473
|
sum4 += v;
|
|
474
474
|
return sum4;
|
|
475
475
|
});
|
|
@@ -487,41 +487,24 @@ function cross(source1, source2) {
|
|
|
487
487
|
}
|
|
488
488
|
return result;
|
|
489
489
|
}
|
|
490
|
-
function
|
|
490
|
+
function monotonic(source, length2, step) {
|
|
491
491
|
const result = [];
|
|
492
|
+
const values2 = [];
|
|
492
493
|
for (let i = 0; i < source.length; i++) {
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
isRising = false;
|
|
500
|
-
break;
|
|
501
|
-
}
|
|
502
|
-
}
|
|
503
|
-
result.push(isRising);
|
|
504
|
-
}
|
|
494
|
+
const v = source[i];
|
|
495
|
+
if (!Number.isNaN(v)) values2.push(v);
|
|
496
|
+
const n = values2.length;
|
|
497
|
+
let ok = n > length2;
|
|
498
|
+
for (let j = 1; ok && j <= length2; j++) ok = step(values2[n - j], values2[n - j - 1]);
|
|
499
|
+
result.push(ok);
|
|
505
500
|
}
|
|
506
501
|
return result;
|
|
507
502
|
}
|
|
503
|
+
function rising(source, length2) {
|
|
504
|
+
return monotonic(source, length2, gt);
|
|
505
|
+
}
|
|
508
506
|
function falling(source, length2) {
|
|
509
|
-
|
|
510
|
-
for (let i = 0; i < source.length; i++) {
|
|
511
|
-
if (i < length2) {
|
|
512
|
-
result.push(false);
|
|
513
|
-
} else {
|
|
514
|
-
let isFalling = true;
|
|
515
|
-
for (let j = 1; j <= length2; j++) {
|
|
516
|
-
if (source[i - j + 1] >= source[i - j]) {
|
|
517
|
-
isFalling = false;
|
|
518
|
-
break;
|
|
519
|
-
}
|
|
520
|
-
}
|
|
521
|
-
result.push(isFalling);
|
|
522
|
-
}
|
|
523
|
-
}
|
|
524
|
-
return result;
|
|
507
|
+
return monotonic(source, length2, lt);
|
|
525
508
|
}
|
|
526
509
|
function roc(source, length2) {
|
|
527
510
|
const result = [];
|
|
@@ -745,33 +728,16 @@ function correlation(source1, source2, length2) {
|
|
|
745
728
|
function percentrank(source, length2) {
|
|
746
729
|
const result = [];
|
|
747
730
|
for (let i = 0; i < source.length; i++) {
|
|
748
|
-
|
|
731
|
+
const currentValue = source[i];
|
|
732
|
+
if (i < length2 || Number.isNaN(currentValue)) {
|
|
749
733
|
result.push(NaN);
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
let hasNaN = false;
|
|
756
|
-
for (let j = 1; j <= length2; j++) {
|
|
757
|
-
if (isNaN(source[i - j])) {
|
|
758
|
-
hasNaN = true;
|
|
759
|
-
break;
|
|
760
|
-
}
|
|
761
|
-
}
|
|
762
|
-
if (hasNaN) {
|
|
763
|
-
result.push(NaN);
|
|
764
|
-
} else {
|
|
765
|
-
const currentValue = source[i];
|
|
766
|
-
let countLessOrEqual = 0;
|
|
767
|
-
for (let j = 1; j <= length2; j++) {
|
|
768
|
-
if (source[i - j] <= currentValue) {
|
|
769
|
-
countLessOrEqual++;
|
|
770
|
-
}
|
|
771
|
-
}
|
|
772
|
-
result.push(countLessOrEqual / length2 * 100);
|
|
773
|
-
}
|
|
734
|
+
continue;
|
|
735
|
+
}
|
|
736
|
+
let countLessOrEqual = 0;
|
|
737
|
+
for (let j = 1; j <= length2; j++) {
|
|
738
|
+
if (le(source[i - j], currentValue)) countLessOrEqual++;
|
|
774
739
|
}
|
|
740
|
+
result.push(countLessOrEqual / length2 * 100);
|
|
775
741
|
}
|
|
776
742
|
return result;
|
|
777
743
|
}
|
|
@@ -1298,63 +1264,36 @@ function mode(source, length2) {
|
|
|
1298
1264
|
return result;
|
|
1299
1265
|
}
|
|
1300
1266
|
function percentile_linear_interpolation(source, length2, percentage) {
|
|
1267
|
+
return sortedWindow(source, length2, (s) => {
|
|
1268
|
+
const pos2 = percentage / 100 * length2 - 0.5;
|
|
1269
|
+
if (pos2 <= 0) return s[0];
|
|
1270
|
+
if (pos2 >= length2 - 1) return s[length2 - 1];
|
|
1271
|
+
const lo = Math.floor(pos2);
|
|
1272
|
+
return s[lo] + (pos2 - lo) * (s[lo + 1] - s[lo]);
|
|
1273
|
+
});
|
|
1274
|
+
}
|
|
1275
|
+
function sortedWindow(source, length2, fn) {
|
|
1301
1276
|
const result = [];
|
|
1277
|
+
const values2 = [];
|
|
1278
|
+
const bars = [];
|
|
1302
1279
|
for (let i = 0; i < source.length; i++) {
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
const
|
|
1310
|
-
values2.
|
|
1311
|
-
|
|
1312
|
-
if (values2.some((v) => isNaN(v))) {
|
|
1313
|
-
result.push(NaN);
|
|
1314
|
-
continue;
|
|
1315
|
-
}
|
|
1316
|
-
const sorted = [...values2].sort((a, b2) => a - b2);
|
|
1317
|
-
const position = percentage / 100 * (sorted.length - 1);
|
|
1318
|
-
const lowerIndex = Math.floor(position);
|
|
1319
|
-
const upperIndex = Math.ceil(position);
|
|
1320
|
-
if (lowerIndex === upperIndex) {
|
|
1321
|
-
result.push(sorted[lowerIndex]);
|
|
1322
|
-
} else {
|
|
1323
|
-
const fraction = position - lowerIndex;
|
|
1324
|
-
const interpolated = sorted[lowerIndex] + fraction * (sorted[upperIndex] - sorted[lowerIndex]);
|
|
1325
|
-
result.push(interpolated);
|
|
1280
|
+
const v = source[i];
|
|
1281
|
+
let k = 0;
|
|
1282
|
+
while (k < values2.length && !(values2[k] >= v)) k++;
|
|
1283
|
+
values2.splice(k, 0, v);
|
|
1284
|
+
bars.splice(k, 0, i);
|
|
1285
|
+
if (i >= length2) {
|
|
1286
|
+
const old = bars.indexOf(i - length2);
|
|
1287
|
+
values2.splice(old, 1);
|
|
1288
|
+
bars.splice(old, 1);
|
|
1326
1289
|
}
|
|
1290
|
+
result.push(i < length2 - 1 ? NaN : fn(values2));
|
|
1327
1291
|
}
|
|
1328
1292
|
return result;
|
|
1329
1293
|
}
|
|
1330
1294
|
function percentile_nearest_rank(source, length2, percentage) {
|
|
1331
|
-
const
|
|
1332
|
-
|
|
1333
|
-
if (i < length2 - 1) {
|
|
1334
|
-
result.push(NaN);
|
|
1335
|
-
continue;
|
|
1336
|
-
}
|
|
1337
|
-
const values2 = [];
|
|
1338
|
-
for (let j = 0; j < length2; j++) {
|
|
1339
|
-
const value = source[i - j];
|
|
1340
|
-
if (!isNaN(value)) {
|
|
1341
|
-
values2.push(value);
|
|
1342
|
-
}
|
|
1343
|
-
}
|
|
1344
|
-
if (values2.length === 0) {
|
|
1345
|
-
result.push(NaN);
|
|
1346
|
-
continue;
|
|
1347
|
-
}
|
|
1348
|
-
const sorted = [...values2].sort((a, b2) => a - b2);
|
|
1349
|
-
if (percentage >= 100) {
|
|
1350
|
-
result.push(sorted[sorted.length - 1]);
|
|
1351
|
-
continue;
|
|
1352
|
-
}
|
|
1353
|
-
const rank2 = Math.ceil(percentage / 100 * sorted.length);
|
|
1354
|
-
const index = Math.max(0, rank2 - 1);
|
|
1355
|
-
result.push(sorted[index]);
|
|
1356
|
-
}
|
|
1357
|
-
return result;
|
|
1295
|
+
const rank2 = Math.min(length2, Math.max(1, Math.ceil(percentage / 100 * length2)));
|
|
1296
|
+
return sortedWindow(source, length2, (s) => s[rank2 - 1]);
|
|
1358
1297
|
}
|
|
1359
1298
|
function rci(source, length2) {
|
|
1360
1299
|
const result = [];
|
|
@@ -2072,7 +2011,7 @@ var Series = class _Series {
|
|
|
2072
2011
|
return new _Series(this.dataSource, (bar, i, data) => {
|
|
2073
2012
|
const a = this.extractor(bar, i, data);
|
|
2074
2013
|
const b2 = typeof other === "number" ? other : other.extractor(bar, i, data);
|
|
2075
|
-
return
|
|
2014
|
+
return a / b2;
|
|
2076
2015
|
});
|
|
2077
2016
|
}
|
|
2078
2017
|
/**
|
|
@@ -3079,15 +3018,27 @@ function percentile_linear_interpolation2(id, percentage) {
|
|
|
3079
3018
|
if (id.length === 0) {
|
|
3080
3019
|
return NaN;
|
|
3081
3020
|
}
|
|
3082
|
-
const
|
|
3083
|
-
|
|
3021
|
+
const s = sortedNaLast(id);
|
|
3022
|
+
const n = s.length;
|
|
3023
|
+
const pos2 = percentage / 100 * n - 0.5;
|
|
3024
|
+
if (pos2 <= 0) return s[0];
|
|
3025
|
+
if (pos2 >= n - 1) return s[n - 1];
|
|
3026
|
+
const lo = Math.floor(pos2);
|
|
3027
|
+
const f = pos2 - lo;
|
|
3028
|
+
if (f === 0) return s[lo];
|
|
3029
|
+
return Number.isNaN(s[n - 1]) ? NaN : s[lo] + f * (s[lo + 1] - s[lo]);
|
|
3030
|
+
}
|
|
3031
|
+
function sortedNaLast(id) {
|
|
3032
|
+
const numbers = id.filter((v) => !Number.isNaN(v)).sort((a, b2) => a - b2);
|
|
3033
|
+
return [...numbers, ...Array(id.length - numbers.length).fill(NaN)];
|
|
3084
3034
|
}
|
|
3085
3035
|
function percentile_nearest_rank2(id, percentage) {
|
|
3086
3036
|
if (id.length === 0) {
|
|
3087
3037
|
return NaN;
|
|
3088
3038
|
}
|
|
3089
|
-
const
|
|
3090
|
-
|
|
3039
|
+
const s = sortedNaLast(id);
|
|
3040
|
+
const rank2 = Math.min(s.length, Math.max(1, Math.ceil(percentage / 100 * s.length)));
|
|
3041
|
+
return s[rank2 - 1];
|
|
3091
3042
|
}
|
|
3092
3043
|
function percentrank2(id, index) {
|
|
3093
3044
|
if (id.length === 0 || index < 0 || index >= id.length) {
|
|
@@ -3798,11 +3749,13 @@ __export(color_exports, {
|
|
|
3798
3749
|
white: () => white,
|
|
3799
3750
|
yellow: () => yellow
|
|
3800
3751
|
});
|
|
3752
|
+
var channel = (v) => v === null || v === void 0 || Number.isNaN(v) ? 0 : Math.max(0, Math.min(255, Math.trunc(v)));
|
|
3753
|
+
var alphaOf = (transp) => transp === null || Number.isNaN(transp) ? 0 : 1 - Math.max(0, Math.min(100, transp)) / 100;
|
|
3801
3754
|
function rgb(red2, green2, blue2, transp) {
|
|
3802
|
-
const r2 =
|
|
3803
|
-
const g2 =
|
|
3804
|
-
const b2 =
|
|
3805
|
-
const a = transp !== void 0 ?
|
|
3755
|
+
const r2 = channel(red2);
|
|
3756
|
+
const g2 = channel(green2);
|
|
3757
|
+
const b2 = channel(blue2);
|
|
3758
|
+
const a = transp !== void 0 ? alphaOf(transp) : 1;
|
|
3806
3759
|
if (a === 1) {
|
|
3807
3760
|
return `rgb(${r2}, ${g2}, ${b2})`;
|
|
3808
3761
|
}
|
|
@@ -3829,7 +3782,8 @@ function b(clr) {
|
|
|
3829
3782
|
return parseColor(clr).b;
|
|
3830
3783
|
}
|
|
3831
3784
|
function t(clr) {
|
|
3832
|
-
|
|
3785
|
+
const alpha = Math.round((1 - parseColor(clr).t / 100) * 255);
|
|
3786
|
+
return Math.round((1 - alpha / 255) * 100);
|
|
3833
3787
|
}
|
|
3834
3788
|
function parseColor(clr) {
|
|
3835
3789
|
if (typeof clr === "string") {
|
|
@@ -3882,13 +3836,12 @@ function from_gradient(value, bottom_value, top_value, bottom_color, top_color)
|
|
|
3882
3836
|
};
|
|
3883
3837
|
const c1 = rgba(bottom_color);
|
|
3884
3838
|
const c2 = rgba(top_color);
|
|
3885
|
-
const
|
|
3886
|
-
const w2 = c2.a * k;
|
|
3887
|
-
const a = w1 + w2;
|
|
3839
|
+
const a = c1.a * (1 - k) + c2.a * k;
|
|
3888
3840
|
if (a === 0) return transparent;
|
|
3889
|
-
const mix = (x1, x2) => Math.floor((x1 *
|
|
3841
|
+
const mix = (x1, x2) => Math.floor((x1 / 255 * c1.a * (1 - k) + x2 / 255 * c2.a * k) / (a / 255));
|
|
3890
3842
|
const [r2, g2, b2] = [mix(c1.r, c2.r), mix(c1.g, c2.g), mix(c1.b, c2.b)];
|
|
3891
|
-
|
|
3843
|
+
const alpha = Math.floor(a);
|
|
3844
|
+
return alpha === 255 ? `rgb(${r2}, ${g2}, ${b2})` : `rgba(${r2}, ${g2}, ${b2}, ${alpha / 255})`;
|
|
3892
3845
|
}
|
|
3893
3846
|
|
|
3894
3847
|
// src/time/index.ts
|
|
@@ -6099,6 +6052,7 @@ var format_italic = 2;
|
|
|
6099
6052
|
// src/callsite/index.ts
|
|
6100
6053
|
var callsite_exports = {};
|
|
6101
6054
|
__export(callsite_exports, {
|
|
6055
|
+
barssince: () => barssince2,
|
|
6102
6056
|
cross: () => cross2,
|
|
6103
6057
|
crossover: () => crossover2,
|
|
6104
6058
|
crossunder: () => crossunder2,
|
|
@@ -6130,6 +6084,14 @@ function crossover2() {
|
|
|
6130
6084
|
function crossunder2() {
|
|
6131
6085
|
return twoSeriesSite((a, b2, pa, pb) => a < b2 && pa >= pb);
|
|
6132
6086
|
}
|
|
6087
|
+
function barssince2() {
|
|
6088
|
+
let count = NaN;
|
|
6089
|
+
return (condition) => {
|
|
6090
|
+
if (condition && !Number.isNaN(condition)) count = 0;
|
|
6091
|
+
else if (!Number.isNaN(count)) count++;
|
|
6092
|
+
return count;
|
|
6093
|
+
};
|
|
6094
|
+
}
|
|
6133
6095
|
function cross2() {
|
|
6134
6096
|
return twoSeriesSite((a, b2, pa, pb) => a > b2 && pa <= pb || a < b2 && pa >= pb);
|
|
6135
6097
|
}
|
|
@@ -6140,7 +6102,7 @@ __export(ta_series_exports, {
|
|
|
6140
6102
|
accdist: () => accdist2,
|
|
6141
6103
|
alma: () => alma2,
|
|
6142
6104
|
atr: () => atr2,
|
|
6143
|
-
barssince: () =>
|
|
6105
|
+
barssince: () => barssince3,
|
|
6144
6106
|
bb: () => bb2,
|
|
6145
6107
|
bbw: () => bbw2,
|
|
6146
6108
|
cci: () => cci2,
|
|
@@ -6528,7 +6490,7 @@ function pivotlow2(source, leftbars, rightbars) {
|
|
|
6528
6490
|
const result = pivotlow(source.toArray(), leftbars, rightbars);
|
|
6529
6491
|
return Series.fromArray(bars, result);
|
|
6530
6492
|
}
|
|
6531
|
-
function
|
|
6493
|
+
function barssince3(condition) {
|
|
6532
6494
|
const bars = condition.bars;
|
|
6533
6495
|
const boolValues = condition.toArray().map((v) => v === 1);
|
|
6534
6496
|
const result = barssince(boolValues);
|
|
@@ -6680,7 +6642,7 @@ var ta = {
|
|
|
6680
6642
|
hma: hma2,
|
|
6681
6643
|
pivothigh: pivothigh2,
|
|
6682
6644
|
pivotlow: pivotlow2,
|
|
6683
|
-
barssince:
|
|
6645
|
+
barssince: barssince3,
|
|
6684
6646
|
valuewhen: valuewhen2,
|
|
6685
6647
|
dmi: dmi2,
|
|
6686
6648
|
tsi: tsi2,
|
|
@@ -6712,7 +6674,7 @@ var ta = {
|
|
|
6712
6674
|
|
|
6713
6675
|
// src/utils/index.ts
|
|
6714
6676
|
function isNA(value) {
|
|
6715
|
-
return value === null || value === void 0 || Number.isNaN(value) || isDeleted(value);
|
|
6677
|
+
return value === null || value === void 0 || Number.isNaN(value) || value === Infinity || value === -Infinity || isDeleted(value);
|
|
6716
6678
|
}
|
|
6717
6679
|
function nz(value, defaultValue = 0) {
|
|
6718
6680
|
return isNA(value) ? defaultValue : value;
|
|
@@ -6721,7 +6683,7 @@ function fixnan(source) {
|
|
|
6721
6683
|
let last2;
|
|
6722
6684
|
let seen = false;
|
|
6723
6685
|
return source.map((v) => {
|
|
6724
|
-
if (!
|
|
6686
|
+
if (!(v === null || v === void 0 || Number.isNaN(v) || isDeleted(v))) {
|
|
6725
6687
|
last2 = v;
|
|
6726
6688
|
seen = true;
|
|
6727
6689
|
return v;
|
|
@@ -6737,7 +6699,7 @@ function at(source, i, offset = 0) {
|
|
|
6737
6699
|
return j >= 0 && j < source.length ? source[j] ?? NaN : NaN;
|
|
6738
6700
|
}
|
|
6739
6701
|
function div(a, b2) {
|
|
6740
|
-
return
|
|
6702
|
+
return a / b2;
|
|
6741
6703
|
}
|
|
6742
6704
|
function ohlcFromBars(bars) {
|
|
6743
6705
|
return {
|
|
@@ -7371,7 +7333,7 @@ function hline(price, title, color, linestyle, linewidth) {
|
|
|
7371
7333
|
const options = {
|
|
7372
7334
|
color,
|
|
7373
7335
|
lineWidth: linewidth,
|
|
7374
|
-
lineStyle: getLineStyle(linestyle)
|
|
7336
|
+
lineStyle: getLineStyle(linestyle ?? "dashed")
|
|
7375
7337
|
};
|
|
7376
7338
|
const seriesHandle = context.chart.addSeries("line", options);
|
|
7377
7339
|
const data = context.ohlcv.time.map((time) => ({
|
|
@@ -7618,9 +7580,10 @@ var STRATEGY_DEFAULTS = {
|
|
|
7618
7580
|
calc_on_order_fills: false,
|
|
7619
7581
|
calc_on_every_tick: false,
|
|
7620
7582
|
backtest_fill_limits_assumption: 0,
|
|
7621
|
-
|
|
7622
|
-
|
|
7623
|
-
|
|
7583
|
+
// v6 values; PineScript v5: fixed / 1 / 1000000 and margins 0
|
|
7584
|
+
default_qty_type: "percent_of_equity",
|
|
7585
|
+
default_qty_value: 100,
|
|
7586
|
+
initial_capital: 1e5,
|
|
7624
7587
|
slippage: 0,
|
|
7625
7588
|
commission_type: "percent",
|
|
7626
7589
|
commission_value: 0,
|
|
@@ -7876,7 +7839,7 @@ var SimpleInputAdapter = class {
|
|
|
7876
7839
|
};
|
|
7877
7840
|
|
|
7878
7841
|
// src/index.ts
|
|
7879
|
-
var VERSION = "0.8.
|
|
7842
|
+
var VERSION = "0.8.1";
|
|
7880
7843
|
var info2 = {
|
|
7881
7844
|
name: "OakScriptJS",
|
|
7882
7845
|
version: VERSION,
|
package/dist/runtime/index.cjs
CHANGED
|
@@ -148,7 +148,7 @@ function hline(price, title, color, linestyle, linewidth) {
|
|
|
148
148
|
const options = {
|
|
149
149
|
color,
|
|
150
150
|
lineWidth: linewidth,
|
|
151
|
-
lineStyle: getLineStyle(linestyle)
|
|
151
|
+
lineStyle: getLineStyle(linestyle ?? "dashed")
|
|
152
152
|
};
|
|
153
153
|
const seriesHandle = context.chart.addSeries("line", options);
|
|
154
154
|
const data = context.ohlcv.time.map((time) => ({
|
package/dist/runtime/index.mjs
CHANGED
|
@@ -101,7 +101,7 @@ function hline(price, title, color, linestyle, linewidth) {
|
|
|
101
101
|
const options = {
|
|
102
102
|
color,
|
|
103
103
|
lineWidth: linewidth,
|
|
104
|
-
lineStyle: getLineStyle(linestyle)
|
|
104
|
+
lineStyle: getLineStyle(linestyle ?? "dashed")
|
|
105
105
|
};
|
|
106
106
|
const seriesHandle = context.chart.addSeries("line", options);
|
|
107
107
|
const data = context.ohlcv.time.map((time) => ({
|
package/dist/runtime/types.d.ts
CHANGED
|
@@ -28,17 +28,33 @@ export interface InputConfig {
|
|
|
28
28
|
max?: number;
|
|
29
29
|
step?: number;
|
|
30
30
|
options?: string[];
|
|
31
|
+
group?: string;
|
|
32
|
+
inline?: string;
|
|
33
|
+
tooltip?: string;
|
|
34
|
+
confirm?: boolean;
|
|
35
|
+
display?: 'all' | 'none' | 'data_window' | 'status_line';
|
|
31
36
|
}
|
|
32
37
|
export interface PlotConfig {
|
|
33
38
|
id: string;
|
|
34
39
|
title: string;
|
|
35
40
|
color: string;
|
|
36
41
|
lineWidth?: number;
|
|
37
|
-
style?: 'line' | 'stepline' | 'histogram' | 'area' | 'circles' | 'columns' | 'cross' | 'areabr' | 'steplinebr' | 'linebr';
|
|
42
|
+
style?: 'line' | 'stepline' | 'histogram' | 'area' | 'circles' | 'columns' | 'cross' | 'areabr' | 'steplinebr' | 'linebr' | 'stepline_diamond';
|
|
38
43
|
visible?: boolean | string;
|
|
39
44
|
display?: 'all' | 'none' | 'data_window' | 'status_line' | 'pane';
|
|
40
45
|
offset?: number;
|
|
41
46
|
histbase?: number;
|
|
47
|
+
linestyle?: 'solid' | 'dashed' | 'dotted';
|
|
48
|
+
}
|
|
49
|
+
export interface ArrowConfig {
|
|
50
|
+
id: string;
|
|
51
|
+
title?: string;
|
|
52
|
+
colorup: string;
|
|
53
|
+
colordown: string;
|
|
54
|
+
minheight: number;
|
|
55
|
+
maxheight: number;
|
|
56
|
+
offset?: number;
|
|
57
|
+
display?: 'all' | 'none' | 'data_window' | 'status_line' | 'pane';
|
|
42
58
|
}
|
|
43
59
|
export interface HLineConfig {
|
|
44
60
|
id: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/runtime/types.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,YAA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