@alphacharts/indicators 0.1.0 → 0.1.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 +19 -8
- package/dist/{all-DeXJJd7D.js → all-_xzUPrL7.js} +9 -9
- package/dist/{all-DeXJJd7D.js.map → all-_xzUPrL7.js.map} +1 -1
- package/dist/all.js +2 -2
- package/dist/define-XUgQMhSl.js +687 -0
- package/dist/define-XUgQMhSl.js.map +1 -0
- package/dist/index.js +269 -118
- package/dist/index.js.map +1 -1
- package/dist/{registry-CYZuqhXX.js → registry-DdYYyZN_.js} +5 -1
- package/dist/registry-DdYYyZN_.js.map +1 -0
- package/dist/{runner-DBP0M8z3.js → runner-B53M0IsJ.js} +15 -7
- package/dist/runner-B53M0IsJ.js.map +1 -0
- package/dist/studies.js +1 -1
- package/dist/{tv-volume-7hh6ajKt.js → tv-volume-BYSbfrVk.js} +197 -200
- package/dist/tv-volume-BYSbfrVk.js.map +1 -0
- package/dist/types/chart/marker-floor.d.ts +9 -0
- package/dist/types/chart/studies.d.ts +29 -2
- package/dist/types/engine/feed.d.ts +88 -0
- package/dist/types/engine/graph.d.ts +37 -2
- package/dist/types/engine/study.d.ts +9 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/runner.d.ts +11 -2
- package/dist/types/studies/tv-volume.d.ts +1 -0
- package/dist/types/types.d.ts +40 -4
- package/dist/worker.js +2 -2
- package/package.json +8 -5
- package/dist/assets/worker-BrUuzTIJ.js +0 -2
- package/dist/assets/worker-BrUuzTIJ.js.map +0 -1
- package/dist/define-BPvQbaq9.js +0 -472
- package/dist/define-BPvQbaq9.js.map +0 -1
- package/dist/registry-CYZuqhXX.js.map +0 -1
- package/dist/runner-DBP0M8z3.js.map +0 -1
- package/dist/tv-volume-7hh6ajKt.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as e, a as t, c as n, d as r, f as i, i as a, l as o, n as s, o as c, p as l, r as u, s as d, t as f, u as p } from "./define-
|
|
1
|
+
import { _ as e, a as t, c as n, d as r, f as i, i as a, l as o, n as s, o as c, p as l, r as u, s as d, t as f, u as p } from "./define-XUgQMhSl.js";
|
|
2
2
|
//#region \0rolldown/runtime.js
|
|
3
3
|
var m = Object.defineProperty, h = (e, t) => {
|
|
4
4
|
let n = {};
|
|
@@ -378,9 +378,9 @@ var E = /* @__PURE__ */ h({
|
|
|
378
378
|
label: (e) => `${e.length}`,
|
|
379
379
|
build: (e, t) => {
|
|
380
380
|
let n = e.change(e.src(t.source), 1), r = e.rma(e.map(n, (e) => e > 0 ? e : e === e ? 0 : NaN), t.length), i = e.rma(e.map(n, (e) => e < 0 ? -e : e === e ? 0 : NaN), t.length);
|
|
381
|
-
return [e.map2(r, i, (e, t) => e + t === 0 ?
|
|
381
|
+
return [e.map2(r, i, (e, t) => e + t === 0 ? 100 : 100 * e / (e + t))];
|
|
382
382
|
},
|
|
383
|
-
reference: "TA-Lib RSI (Wilder smoothing, seeded with the mean of the first `length` changes)"
|
|
383
|
+
reference: "TA-Lib RSI arithmetic (Wilder smoothing, seeded with the mean of the first `length` changes). A flat opening (average gain and loss both 0, RS = 0/0) is 100, the convention of charting packages; TA-Lib reports 0 there"
|
|
384
384
|
}), ge = a({
|
|
385
385
|
id: "cmo",
|
|
386
386
|
name: "Chande Momentum Oscillator",
|
|
@@ -670,14 +670,14 @@ var Fe = [
|
|
|
670
670
|
],
|
|
671
671
|
label: (e) => `${e.rsiLength}, ${e.stochLength}, ${e.kSmooth}, ${e.dSmooth}`,
|
|
672
672
|
build: (e, t) => {
|
|
673
|
-
let n = e.change(e.src(t.source), 1), r = e.rma(e.map(n, (e) => e > 0 ? e : e === e ? 0 : NaN), t.rsiLength), i = e.rma(e.map(n, (e) => e < 0 ? -e : e === e ? 0 : NaN), t.rsiLength), a = e.map2(r, i, (e, t) => e + t === 0 ?
|
|
673
|
+
let n = e.change(e.src(t.source), 1), r = e.rma(e.map(n, (e) => e > 0 ? e : e === e ? 0 : NaN), t.rsiLength), i = e.rma(e.map(n, (e) => e < 0 ? -e : e === e ? 0 : NaN), t.rsiLength), a = e.map2(r, i, (e, t) => e + t === 0 ? 100 : 100 * e / (e + t)), o = Pe(e, a, a, a, t.stochLength), s = e.sma(o, t.kSmooth);
|
|
674
674
|
return [
|
|
675
675
|
o,
|
|
676
676
|
s,
|
|
677
677
|
e.sma(s, t.dSmooth)
|
|
678
678
|
];
|
|
679
679
|
},
|
|
680
|
-
reference: "TA-Lib STOCHRSI: `raw` = fastk, `k` = fastd with period kSmooth; `d` is TradingView's second smoothing"
|
|
680
|
+
reference: "TA-Lib STOCHRSI: `raw` = fastk, `k` = fastd with period kSmooth; `d` is TradingView's second smoothing. The RSI inside is this package's (a flat opening is 100, see rsi)"
|
|
681
681
|
}), ze = a({
|
|
682
682
|
id: "willr",
|
|
683
683
|
name: "Williams %R",
|
|
@@ -1015,7 +1015,7 @@ var at = a({
|
|
|
1015
1015
|
plots: [p("atr", f.red)],
|
|
1016
1016
|
label: (e) => `${e.length}`,
|
|
1017
1017
|
build: (e, t) => [e.atr(t.length)],
|
|
1018
|
-
reference: "TA-Lib
|
|
1018
|
+
reference: "Wilder's ATR (not TA-Lib's): true range of bar 0 is high - low, seeded with the mean of true ranges 0..length-1 (first value at bar length-1), then Wilder smoothing. TA-Lib skips the first true range and starts one bar later"
|
|
1019
1019
|
}), dt = a({
|
|
1020
1020
|
id: "natr",
|
|
1021
1021
|
name: "Normalized Average True Range",
|
|
@@ -1030,7 +1030,7 @@ var at = a({
|
|
|
1030
1030
|
let n = e.atr(t.length);
|
|
1031
1031
|
return [e.calc((t) => 100 * n.v[t] / e.close.v[t])];
|
|
1032
1032
|
},
|
|
1033
|
-
reference: "
|
|
1033
|
+
reference: "NATR = 100 * ATR / close, on Wilder's ATR (not TA-Lib's, see atr)"
|
|
1034
1034
|
}), ft = /* @__PURE__ */ h({
|
|
1035
1035
|
avgprice: () => mt,
|
|
1036
1036
|
medprice: () => ht,
|
|
@@ -1895,47 +1895,31 @@ var Mr = [
|
|
|
1895
1895
|
let n = 0;
|
|
1896
1896
|
return Math.min(B(e - 1), U(e - 1)) > Math.max(B(e - 2), U(e - 2)) && Math.max(B(e), U(e)) < Math.max(B(e - 1), U(e - 1)) && (n = -100), Math.max(B(e - 1), U(e - 1)) < Math.min(B(e - 2), U(e - 2)) && Math.min(B(e), U(e)) > Math.min(B(e - 1), U(e - 1)) && (n = 100), n;
|
|
1897
1897
|
}), ri = Y("UNIQUE3RIVER", "Unique 3 River", 12, [[j, 2], [M, 0]], (e, t) => W(e - 2) === -1 && W(e - 1) === -1 && W(e) === 1 && U(e - 1) > U(e - 2) && B(e - 1) <= B(e - 2) && H(e - 1) < H(e - 2) && B(e) > H(e - 1) && G(e - 2) > J(j, t[0], e - 2) && G(e) < J(M, t[1], e) ? 100 : 0), ii = Y("UPSIDEGAP2CROWS", "Upside Gap Two Crows", 12, [[j, 2], [M, 1]], (e, t) => W(e - 2) === 1 && G(e - 2) > J(j, t[0], e - 2) && W(e - 1) === -1 && G(e - 1) <= J(M, t[1], e - 1) && Math.min(B(e - 1), U(e - 1)) > Math.max(B(e - 2), U(e - 2)) && W(e) === -1 && B(e) > B(e - 1) && U(e) < U(e - 1) && U(e) > U(e - 2) ? -100 : 0), ai = Y("XSIDEGAP3METHODS", "Upside/Downside Gap Three Methods", 2, [], (e) => W(e - 2) === W(e - 1) && W(e - 1) === -W(e) && B(e) < Math.max(U(e - 1), B(e - 1)) && B(e) > Math.min(U(e - 1), B(e - 1)) && U(e) < Math.max(U(e - 2), B(e - 2)) && U(e) > Math.min(U(e - 2), B(e - 2)) && (W(e - 2) === 1 && Math.min(B(e - 1), U(e - 1)) > Math.max(B(e - 2), U(e - 2)) || W(e - 2) === -1 && Math.max(B(e - 1), U(e - 1)) < Math.min(B(e - 2), U(e - 2))) ? W(e - 2) * 100 : 0), oi = /* @__PURE__ */ h({
|
|
1898
|
-
alligator: () =>
|
|
1899
|
-
alma: () =>
|
|
1900
|
-
chandeKrollStop: () =>
|
|
1901
|
-
donchian: () =>
|
|
1902
|
-
envelopes: () =>
|
|
1903
|
-
fractals: () =>
|
|
1904
|
-
hma: () =>
|
|
1905
|
-
ichimoku: () =>
|
|
1906
|
-
keltner: () =>
|
|
1907
|
-
linregChannel: () =>
|
|
1908
|
-
lsma: () =>
|
|
1909
|
-
maCross: () =>
|
|
1910
|
-
maRibbon: () =>
|
|
1911
|
-
mcginley: () =>
|
|
1912
|
-
median: () =>
|
|
1913
|
-
priceChannel: () =>
|
|
1914
|
-
smma: () =>
|
|
1915
|
-
supertrend: () =>
|
|
1916
|
-
vwma: () =>
|
|
1917
|
-
zigzag: () =>
|
|
1898
|
+
alligator: () => ji,
|
|
1899
|
+
alma: () => pi,
|
|
1900
|
+
chandeKrollStop: () => Ti,
|
|
1901
|
+
donchian: () => Ci,
|
|
1902
|
+
envelopes: () => bi,
|
|
1903
|
+
fractals: () => Fi,
|
|
1904
|
+
hma: () => fi,
|
|
1905
|
+
ichimoku: () => ki,
|
|
1906
|
+
keltner: () => xi,
|
|
1907
|
+
linregChannel: () => Ei,
|
|
1908
|
+
lsma: () => mi,
|
|
1909
|
+
maCross: () => yi,
|
|
1910
|
+
maRibbon: () => vi,
|
|
1911
|
+
mcginley: () => hi,
|
|
1912
|
+
median: () => Di,
|
|
1913
|
+
priceChannel: () => wi,
|
|
1914
|
+
smma: () => ui,
|
|
1915
|
+
supertrend: () => Ai,
|
|
1916
|
+
vwma: () => di,
|
|
1917
|
+
zigzag: () => Ii
|
|
1918
1918
|
}), X = NaN, Z = (e, t = 1) => o("length", e, t, 5e3), si = (e, t) => {
|
|
1919
1919
|
let n = parseInt(e.slice(1), 16);
|
|
1920
1920
|
return `rgba(${n >> 16},${n >> 8 & 255},${n & 255},${t})`;
|
|
1921
1921
|
};
|
|
1922
|
-
function ci(e) {
|
|
1923
|
-
let { high: t, low: n, close: r } = e;
|
|
1924
|
-
return e.node((e, i, a) => {
|
|
1925
|
-
let o = t.v, s = n.v, c = r.v, l = e.v;
|
|
1926
|
-
for (let e = i; e < a; e++) {
|
|
1927
|
-
let t = o[e] - s[e];
|
|
1928
|
-
if (e === 0) {
|
|
1929
|
-
l[e] = t;
|
|
1930
|
-
continue;
|
|
1931
|
-
}
|
|
1932
|
-
let n = c[e - 1], r = Math.abs(o[e] - n), i = Math.abs(s[e] - n);
|
|
1933
|
-
l[e] = t > r ? t > i ? t : i : r > i ? r : i;
|
|
1934
|
-
}
|
|
1935
|
-
});
|
|
1936
|
-
}
|
|
1937
|
-
var li = (e, t) => e.rma(ci(e), t);
|
|
1938
|
-
function ui(e, t, n) {
|
|
1922
|
+
function ci(e, t, n) {
|
|
1939
1923
|
if (!Number.isInteger(n) || n < 2) throw RangeError(`linreg: period must be an integer >= 2, got ${n}`);
|
|
1940
1924
|
let r = e.validRun(t), i = n * (n - 1) / 2, a = n * (n * (n - 1) * (2 * n - 1) / 6) - i * i, o = e.col(), s = e.col();
|
|
1941
1925
|
return {
|
|
@@ -1959,7 +1943,7 @@ function ui(e, t, n) {
|
|
|
1959
1943
|
intercept: s
|
|
1960
1944
|
};
|
|
1961
1945
|
}
|
|
1962
|
-
var
|
|
1946
|
+
var li = (e, t, n, r) => t === "ema" ? e.ema(n, r) : e.sma(n, r), ui = a({
|
|
1963
1947
|
id: "smma",
|
|
1964
1948
|
name: "Smoothed Moving Average",
|
|
1965
1949
|
family: "tv",
|
|
@@ -1971,7 +1955,7 @@ var di = (e, t, n, r) => t === "ema" ? e.ema(n, r) : e.sma(n, r), fi = a({
|
|
|
1971
1955
|
label: (e) => `${e.length}`,
|
|
1972
1956
|
build: (e, t) => [e.rma(e.src(t.source), t.length)],
|
|
1973
1957
|
reference: "TradingView Smoothed Moving Average: smma := na(smma[1]) ? ta.sma(src, n) : (smma[1] * (n - 1) + src) / n"
|
|
1974
|
-
}),
|
|
1958
|
+
}), di = a({
|
|
1975
1959
|
id: "vwma",
|
|
1976
1960
|
name: "Volume Weighted Moving Average",
|
|
1977
1961
|
family: "tv",
|
|
@@ -1983,7 +1967,7 @@ var di = (e, t, n, r) => t === "ema" ? e.ema(n, r) : e.sma(n, r), fi = a({
|
|
|
1983
1967
|
label: (e) => `${e.length}`,
|
|
1984
1968
|
build: (e, t) => [e.div(e.sum(e.mul(e.src(t.source), e.volume), t.length), e.sum(e.volume, t.length))],
|
|
1985
1969
|
reference: "Pine ta.vwma(src, n) = ta.sma(src * volume, n) / ta.sma(volume, n)"
|
|
1986
|
-
}),
|
|
1970
|
+
}), fi = a({
|
|
1987
1971
|
id: "hma",
|
|
1988
1972
|
name: "Hull Moving Average",
|
|
1989
1973
|
family: "tv",
|
|
@@ -1998,7 +1982,7 @@ var di = (e, t, n, r) => t === "ema" ? e.ema(n, r) : e.sma(n, r), fi = a({
|
|
|
1998
1982
|
return [e.wma(a, i)];
|
|
1999
1983
|
},
|
|
2000
1984
|
reference: "Pine ta.hma(src, n) = ta.wma(2 * ta.wma(src, n / 2) - ta.wma(src, n), round(sqrt(n))), with n / 2 truncated to an int"
|
|
2001
|
-
}),
|
|
1985
|
+
}), pi = a({
|
|
2002
1986
|
id: "alma",
|
|
2003
1987
|
name: "Arnaud Legoux Moving Average",
|
|
2004
1988
|
family: "tv",
|
|
@@ -2031,7 +2015,7 @@ var di = (e, t, n, r) => t === "ema" ? e.ema(n, r) : e.sma(n, r), fi = a({
|
|
|
2031
2015
|
})];
|
|
2032
2016
|
},
|
|
2033
2017
|
reference: "Pine ta.alma(src, n, offset, sigma): m = floor(offset * (n - 1)), s = n / sigma, w_k = exp(-(k - m)^2 / (2 s^2)), sum(src[n-1-k] * w_k) / sum(w_k)"
|
|
2034
|
-
}),
|
|
2018
|
+
}), mi = a({
|
|
2035
2019
|
id: "lsma",
|
|
2036
2020
|
name: "Least Squares Moving Average",
|
|
2037
2021
|
family: "tv",
|
|
@@ -2046,11 +2030,11 @@ var di = (e, t, n, r) => t === "ema" ? e.ema(n, r) : e.sma(n, r), fi = a({
|
|
|
2046
2030
|
plots: [p("lsma", f.orange)],
|
|
2047
2031
|
label: (e) => `${e.length}, ${e.offset}`,
|
|
2048
2032
|
build: (e, t) => {
|
|
2049
|
-
let n =
|
|
2033
|
+
let n = ci(e, e.src(t.source), t.length);
|
|
2050
2034
|
return [e.map2(n.value, n.slope, (e, n) => e - t.offset * n)];
|
|
2051
2035
|
},
|
|
2052
2036
|
reference: "TradingView Least Squares Moving Average = Pine ta.linreg(src, n, offset); offset 0 equals TA-Lib LINEARREG"
|
|
2053
|
-
}),
|
|
2037
|
+
}), hi = a({
|
|
2054
2038
|
id: "mcginley",
|
|
2055
2039
|
name: "McGinley Dynamic",
|
|
2056
2040
|
family: "tv",
|
|
@@ -2071,7 +2055,7 @@ var di = (e, t, n, r) => t === "ema" ? e.ema(n, r) : e.sma(n, r), fi = a({
|
|
|
2071
2055
|
})];
|
|
2072
2056
|
},
|
|
2073
2057
|
reference: "TradingView McGinley Dynamic: mg := na(mg[1]) ? ta.ema(src, n) : mg[1] + (src - mg[1]) / (n * (src / mg[1])^4)"
|
|
2074
|
-
}),
|
|
2058
|
+
}), gi = [
|
|
2075
2059
|
f.blue,
|
|
2076
2060
|
f.teal,
|
|
2077
2061
|
f.green,
|
|
@@ -2080,7 +2064,7 @@ var di = (e, t, n, r) => t === "ema" ? e.ema(n, r) : e.sma(n, r), fi = a({
|
|
|
2080
2064
|
f.orange,
|
|
2081
2065
|
f.red,
|
|
2082
2066
|
f.pink
|
|
2083
|
-
],
|
|
2067
|
+
], _i = gi.map((e, t) => `ma${t + 1}`), vi = a({
|
|
2084
2068
|
id: "ma-ribbon",
|
|
2085
2069
|
name: "Moving Average Ribbon",
|
|
2086
2070
|
family: "tv",
|
|
@@ -2091,8 +2075,8 @@ var di = (e, t, n, r) => t === "ema" ? e.ema(n, r) : e.sma(n, r), fi = a({
|
|
|
2091
2075
|
o("step", 5, 1, 1e3, "step"),
|
|
2092
2076
|
l()
|
|
2093
2077
|
],
|
|
2094
|
-
columns:
|
|
2095
|
-
plots:
|
|
2078
|
+
columns: _i,
|
|
2079
|
+
plots: _i.map((e, t) => p(e, gi[t], {
|
|
2096
2080
|
title: `MA ${t + 1}`,
|
|
2097
2081
|
width: 1
|
|
2098
2082
|
})),
|
|
@@ -2101,10 +2085,10 @@ var di = (e, t, n, r) => t === "ema" ? e.ema(n, r) : e.sma(n, r), fi = a({
|
|
|
2101
2085
|
let n = t.first + 7 * t.step;
|
|
2102
2086
|
if (n > 5e3) throw RangeError(`ma-ribbon: the 8th period ${n} exceeds 5000`);
|
|
2103
2087
|
let r = e.src(t.source);
|
|
2104
|
-
return
|
|
2088
|
+
return _i.map((n, i) => e.sma(r, t.first + i * t.step));
|
|
2105
2089
|
},
|
|
2106
2090
|
reference: "Moving Average Ribbon: eight simple moving averages of periods first, first + step, ... first + 7 * step (default 20..55 step 5)"
|
|
2107
|
-
}),
|
|
2091
|
+
}), yi = a({
|
|
2108
2092
|
id: "ma-cross",
|
|
2109
2093
|
name: "Moving Average Cross",
|
|
2110
2094
|
family: "tv",
|
|
@@ -2130,7 +2114,7 @@ var di = (e, t, n, r) => t === "ema" ? e.ema(n, r) : e.sma(n, r), fi = a({
|
|
|
2130
2114
|
],
|
|
2131
2115
|
label: (e) => `${e.type}, ${e.fast}, ${e.slow}`,
|
|
2132
2116
|
build: (e, t) => {
|
|
2133
|
-
let n = e.src(t.source), r =
|
|
2117
|
+
let n = e.src(t.source), r = li(e, t.type, n, t.fast), i = li(e, t.type, n, t.slow);
|
|
2134
2118
|
return [
|
|
2135
2119
|
r,
|
|
2136
2120
|
i,
|
|
@@ -2139,7 +2123,7 @@ var di = (e, t, n, r) => t === "ema" ? e.ema(n, r) : e.sma(n, r), fi = a({
|
|
|
2139
2123
|
];
|
|
2140
2124
|
},
|
|
2141
2125
|
reference: "TradingView Moving Average Cross: two moving averages, circles where ta.crossover / ta.crossunder(fast, slow) is true"
|
|
2142
|
-
}),
|
|
2126
|
+
}), bi = a({
|
|
2143
2127
|
id: "envelopes",
|
|
2144
2128
|
name: "Moving Average Envelopes",
|
|
2145
2129
|
family: "tv",
|
|
@@ -2159,7 +2143,7 @@ var di = (e, t, n, r) => t === "ema" ? e.ema(n, r) : e.sma(n, r), fi = a({
|
|
|
2159
2143
|
plots: [p("basis", f.orange, { title: "Basis" }), s("band", "upper", "lower", f.blue, si(f.blue, .08), "Envelope")],
|
|
2160
2144
|
label: (e) => `${e.length}, ${e.percent}, ${e.basis}`,
|
|
2161
2145
|
build: (e, t) => {
|
|
2162
|
-
let n =
|
|
2146
|
+
let n = li(e, t.basis, e.src(t.source), t.length), r = t.percent / 100;
|
|
2163
2147
|
return [
|
|
2164
2148
|
n,
|
|
2165
2149
|
e.map(n, (e) => e * (1 + r)),
|
|
@@ -2167,7 +2151,7 @@ var di = (e, t, n, r) => t === "ema" ? e.ema(n, r) : e.sma(n, r), fi = a({
|
|
|
2167
2151
|
];
|
|
2168
2152
|
},
|
|
2169
2153
|
reference: "TradingView Envelope: basis = sma|ema(src, n), upper = basis * (1 + percent / 100), lower = basis * (1 - percent / 100)"
|
|
2170
|
-
}),
|
|
2154
|
+
}), xi = a({
|
|
2171
2155
|
id: "keltner",
|
|
2172
2156
|
name: "Keltner Channels",
|
|
2173
2157
|
family: "tv",
|
|
@@ -2188,7 +2172,7 @@ var di = (e, t, n, r) => t === "ema" ? e.ema(n, r) : e.sma(n, r), fi = a({
|
|
|
2188
2172
|
plots: [p("basis", f.blue, { title: "Basis" }), s("band", "upper", "lower", f.blue, si(f.blue, .08), "Channel")],
|
|
2189
2173
|
label: (e) => `${e.length}, ${e.mult}, ${e.atrLength}`,
|
|
2190
2174
|
build: (e, t) => {
|
|
2191
|
-
let n = e.src(t.source), r = t.useEma ? e.ema(n, t.length) : e.sma(n, t.length), i = e.map(
|
|
2175
|
+
let n = e.src(t.source), r = t.useEma ? e.ema(n, t.length) : e.sma(n, t.length), i = e.map(e.atr(t.atrLength), (e) => e * t.mult);
|
|
2192
2176
|
return [
|
|
2193
2177
|
r,
|
|
2194
2178
|
e.add(r, i),
|
|
@@ -2197,7 +2181,7 @@ var di = (e, t, n, r) => t === "ema" ? e.ema(n, r) : e.sma(n, r), fi = a({
|
|
|
2197
2181
|
},
|
|
2198
2182
|
reference: "TradingView Keltner Channels (ATR band style): basis = ema|sma(src, n), bands = basis +- mult * ta.atr(atrLength)"
|
|
2199
2183
|
});
|
|
2200
|
-
function
|
|
2184
|
+
function Si(e, t) {
|
|
2201
2185
|
let n = e.highest(e.high, t), r = e.lowest(e.low, t);
|
|
2202
2186
|
return {
|
|
2203
2187
|
upper: n,
|
|
@@ -2205,7 +2189,7 @@ function wi(e, t) {
|
|
|
2205
2189
|
mid: e.map2(n, r, (e, t) => (e + t) / 2)
|
|
2206
2190
|
};
|
|
2207
2191
|
}
|
|
2208
|
-
var
|
|
2192
|
+
var Ci = a({
|
|
2209
2193
|
id: "donchian",
|
|
2210
2194
|
name: "Donchian Channels",
|
|
2211
2195
|
family: "tv",
|
|
@@ -2220,7 +2204,7 @@ var Ti = a({
|
|
|
2220
2204
|
plots: [s("band", "upper", "lower", f.blue, si(f.blue, .08), "Channel"), p("basis", f.orange, { title: "Basis" })],
|
|
2221
2205
|
label: (e) => `${e.length}`,
|
|
2222
2206
|
build: (e, t) => {
|
|
2223
|
-
let n =
|
|
2207
|
+
let n = Si(e, t.length);
|
|
2224
2208
|
return [
|
|
2225
2209
|
n.upper,
|
|
2226
2210
|
n.lower,
|
|
@@ -2228,7 +2212,7 @@ var Ti = a({
|
|
|
2228
2212
|
];
|
|
2229
2213
|
},
|
|
2230
2214
|
reference: "TradingView Donchian Channels: upper = ta.highest(high, n), lower = ta.lowest(low, n), basis = (upper + lower) / 2; equals TA-Lib MAX(high), MIN(low), MIDPRICE"
|
|
2231
|
-
}),
|
|
2215
|
+
}), wi = a({
|
|
2232
2216
|
id: "price-channel",
|
|
2233
2217
|
name: "Price Channel",
|
|
2234
2218
|
family: "tv",
|
|
@@ -2250,7 +2234,7 @@ var Ti = a({
|
|
|
2250
2234
|
],
|
|
2251
2235
|
label: (e) => `${e.length}`,
|
|
2252
2236
|
build: (e, t) => {
|
|
2253
|
-
let n =
|
|
2237
|
+
let n = Si(e, t.length);
|
|
2254
2238
|
return [
|
|
2255
2239
|
n.upper,
|
|
2256
2240
|
n.lower,
|
|
@@ -2258,7 +2242,7 @@ var Ti = a({
|
|
|
2258
2242
|
];
|
|
2259
2243
|
},
|
|
2260
2244
|
reference: "Price Channel: highest high and lowest low of the last n bars with their midline; equals TA-Lib MAX(high), MIN(low), MIDPRICE"
|
|
2261
|
-
}),
|
|
2245
|
+
}), Ti = a({
|
|
2262
2246
|
id: "chande-kroll-stop",
|
|
2263
2247
|
name: "Chande Kroll Stop",
|
|
2264
2248
|
family: "tv",
|
|
@@ -2273,11 +2257,11 @@ var Ti = a({
|
|
|
2273
2257
|
plots: [p("stopShort", f.red, { title: "Stop short" }), p("stopLong", f.green, { title: "Stop long" })],
|
|
2274
2258
|
label: (e) => `${e.p}, ${e.x}, ${e.q}`,
|
|
2275
2259
|
build: (e, t) => {
|
|
2276
|
-
let n = e.map(
|
|
2260
|
+
let n = e.map(e.atr(t.p), (e) => e * t.x), r = e.sub(e.highest(e.high, t.p), n), i = e.add(e.lowest(e.low, t.p), n);
|
|
2277
2261
|
return [e.highest(r, t.q), e.lowest(i, t.q)];
|
|
2278
2262
|
},
|
|
2279
2263
|
reference: "TradingView Chande Kroll Stop: first_high = ta.highest(high, p) - x * ta.atr(p); first_low = ta.lowest(low, p) + x * ta.atr(p); stop_short = ta.highest(first_high, q); stop_long = ta.lowest(first_low, q)"
|
|
2280
|
-
}),
|
|
2264
|
+
}), Ei = a({
|
|
2281
2265
|
id: "linreg-channel",
|
|
2282
2266
|
name: "Linear Regression Channel",
|
|
2283
2267
|
family: "tv",
|
|
@@ -2297,7 +2281,7 @@ var Ti = a({
|
|
|
2297
2281
|
plots: [p("base", f.orange, { title: "Base" }), s("band", "upper", "lower", f.blue, si(f.blue, .08), "Channel")],
|
|
2298
2282
|
label: (e) => `${e.length}, ${e.upperDev}, ${e.lowerDev}`,
|
|
2299
2283
|
build: (e, t) => {
|
|
2300
|
-
let n = t.length, r = e.src(t.source), i =
|
|
2284
|
+
let n = t.length, r = e.src(t.source), i = ci(e, r, n), a = e.node((e, t, a) => {
|
|
2301
2285
|
let o = r.v, s = i.slope.v, c = i.intercept.v, l = e.v;
|
|
2302
2286
|
for (let e = t; e < a; e++) {
|
|
2303
2287
|
let t = s[e], r = c[e];
|
|
@@ -2320,7 +2304,7 @@ var Ti = a({
|
|
|
2320
2304
|
];
|
|
2321
2305
|
},
|
|
2322
2306
|
reference: "TradingView Linear Regression Channel: base = linear regression value at the newest bar over n bars (Pine ta.linreg(src, n, 0)), bands = base +- deviation * population stdev of the residuals. TradingView draws the tool as one anchored segment between two chosen bars; this study is the rolling per-bar form (each bar's own n-bar fit, newest point), not the anchored line."
|
|
2323
|
-
}),
|
|
2307
|
+
}), Di = a({
|
|
2324
2308
|
id: "median",
|
|
2325
2309
|
name: "Median",
|
|
2326
2310
|
family: "tv",
|
|
@@ -2347,7 +2331,7 @@ var Ti = a({
|
|
|
2347
2331
|
for (let t = 0; t < n; t++) l[t] = o[e - n + 1 + t];
|
|
2348
2332
|
l.sort(), c[e] = n % 2 == 1 ? l[(n - 1) / 2] : (l[n / 2 - 1] + l[n / 2]) / 2;
|
|
2349
2333
|
}
|
|
2350
|
-
}), o = e.map(
|
|
2334
|
+
}), o = e.map(e.atr(t.atrLength), (e) => e * t.mult);
|
|
2351
2335
|
return [
|
|
2352
2336
|
a,
|
|
2353
2337
|
e.add(a, o),
|
|
@@ -2355,7 +2339,7 @@ var Ti = a({
|
|
|
2355
2339
|
];
|
|
2356
2340
|
},
|
|
2357
2341
|
reference: "TradingView Median: rolling median of src (hl2) over n bars with an ATR band, median +- mult * ta.atr(atrLength). The band construction follows the task's definition; an even n takes the mean of the two middle values."
|
|
2358
|
-
}),
|
|
2342
|
+
}), Oi = 26, ki = a({
|
|
2359
2343
|
id: "ichimoku",
|
|
2360
2344
|
name: "Ichimoku Cloud",
|
|
2361
2345
|
family: "tv",
|
|
@@ -2390,19 +2374,19 @@ var Ti = a({
|
|
|
2390
2374
|
offset: -25
|
|
2391
2375
|
})
|
|
2392
2376
|
],
|
|
2393
|
-
label: (e) => `${e.conversion}, ${e.base}, ${e.spanB}, ${
|
|
2377
|
+
label: (e) => `${e.conversion}, ${e.base}, ${e.spanB}, ${Oi}`,
|
|
2394
2378
|
build: (e, t) => {
|
|
2395
|
-
let n =
|
|
2379
|
+
let n = Si(e, t.conversion).mid, r = Si(e, t.base).mid;
|
|
2396
2380
|
return [
|
|
2397
2381
|
n,
|
|
2398
2382
|
r,
|
|
2399
2383
|
e.map2(n, r, (e, t) => (e + t) / 2),
|
|
2400
|
-
|
|
2384
|
+
Si(e, t.spanB).mid,
|
|
2401
2385
|
e.map(e.close, (e) => e)
|
|
2402
2386
|
];
|
|
2403
2387
|
},
|
|
2404
2388
|
reference: "TradingView Ichimoku Cloud: donchian(n) = (ta.highest(high, n) + ta.lowest(low, n)) / 2; conversion = donchian(9), base = donchian(26), span A = (conversion + base) / 2, span B = donchian(52), lagging = close; leading spans plotted with offset displacement - 1 = 25, the lagging span with -25 (TradingView's own plot offsets for displacement 26). Columns hold the undisplaced values."
|
|
2405
|
-
}),
|
|
2389
|
+
}), Ai = a({
|
|
2406
2390
|
id: "supertrend",
|
|
2407
2391
|
name: "Supertrend",
|
|
2408
2392
|
family: "tv",
|
|
@@ -2417,7 +2401,7 @@ var Ti = a({
|
|
|
2417
2401
|
plots: [p("up", f.green, { title: "Up trend" }), p("down", f.red, { title: "Down trend" })],
|
|
2418
2402
|
label: (e) => `${e.factor}, ${e.atrLength}`,
|
|
2419
2403
|
build: (e, t) => {
|
|
2420
|
-
let { high: n, low: r, close: i } = e, a =
|
|
2404
|
+
let { high: n, low: r, close: i } = e, a = e.atr(t.atrLength), o = e.col(), s = e.col(), c = e.col(), l = e.col(), u = e.node((e, u, d) => {
|
|
2421
2405
|
let f = n.v, p = r.v, m = i.v, h = a.v, g = o.v, _ = s.v, v = c.v, y = l.v;
|
|
2422
2406
|
for (let n = u; n < d; n++) {
|
|
2423
2407
|
let r = h[n];
|
|
@@ -2441,7 +2425,7 @@ var Ti = a({
|
|
|
2441
2425
|
];
|
|
2442
2426
|
},
|
|
2443
2427
|
reference: "Pine ta.supertrend(factor, atrPeriod): bands hl2 +- factor * ta.atr; direction is Pine's: -1 = uptrend (line below price, column `up`), 1 = downtrend (line above price, column `down`)"
|
|
2444
|
-
}),
|
|
2428
|
+
}), ji = a({
|
|
2445
2429
|
id: "alligator",
|
|
2446
2430
|
name: "Williams Alligator",
|
|
2447
2431
|
family: "tv",
|
|
@@ -2482,9 +2466,9 @@ var Ti = a({
|
|
|
2482
2466
|
];
|
|
2483
2467
|
},
|
|
2484
2468
|
reference: "TradingView Williams Alligator: jaw = smma(hl2, 13) shifted 8 bars, teeth = smma(hl2, 8) shifted 5, lips = smma(hl2, 5) shifted 3 (the shifts are fixed plot offsets, not inputs)"
|
|
2485
|
-
}),
|
|
2486
|
-
function
|
|
2487
|
-
let r =
|
|
2469
|
+
}), Mi = 2, Ni = 4;
|
|
2470
|
+
function Pi(e, t, n) {
|
|
2471
|
+
let r = Mi;
|
|
2488
2472
|
return e.node((e, i, a) => {
|
|
2489
2473
|
let o = t.v, s = e.v;
|
|
2490
2474
|
for (let e = i; e < a; e++) {
|
|
@@ -2495,13 +2479,13 @@ function Ii(e, t, n) {
|
|
|
2495
2479
|
for (let e = 1; e <= r && c; e++) c = a(o[t + e]);
|
|
2496
2480
|
if (!c) continue;
|
|
2497
2481
|
let l = 0;
|
|
2498
|
-
for (; l <=
|
|
2482
|
+
for (; l <= Ni && t - 1 - l >= 0 && o[t - 1 - l] === i;) l++;
|
|
2499
2483
|
let u = t - 1 - l;
|
|
2500
|
-
l <=
|
|
2484
|
+
l <= Ni && u >= 0 && a(o[u]) && (s[e] = i);
|
|
2501
2485
|
}
|
|
2502
2486
|
});
|
|
2503
2487
|
}
|
|
2504
|
-
var
|
|
2488
|
+
var Fi = a({
|
|
2505
2489
|
id: "fractals",
|
|
2506
2490
|
name: "Williams Fractals",
|
|
2507
2491
|
family: "tv",
|
|
@@ -2516,9 +2500,9 @@ var Li = a({
|
|
|
2516
2500
|
title: "Down fractal",
|
|
2517
2501
|
offset: -2
|
|
2518
2502
|
})],
|
|
2519
|
-
build: (e) => [
|
|
2503
|
+
build: (e) => [Pi(e, e.high, !0), Pi(e, e.low, !1)],
|
|
2520
2504
|
reference: "TradingView Williams Fractals (n = 2): high[n] strictly above the n bars after it, and above the bars before it allowing up to four tied equal highs followed by a strictly lower one; mirrored for lows. Confirmed n bars late."
|
|
2521
|
-
}),
|
|
2505
|
+
}), Ii = a({
|
|
2522
2506
|
id: "zigzag",
|
|
2523
2507
|
name: "ZigZag",
|
|
2524
2508
|
family: "tv",
|
|
@@ -2559,27 +2543,27 @@ var Li = a({
|
|
|
2559
2543
|
];
|
|
2560
2544
|
},
|
|
2561
2545
|
reference: "ZigZag as defined in this file's header: percentage-reversal pivots on high/low with a minimum spacing in bars, confirmed causally"
|
|
2562
|
-
}),
|
|
2563
|
-
accelerator: () =>
|
|
2564
|
-
awesome: () =>
|
|
2565
|
-
bullBearPower: () =>
|
|
2566
|
-
choppiness: () =>
|
|
2567
|
-
connorsRsi: () =>
|
|
2568
|
-
coppock: () =>
|
|
2569
|
-
dpo: () =>
|
|
2570
|
-
fisher: () =>
|
|
2571
|
-
kst: () =>
|
|
2572
|
-
massIndex: () =>
|
|
2573
|
-
rankCorr: () =>
|
|
2574
|
-
rviVigor: () =>
|
|
2575
|
-
rviVolatility: () =>
|
|
2576
|
-
schaffTc: () =>
|
|
2577
|
-
smiErgodic: () =>
|
|
2578
|
-
stochTv: () =>
|
|
2579
|
-
tsi: () =>
|
|
2580
|
-
vortex: () =>
|
|
2546
|
+
}), Li = /* @__PURE__ */ h({
|
|
2547
|
+
accelerator: () => aa,
|
|
2548
|
+
awesome: () => ia,
|
|
2549
|
+
bullBearPower: () => na,
|
|
2550
|
+
choppiness: () => Zi,
|
|
2551
|
+
connorsRsi: () => Xi,
|
|
2552
|
+
coppock: () => Yi,
|
|
2553
|
+
dpo: () => sa,
|
|
2554
|
+
fisher: () => Gi,
|
|
2555
|
+
kst: () => Ki,
|
|
2556
|
+
massIndex: () => oa,
|
|
2557
|
+
rankCorr: () => ta,
|
|
2558
|
+
rviVigor: () => Qi,
|
|
2559
|
+
rviVolatility: () => $i,
|
|
2560
|
+
schaffTc: () => ca,
|
|
2561
|
+
smiErgodic: () => ea,
|
|
2562
|
+
stochTv: () => la,
|
|
2563
|
+
tsi: () => qi,
|
|
2564
|
+
vortex: () => Ji
|
|
2581
2565
|
}), Q = NaN;
|
|
2582
|
-
function
|
|
2566
|
+
function Ri(e, t, n) {
|
|
2583
2567
|
return e.node((e, r, i) => {
|
|
2584
2568
|
let a = t.v, o = e.v;
|
|
2585
2569
|
for (let e = r; e < i; e++) {
|
|
@@ -2588,17 +2572,17 @@ function Bi(e, t, n) {
|
|
|
2588
2572
|
}
|
|
2589
2573
|
});
|
|
2590
2574
|
}
|
|
2591
|
-
function
|
|
2575
|
+
function zi(e, t, n) {
|
|
2592
2576
|
let r = e.change(t, 1), i = e.map(r, (e) => e > 0 ? e : e === e ? 0 : Q), a = e.map(r, (e) => e < 0 ? -e : e === e ? 0 : Q), o = e.rma(i, n), s = e.rma(a, n);
|
|
2593
2577
|
return e.map2(o, s, (e, t) => e !== e || t !== t ? Q : t === 0 ? 100 : e === 0 ? 0 : 100 - 100 / (1 + e / t));
|
|
2594
2578
|
}
|
|
2595
|
-
function
|
|
2579
|
+
function Bi(e, t, n, r) {
|
|
2596
2580
|
return e.ema(e.ema(t, n), r);
|
|
2597
2581
|
}
|
|
2598
|
-
function
|
|
2582
|
+
function Vi(e, t) {
|
|
2599
2583
|
return e.calc((e) => e >= 3 ? (t.v[e] + 2 * t.v[e - 1] + 2 * t.v[e - 2] + t.v[e - 3]) / 6 : Q);
|
|
2600
2584
|
}
|
|
2601
|
-
function
|
|
2585
|
+
function Hi(e) {
|
|
2602
2586
|
let { high: t, low: n, close: r } = e;
|
|
2603
2587
|
return e.calc((e) => {
|
|
2604
2588
|
let i = t.v[e], a = n.v[e];
|
|
@@ -2607,14 +2591,14 @@ function Wi(e) {
|
|
|
2607
2591
|
return Math.max(i - a, Math.abs(i - o), Math.abs(a - o));
|
|
2608
2592
|
});
|
|
2609
2593
|
}
|
|
2610
|
-
function
|
|
2594
|
+
function Ui(e, t) {
|
|
2611
2595
|
let n = e.change(t, 1);
|
|
2612
2596
|
return {
|
|
2613
2597
|
up: e.map2(t, n, (e, t) => t > 0 ? e : Q),
|
|
2614
2598
|
down: e.map2(t, n, (e, t) => t <= 0 ? e : Q)
|
|
2615
2599
|
};
|
|
2616
2600
|
}
|
|
2617
|
-
function
|
|
2601
|
+
function Wi(e, t, n) {
|
|
2618
2602
|
let r = e.highest(t, n), i = e.lowest(t, n);
|
|
2619
2603
|
return e.node((e, n, a) => {
|
|
2620
2604
|
let o = t.v, s = r.v, c = i.v, l = e.v;
|
|
@@ -2624,7 +2608,7 @@ function Ki(e, t, n) {
|
|
|
2624
2608
|
}
|
|
2625
2609
|
});
|
|
2626
2610
|
}
|
|
2627
|
-
var
|
|
2611
|
+
var Gi = a({
|
|
2628
2612
|
id: "fisher",
|
|
2629
2613
|
name: "Fisher Transform",
|
|
2630
2614
|
family: "tv",
|
|
@@ -2665,7 +2649,7 @@ var qi = a({
|
|
|
2665
2649
|
return [o, e.lag(o, 1)];
|
|
2666
2650
|
},
|
|
2667
2651
|
reference: "TradingView 'Fisher Transform' (Pine v5): value = round(0.66 ((hl2 - lowest) / (highest - lowest) - 0.5) + 0.67 nz(value[1])), fish = 0.5 ln((1 + value) / (1 - value)) + 0.5 nz(fish[1]); trigger = fish[1]"
|
|
2668
|
-
}),
|
|
2652
|
+
}), Ki = a({
|
|
2669
2653
|
id: "kst",
|
|
2670
2654
|
name: "Know Sure Thing",
|
|
2671
2655
|
family: "tv",
|
|
@@ -2696,11 +2680,11 @@ var qi = a({
|
|
|
2696
2680
|
2,
|
|
2697
2681
|
3,
|
|
2698
2682
|
4
|
|
2699
|
-
].map((r) => e.sma(
|
|
2683
|
+
].map((r) => e.sma(Ri(e, n, t[`roc${r}`]), t[`sma${r}`])), i = e.calc((e) => r[0].v[e] + 2 * r[1].v[e] + 3 * r[2].v[e] + 4 * r[3].v[e]);
|
|
2700
2684
|
return [i, e.sma(i, t.signal)];
|
|
2701
2685
|
},
|
|
2702
2686
|
reference: "TradingView 'Know Sure Thing': kst = sma(roc(c,10),10) + 2 sma(roc(c,15),10) + 3 sma(roc(c,20),10) + 4 sma(roc(c,30),15); signal = sma(kst, 9)"
|
|
2703
|
-
}),
|
|
2687
|
+
}), qi = a({
|
|
2704
2688
|
id: "tsi",
|
|
2705
2689
|
name: "True Strength Index",
|
|
2706
2690
|
family: "tv",
|
|
@@ -2720,11 +2704,11 @@ var qi = a({
|
|
|
2720
2704
|
],
|
|
2721
2705
|
label: (e) => `${e.long} ${e.short} ${e.signal}`,
|
|
2722
2706
|
build: (e, t) => {
|
|
2723
|
-
let n = e.change(e.src(t.source), 1), r =
|
|
2707
|
+
let n = e.change(e.src(t.source), 1), r = Bi(e, n, t.long, t.short), i = Bi(e, e.abs(n), t.long, t.short), a = e.mul(e.div(r, i), 100);
|
|
2724
2708
|
return [a, e.ema(a, t.signal)];
|
|
2725
2709
|
},
|
|
2726
2710
|
reference: "TradingView 'True Strength Index' (Pine v5): 100 ema(ema(change(src), long), short) / ema(ema(abs(change(src)), long), short); signal = ema(tsi, 13)"
|
|
2727
|
-
}),
|
|
2711
|
+
}), Ji = a({
|
|
2728
2712
|
id: "vortex",
|
|
2729
2713
|
name: "Vortex Indicator",
|
|
2730
2714
|
family: "tv",
|
|
@@ -2735,11 +2719,11 @@ var qi = a({
|
|
|
2735
2719
|
plots: [p("viPlus", f.blue, { title: "VI+" }), p("viMinus", f.red, { title: "VI-" })],
|
|
2736
2720
|
label: (e) => `${e.length}`,
|
|
2737
2721
|
build: (e, t) => {
|
|
2738
|
-
let { high: n, low: r } = e, i = e.calc((e) => e >= 1 ? Math.abs(n.v[e] - r.v[e - 1]) : Q), a = e.calc((e) => e >= 1 ? Math.abs(r.v[e] - n.v[e - 1]) : Q), o = e.sum(
|
|
2722
|
+
let { high: n, low: r } = e, i = e.calc((e) => e >= 1 ? Math.abs(n.v[e] - r.v[e - 1]) : Q), a = e.calc((e) => e >= 1 ? Math.abs(r.v[e] - n.v[e - 1]) : Q), o = e.sum(Hi(e), t.length);
|
|
2739
2723
|
return [e.div(e.sum(i, t.length), o), e.div(e.sum(a, t.length), o)];
|
|
2740
2724
|
},
|
|
2741
2725
|
reference: "TradingView 'Vortex Indicator' (Pine v5): VI+ = sum(|high - low[1]|, n) / sum(atr(1), n); VI- = sum(|low - high[1]|, n) / sum(atr(1), n)"
|
|
2742
|
-
}),
|
|
2726
|
+
}), Yi = a({
|
|
2743
2727
|
id: "coppock",
|
|
2744
2728
|
name: "Coppock Curve",
|
|
2745
2729
|
family: "tv",
|
|
@@ -2756,10 +2740,10 @@ var qi = a({
|
|
|
2756
2740
|
label: (e) => `${e.length} ${e.longRoc} ${e.shortRoc}`,
|
|
2757
2741
|
build: (e, t) => {
|
|
2758
2742
|
let n = e.src(t.source);
|
|
2759
|
-
return [e.wma(e.add(
|
|
2743
|
+
return [e.wma(e.add(Ri(e, n, t.longRoc), Ri(e, n, t.shortRoc)), t.length)];
|
|
2760
2744
|
},
|
|
2761
2745
|
reference: "TradingView 'Coppock Curve' (Pine v5): wma(roc(src, 14) + roc(src, 11), 10)"
|
|
2762
|
-
}),
|
|
2746
|
+
}), Xi = a({
|
|
2763
2747
|
id: "connors-rsi",
|
|
2764
2748
|
name: "Connors RSI",
|
|
2765
2749
|
family: "tv",
|
|
@@ -2780,7 +2764,7 @@ var qi = a({
|
|
|
2780
2764
|
],
|
|
2781
2765
|
label: (e) => `${e.rsiLength} ${e.updownLength} ${e.rocLength}`,
|
|
2782
2766
|
build: (e, t) => {
|
|
2783
|
-
let n = e.src(t.source), r =
|
|
2767
|
+
let n = e.src(t.source), r = zi(e, n, t.rsiLength), i = zi(e, e.node((e, t, r) => {
|
|
2784
2768
|
let i = n.v, a = e.v;
|
|
2785
2769
|
for (let e = t; e < r; e++) {
|
|
2786
2770
|
if (e === 0 || i[e] !== i[e] || i[e - 1] !== i[e - 1]) {
|
|
@@ -2790,7 +2774,7 @@ var qi = a({
|
|
|
2790
2774
|
let t = a[e - 1] === a[e - 1] ? a[e - 1] : 0, n = i[e], r = i[e - 1];
|
|
2791
2775
|
a[e] = n === r ? 0 : n > r ? t <= 0 ? 1 : t + 1 : t >= 0 ? -1 : t - 1;
|
|
2792
2776
|
}
|
|
2793
|
-
}), t.updownLength), a =
|
|
2777
|
+
}), t.updownLength), a = Ri(e, n, 1), o = e.validRun(a), s = e.node((e, n, r) => {
|
|
2794
2778
|
let i = a.v, s = o.v, c = e.v;
|
|
2795
2779
|
for (let e = n; e < r; e++) {
|
|
2796
2780
|
if (s[e] < t.rocLength + 1) {
|
|
@@ -2805,7 +2789,7 @@ var qi = a({
|
|
|
2805
2789
|
return [e.calc((e) => (r.v[e] + i.v[e] + s.v[e]) / 3)];
|
|
2806
2790
|
},
|
|
2807
2791
|
reference: "TradingView 'Connors RSI' (Pine v5): avg(rsi(src, 3), rsi(updown streak, 2), percentrank(roc(src, 1), 100)); the first bar has no streak (absent)"
|
|
2808
|
-
}),
|
|
2792
|
+
}), Zi = a({
|
|
2809
2793
|
id: "choppiness",
|
|
2810
2794
|
name: "Choppiness Index",
|
|
2811
2795
|
family: "tv",
|
|
@@ -2820,11 +2804,11 @@ var qi = a({
|
|
|
2820
2804
|
],
|
|
2821
2805
|
label: (e) => `${e.length}`,
|
|
2822
2806
|
build: (e, t) => {
|
|
2823
|
-
let n = e.sum(
|
|
2807
|
+
let n = e.sum(Hi(e), t.length), r = e.sub(e.highest(e.high, t.length), e.lowest(e.low, t.length)), i = e.div(n, r), a = 100 / Math.log10(t.length);
|
|
2824
2808
|
return [e.map(i, (e) => e > 0 ? a * Math.log10(e) : Q)];
|
|
2825
2809
|
},
|
|
2826
2810
|
reference: "TradingView 'Choppiness Index' (Pine v5): 100 log10(sum(atr(1), n) / (highest(high, n) - lowest(low, n))) / log10(n)"
|
|
2827
|
-
}),
|
|
2811
|
+
}), Qi = a({
|
|
2828
2812
|
id: "rvi-vigor",
|
|
2829
2813
|
name: "Relative Vigor Index",
|
|
2830
2814
|
family: "tv",
|
|
@@ -2835,11 +2819,11 @@ var qi = a({
|
|
|
2835
2819
|
plots: [p("rvi", f.green), p("signal", f.red)],
|
|
2836
2820
|
label: (e) => `${e.length}`,
|
|
2837
2821
|
build: (e, t) => {
|
|
2838
|
-
let n = e.sma(
|
|
2839
|
-
return [i,
|
|
2822
|
+
let n = e.sma(Vi(e, e.sub(e.close, e.open)), t.length), r = e.sma(Vi(e, e.sub(e.high, e.low)), t.length), i = e.div(n, r);
|
|
2823
|
+
return [i, Vi(e, i)];
|
|
2840
2824
|
},
|
|
2841
2825
|
reference: "TradingView 'Relative Vigor Index' (Pine v5): rvi = sma(swma(close - open), n) / sma(swma(high - low), n); signal = swma(rvi)"
|
|
2842
|
-
}),
|
|
2826
|
+
}), $i = a({
|
|
2843
2827
|
id: "rvi-volatility",
|
|
2844
2828
|
name: "Relative Volatility Index",
|
|
2845
2829
|
family: "tv",
|
|
@@ -2864,7 +2848,7 @@ var qi = a({
|
|
|
2864
2848
|
return [e.mul(e.div(c, e.add(c, l)), 100)];
|
|
2865
2849
|
},
|
|
2866
2850
|
reference: "TradingView 'Relative Volatility Index' (Pine v5): upper = ema(change(src) <= 0 ? 0 : stdev(src, 10), 14), lower = ema(change(src) > 0 ? 0 : stdev, 14), rvi = 100 upper / (upper + lower); ma 'rma' gives Dorsey's Wilder form"
|
|
2867
|
-
}),
|
|
2851
|
+
}), ea = a({
|
|
2868
2852
|
id: "smi-ergodic",
|
|
2869
2853
|
name: "SMI Ergodic Indicator/Oscillator",
|
|
2870
2854
|
family: "tv",
|
|
@@ -2889,7 +2873,7 @@ var qi = a({
|
|
|
2889
2873
|
],
|
|
2890
2874
|
label: (e) => `${e.longLength} ${e.shortLength} ${e.signal}`,
|
|
2891
2875
|
build: (e, t) => {
|
|
2892
|
-
let n = e.change(e.src(t.source), 1), r = e.mul(e.div(
|
|
2876
|
+
let n = e.change(e.src(t.source), 1), r = e.mul(e.div(Bi(e, n, t.longLength, t.shortLength), Bi(e, e.abs(n), t.longLength, t.shortLength)), 100), i = e.ema(r, t.signal);
|
|
2893
2877
|
return [
|
|
2894
2878
|
r,
|
|
2895
2879
|
i,
|
|
@@ -2897,7 +2881,7 @@ var qi = a({
|
|
|
2897
2881
|
];
|
|
2898
2882
|
},
|
|
2899
2883
|
reference: "TradingView 'SMI Ergodic Indicator/Oscillator' (Pine v5): erg = 100 ema(ema(change, long 5), short 20) / ema(ema(abs(change), 5), 20); signal = ema(erg, 5); oscillator = erg - signal"
|
|
2900
|
-
}),
|
|
2884
|
+
}), ta = a({
|
|
2901
2885
|
id: "rank-corr",
|
|
2902
2886
|
name: "Rank Correlation vs Time",
|
|
2903
2887
|
family: "tv",
|
|
@@ -2932,7 +2916,7 @@ var qi = a({
|
|
|
2932
2916
|
})];
|
|
2933
2917
|
},
|
|
2934
2918
|
reference: "Spearman's rho of the source against the bar index over a rolling window (not a TradingView built-in): Pearson correlation of the ranks, tied source values take the mean rank; a window of all equal values is absent"
|
|
2935
|
-
}),
|
|
2919
|
+
}), na = a({
|
|
2936
2920
|
id: "bull-bear-power",
|
|
2937
2921
|
name: "Bull Bear Power",
|
|
2938
2922
|
family: "tv",
|
|
@@ -2952,11 +2936,11 @@ var qi = a({
|
|
|
2952
2936
|
},
|
|
2953
2937
|
reference: "Elder Ray (TradingView 'Bull Bear Power'): bull = high - ema(close, 13), bear = low - ema(close, 13)"
|
|
2954
2938
|
});
|
|
2955
|
-
function
|
|
2939
|
+
function ra(e, t, n) {
|
|
2956
2940
|
let r = e.src("hl2");
|
|
2957
2941
|
return e.sub(e.sma(r, t), e.sma(r, n));
|
|
2958
2942
|
}
|
|
2959
|
-
var
|
|
2943
|
+
var ia = a({
|
|
2960
2944
|
id: "awesome",
|
|
2961
2945
|
name: "Awesome Oscillator",
|
|
2962
2946
|
family: "tv",
|
|
@@ -2972,7 +2956,7 @@ var oa = a({
|
|
|
2972
2956
|
label: () => "",
|
|
2973
2957
|
build: (e, t) => {
|
|
2974
2958
|
if (t.fast >= t.slow) throw RangeError(`awesome: fast (${t.fast}) must be below slow (${t.slow})`);
|
|
2975
|
-
let n =
|
|
2959
|
+
let n = ra(e, t.fast, t.slow), { up: r, down: i } = Ui(e, n);
|
|
2976
2960
|
return [
|
|
2977
2961
|
n,
|
|
2978
2962
|
r,
|
|
@@ -2980,7 +2964,7 @@ var oa = a({
|
|
|
2980
2964
|
];
|
|
2981
2965
|
},
|
|
2982
2966
|
reference: "TradingView 'Awesome Oscillator': sma(hl2, 5) - sma(hl2, 34); bar green when above the previous bar's value, red otherwise"
|
|
2983
|
-
}),
|
|
2967
|
+
}), aa = a({
|
|
2984
2968
|
id: "accelerator",
|
|
2985
2969
|
name: "Accelerator Oscillator",
|
|
2986
2970
|
family: "tv",
|
|
@@ -3000,7 +2984,7 @@ var oa = a({
|
|
|
3000
2984
|
label: () => "",
|
|
3001
2985
|
build: (e, t) => {
|
|
3002
2986
|
if (t.fast >= t.slow) throw RangeError(`accelerator: fast (${t.fast}) must be below slow (${t.slow})`);
|
|
3003
|
-
let n =
|
|
2987
|
+
let n = ra(e, t.fast, t.slow), r = e.sub(n, e.sma(n, t.signal)), { up: i, down: a } = Ui(e, r);
|
|
3004
2988
|
return [
|
|
3005
2989
|
r,
|
|
3006
2990
|
i,
|
|
@@ -3008,7 +2992,7 @@ var oa = a({
|
|
|
3008
2992
|
];
|
|
3009
2993
|
},
|
|
3010
2994
|
reference: "Bill Williams / TradingView 'Accelerator Oscillator': AO - sma(AO, 5); bar green when above the previous bar's value, red otherwise"
|
|
3011
|
-
}),
|
|
2995
|
+
}), oa = a({
|
|
3012
2996
|
id: "mass-index",
|
|
3013
2997
|
name: "Mass Index",
|
|
3014
2998
|
family: "tv",
|
|
@@ -3023,7 +3007,7 @@ var oa = a({
|
|
|
3023
3007
|
return [e.sum(e.div(n, r), t.length)];
|
|
3024
3008
|
},
|
|
3025
3009
|
reference: "TradingView 'Mass Index' (Pine v5): sum(ema(high - low, 9) / ema(ema(high - low, 9), 9), length), length 10 (Dorsey's 25 via the input)"
|
|
3026
|
-
}),
|
|
3010
|
+
}), sa = a({
|
|
3027
3011
|
id: "dpo",
|
|
3028
3012
|
name: "Detrended Price Oscillator",
|
|
3029
3013
|
family: "tv",
|
|
@@ -3042,7 +3026,7 @@ var oa = a({
|
|
|
3042
3026
|
return [t.centered ? e.calc((e) => e >= r ? n.v[e - r] - i.v[e] : Q) : e.calc((e) => e >= r ? n.v[e] - i.v[e - r] : Q)];
|
|
3043
3027
|
},
|
|
3044
3028
|
reference: "TradingView 'Detrended Price Oscillator' (Pine v5): barsback = floor(n/2) + 1; dpo = src - sma(src, n)[barsback]; centered: src[barsback] - sma(src, n), which TradingView draws shifted back by barsback bars (here the value stays on the bar that computes it)"
|
|
3045
|
-
}),
|
|
3029
|
+
}), ca = a({
|
|
3046
3030
|
id: "schaff-tc",
|
|
3047
3031
|
name: "Schaff Trend Cycle",
|
|
3048
3032
|
family: "tv",
|
|
@@ -3064,11 +3048,11 @@ var oa = a({
|
|
|
3064
3048
|
],
|
|
3065
3049
|
label: (e) => `${e.fast} ${e.slow} ${e.cycle}`,
|
|
3066
3050
|
build: (e, t) => {
|
|
3067
|
-
let n = e.src(t.source), r = e.sub(e.ema(n, t.fast), e.ema(n, t.slow)), i = e.ema(
|
|
3051
|
+
let n = e.src(t.source), r = e.sub(e.ema(n, t.fast), e.ema(n, t.slow)), i = e.ema(Wi(e, r, t.cycle), t.d1), a = e.ema(Wi(e, i, t.cycle), t.d2);
|
|
3068
3052
|
return [e.map(a, (e) => e > 100 ? 100 : e < 0 ? 0 : e)];
|
|
3069
3053
|
},
|
|
3070
3054
|
reference: "TradingView 'Schaff Trend Cycle' (reproduced from the published script, not fetched): macd = ema(src,23) - ema(src,50); k = stoch(macd,10); d = ema(k,3); kd = stoch(d,10); stc = clamp(ema(kd,3), 0, 100); a flat range carries the last stoch (fixnan) and warm-up stays absent instead of nz-ed to 0"
|
|
3071
|
-
}),
|
|
3055
|
+
}), la = a({
|
|
3072
3056
|
id: "stoch-tv",
|
|
3073
3057
|
name: "Stochastic",
|
|
3074
3058
|
family: "tv",
|
|
@@ -3093,47 +3077,48 @@ var oa = a({
|
|
|
3093
3077
|
return [a, e.sma(a, t.dLength)];
|
|
3094
3078
|
},
|
|
3095
3079
|
reference: "TradingView 'Stochastic' (Pine v5): k = sma(stoch(close, high, low, 14), 1), d = sma(k, 3); TA-Lib STOCH with fastk 14 / slowk sma 1 / slowd sma 3 (TA-Lib gives 0 on a flat range, here it is absent)"
|
|
3096
|
-
}),
|
|
3097
|
-
adr: () =>
|
|
3098
|
-
anchoredVwap: () =>
|
|
3099
|
-
|
|
3100
|
-
|
|
3101
|
-
|
|
3102
|
-
|
|
3103
|
-
|
|
3104
|
-
|
|
3105
|
-
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
|
|
3111
|
-
|
|
3080
|
+
}), ua = /* @__PURE__ */ h({
|
|
3081
|
+
adr: () => Ma,
|
|
3082
|
+
anchoredVwap: () => Ea,
|
|
3083
|
+
barsPerYear: () => Na,
|
|
3084
|
+
chaikinMf: () => Ca,
|
|
3085
|
+
elderForce: () => xa,
|
|
3086
|
+
eom: () => Sa,
|
|
3087
|
+
histVol: () => ja,
|
|
3088
|
+
klinger: () => wa,
|
|
3089
|
+
netVolume: () => ba,
|
|
3090
|
+
pivotPoints: () => Aa,
|
|
3091
|
+
pvt: () => ya,
|
|
3092
|
+
volume: () => _a,
|
|
3093
|
+
volumeOsc: () => va,
|
|
3094
|
+
vwap: () => Ta
|
|
3095
|
+
}), $ = NaN, da = 864e5;
|
|
3096
|
+
function fa(e) {
|
|
3112
3097
|
let t = e + 719468, n = Math.floor(t / 146097), r = t - n * 146097, i = Math.floor((r - Math.floor(r / 1460) + Math.floor(r / 36524) - Math.floor(r / 146096)) / 365), a = r - (365 * i + Math.floor(i / 4) - Math.floor(i / 100)), o = Math.floor((5 * a + 2) / 153), s = o < 10 ? o + 3 : o - 9;
|
|
3113
3098
|
return [i + n * 400 + +(s <= 2), s - 1];
|
|
3114
3099
|
}
|
|
3115
|
-
function
|
|
3100
|
+
function pa(e, t, n) {
|
|
3116
3101
|
let r = e.time, i = n * 6e4;
|
|
3117
3102
|
return e.calc((e) => {
|
|
3118
|
-
let n = Math.floor((r.v[e] + i) /
|
|
3103
|
+
let n = Math.floor((r.v[e] + i) / da);
|
|
3119
3104
|
switch (t) {
|
|
3120
3105
|
case "day": return n;
|
|
3121
3106
|
case "week": return Math.floor((n + 3) / 7);
|
|
3122
3107
|
case "month": {
|
|
3123
|
-
let [e, t] =
|
|
3108
|
+
let [e, t] = fa(n);
|
|
3124
3109
|
return e * 12 + t;
|
|
3125
3110
|
}
|
|
3126
|
-
case "year": return
|
|
3111
|
+
case "year": return fa(n)[0];
|
|
3127
3112
|
}
|
|
3128
3113
|
});
|
|
3129
3114
|
}
|
|
3130
|
-
function
|
|
3115
|
+
function ma(e, t, n, r = () => !0) {
|
|
3131
3116
|
return e.node((e, i, a) => {
|
|
3132
3117
|
let o = e.v;
|
|
3133
3118
|
for (let e = i; e < a; e++) r(e) ? o[e] = (n(e) ? 0 : o[e - 1]) + t(e) : o[e] = $;
|
|
3134
3119
|
});
|
|
3135
3120
|
}
|
|
3136
|
-
function
|
|
3121
|
+
function ha(e, t, n, r, i) {
|
|
3137
3122
|
let a = e.calc((e) => n.v[e] > 0 ? t.v[e] / n.v[e] : $), o = e.calc((e) => {
|
|
3138
3123
|
let t = a.v[e], i = r.v[e] / n.v[e] - t * t;
|
|
3139
3124
|
return t === t ? i > 0 ? Math.sqrt(i) : 0 : $;
|
|
@@ -3144,7 +3129,7 @@ function _a(e, t, n, r, i) {
|
|
|
3144
3129
|
e.calc((e) => a.v[e] - i * o.v[e])
|
|
3145
3130
|
];
|
|
3146
3131
|
}
|
|
3147
|
-
var
|
|
3132
|
+
var ga = o("utcOffsetMinutes", 0, -720, 840, "UTC offset (minutes)"), _a = a({
|
|
3148
3133
|
id: "volume",
|
|
3149
3134
|
name: "Volume",
|
|
3150
3135
|
family: "tv",
|
|
@@ -3173,7 +3158,7 @@ var va = o("utcOffsetMinutes", 0, -720, 840, "UTC offset (minutes)"), ya = a({
|
|
|
3173
3158
|
];
|
|
3174
3159
|
},
|
|
3175
3160
|
reference: "TradingView Volume: histogram of volume, green when close > open, red otherwise; MA is ta.sma(volume, 20). Verified against TA-Lib SMA for the MA."
|
|
3176
|
-
}),
|
|
3161
|
+
}), va = a({
|
|
3177
3162
|
id: "volume-osc",
|
|
3178
3163
|
name: "Volume Oscillator",
|
|
3179
3164
|
family: "tv",
|
|
@@ -3188,7 +3173,7 @@ var va = o("utcOffsetMinutes", 0, -720, 840, "UTC offset (minutes)"), ya = a({
|
|
|
3188
3173
|
return [e.map2(n, r, (e, t) => t === 0 ? $ : 100 * (e - t) / t)];
|
|
3189
3174
|
},
|
|
3190
3175
|
reference: "TradingView Volume Oscillator: 100 * (ta.ema(volume, 5) - ta.ema(volume, 10)) / ta.ema(volume, 10). Equals TA-Lib PPO(volume, 5, 10, EMA)."
|
|
3191
|
-
}),
|
|
3176
|
+
}), ya = a({
|
|
3192
3177
|
id: "pvt",
|
|
3193
3178
|
name: "Price Volume Trend",
|
|
3194
3179
|
family: "tv",
|
|
@@ -3199,10 +3184,10 @@ var va = o("utcOffsetMinutes", 0, -720, 840, "UTC offset (minutes)"), ya = a({
|
|
|
3199
3184
|
plots: [p("pvt", f.blue, { title: "PVT" })],
|
|
3200
3185
|
build: (e) => {
|
|
3201
3186
|
let { close: t, volume: n } = e, r = e.calc((e) => e === 0 ? $ : (t.v[e] - t.v[e - 1]) / t.v[e - 1] * n.v[e]);
|
|
3202
|
-
return [
|
|
3187
|
+
return [ma(e, (e) => r.v[e], (e) => e <= 1, (e) => e >= 1)];
|
|
3203
3188
|
},
|
|
3204
3189
|
reference: "Pine ta.pvt = ta.cum(ta.change(close) / close[1] * volume)"
|
|
3205
|
-
}),
|
|
3190
|
+
}), ba = a({
|
|
3206
3191
|
id: "net-volume",
|
|
3207
3192
|
name: "Net Volume",
|
|
3208
3193
|
family: "tv",
|
|
@@ -3220,7 +3205,7 @@ var va = o("utcOffsetMinutes", 0, -720, 840, "UTC offset (minutes)"), ya = a({
|
|
|
3220
3205
|
})];
|
|
3221
3206
|
},
|
|
3222
3207
|
reference: "TradingView Net Volume: volume signed by the sign of ta.change(close) (zero on an unchanged close)"
|
|
3223
|
-
}),
|
|
3208
|
+
}), xa = a({
|
|
3224
3209
|
id: "elder-force",
|
|
3225
3210
|
name: "Elder's Force Index",
|
|
3226
3211
|
family: "tv",
|
|
@@ -3235,7 +3220,7 @@ var va = o("utcOffsetMinutes", 0, -720, 840, "UTC offset (minutes)"), ya = a({
|
|
|
3235
3220
|
return [e.ema(i, t.length)];
|
|
3236
3221
|
},
|
|
3237
3222
|
reference: "TradingView Elder's Force Index: ta.ema(ta.change(close) * volume, 13)"
|
|
3238
|
-
}),
|
|
3223
|
+
}), Sa = a({
|
|
3239
3224
|
id: "eom",
|
|
3240
3225
|
name: "Ease of Movement",
|
|
3241
3226
|
family: "tv",
|
|
@@ -3250,7 +3235,7 @@ var va = o("utcOffsetMinutes", 0, -720, 840, "UTC offset (minutes)"), ya = a({
|
|
|
3250
3235
|
return [e.sma(e.div(o, i), t.length)];
|
|
3251
3236
|
},
|
|
3252
3237
|
reference: "TradingView Ease of Movement: ta.sma(10000 * ta.change(hl2) * (high - low) / volume, 14); zero volume is absent"
|
|
3253
|
-
}),
|
|
3238
|
+
}), Ca = a({
|
|
3254
3239
|
id: "chaikin-mf",
|
|
3255
3240
|
name: "Chaikin Money Flow",
|
|
3256
3241
|
family: "tv",
|
|
@@ -3268,7 +3253,7 @@ var va = o("utcOffsetMinutes", 0, -720, 840, "UTC offset (minutes)"), ya = a({
|
|
|
3268
3253
|
return [e.div(e.sum(o, t.length), e.sum(a, t.length))];
|
|
3269
3254
|
},
|
|
3270
3255
|
reference: "TradingView Chaikin Money Flow: sum(ad, 20) / sum(volume, 20), ad = (2*close - low - high) / (high - low) * volume (0 when high == low)"
|
|
3271
|
-
}),
|
|
3256
|
+
}), wa = a({
|
|
3272
3257
|
id: "klinger",
|
|
3273
3258
|
name: "Klinger Oscillator",
|
|
3274
3259
|
family: "tv",
|
|
@@ -3287,9 +3272,9 @@ var va = o("utcOffsetMinutes", 0, -720, 840, "UTC offset (minutes)"), ya = a({
|
|
|
3287
3272
|
return [a, e.ema(a, t.signal)];
|
|
3288
3273
|
},
|
|
3289
3274
|
reference: "TradingView Klinger Oscillator: sv = ta.change(hlc3) >= 0 ? volume : -volume; kvo = ta.ema(sv, 34) - ta.ema(sv, 55); signal = ta.ema(kvo, 13)"
|
|
3290
|
-
}),
|
|
3275
|
+
}), Ta = a({
|
|
3291
3276
|
id: "vwap",
|
|
3292
|
-
name: "VWAP",
|
|
3277
|
+
name: "Session VWAP",
|
|
3293
3278
|
family: "tv",
|
|
3294
3279
|
needs: "ohlcv",
|
|
3295
3280
|
pane: "overlay",
|
|
@@ -3302,21 +3287,21 @@ var va = o("utcOffsetMinutes", 0, -720, 840, "UTC offset (minutes)"), ya = a({
|
|
|
3302
3287
|
]),
|
|
3303
3288
|
l("hlc3"),
|
|
3304
3289
|
c("bandMult", 1, 0, 100, .1, "Band multiplier"),
|
|
3305
|
-
|
|
3290
|
+
ga
|
|
3306
3291
|
],
|
|
3307
3292
|
columns: [
|
|
3308
3293
|
"vwap",
|
|
3309
3294
|
"upper",
|
|
3310
3295
|
"lower"
|
|
3311
3296
|
],
|
|
3312
|
-
plots: [p("vwap", f.blue, { title: "VWAP" }), s("bands", "upper", "lower", f.green, "rgba(8,153,129,0.1)", "VWAP bands")],
|
|
3297
|
+
plots: [p("vwap", f.blue, { title: "Session VWAP" }), s("bands", "upper", "lower", f.green, "rgba(8,153,129,0.1)", "Session VWAP bands")],
|
|
3313
3298
|
label: (e) => `${e.anchor}`,
|
|
3314
3299
|
build: (e, t) => {
|
|
3315
|
-
let n =
|
|
3316
|
-
return
|
|
3300
|
+
let n = pa(e, t.anchor === "session" ? "day" : t.anchor, t.utcOffsetMinutes), r = e.src(t.source), i = e.volume, a = (e) => e === 0 || n.v[e] !== n.v[e - 1], o = ma(e, (e) => i.v[e], a);
|
|
3301
|
+
return ha(e, ma(e, (e) => r.v[e] * i.v[e], a), o, ma(e, (e) => r.v[e] * r.v[e] * i.v[e], a), t.bandMult);
|
|
3317
3302
|
},
|
|
3318
|
-
reference: "Pine ta.vwap(hlc3, anchor, stdev_mult 1): cumulative sum(src*volume) / sum(volume) restarting at each session/week/month/year; bands = vwap +/- mult * sqrt(sum(volume*src^2)/sum(volume) - vwap^2). Session = calendar day in the exchange time zone."
|
|
3319
|
-
}),
|
|
3303
|
+
reference: "Pine ta.vwap(hlc3, anchor, stdev_mult 1): cumulative sum(src*volume) / sum(volume) restarting at each session/week/month/year; bands = vwap +/- mult * sqrt(sum(volume*src^2)/sum(volume) - vwap^2). Session = calendar day in the exchange time zone. It restarts at each session, which is what a trader means by VWAP intraday; it is never a running average over the whole chart (use anchored-vwap for a start you choose)."
|
|
3304
|
+
}), Ea = a({
|
|
3320
3305
|
id: "anchored-vwap",
|
|
3321
3306
|
name: "Anchored VWAP",
|
|
3322
3307
|
family: "tv",
|
|
@@ -3334,11 +3319,11 @@ var va = o("utcOffsetMinutes", 0, -720, 840, "UTC offset (minutes)"), ya = a({
|
|
|
3334
3319
|
],
|
|
3335
3320
|
plots: [p("vwap", f.orange, { title: "Anchored VWAP" }), s("bands", "upper", "lower", f.orange, "rgba(255,109,0,0.1)", "Anchored VWAP bands")],
|
|
3336
3321
|
build: (e, t) => {
|
|
3337
|
-
let n = e.time, r = e.src(t.source), i = e.volume, a = (e) => n.v[e] >= t.anchorTime, o = (e) => e === 0 || !a(e - 1), s =
|
|
3338
|
-
return
|
|
3322
|
+
let n = e.time, r = e.src(t.source), i = e.volume, a = (e) => n.v[e] >= t.anchorTime, o = (e) => e === 0 || !a(e - 1), s = ma(e, (e) => i.v[e], o, a);
|
|
3323
|
+
return ha(e, ma(e, (e) => r.v[e] * i.v[e], o, a), s, ma(e, (e) => r.v[e] * r.v[e] * i.v[e], o, a), t.bandMult);
|
|
3339
3324
|
},
|
|
3340
3325
|
reference: "TradingView Anchored VWAP: VWAP (hlc3) accumulated from the first bar at or after the anchor time, with stdev bands; earlier bars are absent"
|
|
3341
|
-
}),
|
|
3326
|
+
}), Da = [
|
|
3342
3327
|
"p",
|
|
3343
3328
|
"r1",
|
|
3344
3329
|
"r2",
|
|
@@ -3349,7 +3334,7 @@ var va = o("utcOffsetMinutes", 0, -720, 840, "UTC offset (minutes)"), ya = a({
|
|
|
3349
3334
|
"s3",
|
|
3350
3335
|
"s4"
|
|
3351
3336
|
];
|
|
3352
|
-
function
|
|
3337
|
+
function Oa(e, t, n, r, i) {
|
|
3353
3338
|
let a = {
|
|
3354
3339
|
p: $,
|
|
3355
3340
|
r1: $,
|
|
@@ -3373,7 +3358,7 @@ function Aa(e, t, n, r, i) {
|
|
|
3373
3358
|
let s = (n + r + i) / 3;
|
|
3374
3359
|
return a.p = s, e === "fibonacci" ? (a.r1 = s + .382 * o, a.r2 = s + .618 * o, a.r3 = s + o, a.s1 = s - .382 * o, a.s2 = s - .618 * o, a.s3 = s - o) : e === "classic" ? (a.r1 = 2 * s - r, a.s1 = 2 * s - n, a.r2 = s + o, a.s2 = s - o, a.r3 = s + 2 * o, a.s3 = s - 2 * o, a.r4 = s + 3 * o, a.s4 = s - 3 * o) : (a.r1 = 2 * s - r, a.s1 = 2 * s - n, a.r2 = s + o, a.s2 = s - o, a.r3 = 2 * s + n - 2 * r, a.s3 = 2 * s - (2 * n - r), a.r4 = 3 * s + n - 3 * r, a.s4 = 3 * s - (3 * n - r)), a;
|
|
3375
3360
|
}
|
|
3376
|
-
var
|
|
3361
|
+
var ka = {
|
|
3377
3362
|
p: f.gray,
|
|
3378
3363
|
r1: f.red,
|
|
3379
3364
|
r2: f.red,
|
|
@@ -3383,7 +3368,7 @@ var ja = {
|
|
|
3383
3368
|
s2: f.green,
|
|
3384
3369
|
s3: f.green,
|
|
3385
3370
|
s4: f.green
|
|
3386
|
-
},
|
|
3371
|
+
}, Aa = a({
|
|
3387
3372
|
id: "pivot-points",
|
|
3388
3373
|
name: "Pivot Points Standard",
|
|
3389
3374
|
family: "tv",
|
|
@@ -3404,22 +3389,22 @@ var ja = {
|
|
|
3404
3389
|
"month",
|
|
3405
3390
|
"year"
|
|
3406
3391
|
]),
|
|
3407
|
-
|
|
3392
|
+
ga
|
|
3408
3393
|
],
|
|
3409
|
-
columns: [...
|
|
3410
|
-
plots:
|
|
3394
|
+
columns: [...Da],
|
|
3395
|
+
plots: Da.map((e) => p(e, ka[e], {
|
|
3411
3396
|
title: e.toUpperCase(),
|
|
3412
3397
|
width: 1
|
|
3413
3398
|
})),
|
|
3414
3399
|
label: (e) => `${e.kind} ${e.period}`,
|
|
3415
3400
|
build: (e, t) => {
|
|
3416
|
-
let n =
|
|
3401
|
+
let n = pa(e, t.period, t.utcOffsetMinutes), { open: r, high: i, low: a, close: o } = e, s = e.col(), c = e.col(), l = e.col(), u = e.col(), d = e.col(), f = e.col(), p = e.col(), m = e.col();
|
|
3417
3402
|
return e.node((e, t, h) => {
|
|
3418
3403
|
for (let e = t; e < h; e++) e === 0 || n.v[e] !== n.v[e - 1] ? (e === 0 ? (d.v[e] = $, f.v[e] = $, p.v[e] = $, m.v[e] = $) : (d.v[e] = s.v[e - 1], f.v[e] = c.v[e - 1], p.v[e] = l.v[e - 1], m.v[e] = u.v[e - 1]), s.v[e] = r.v[e], c.v[e] = i.v[e], l.v[e] = a.v[e]) : (d.v[e] = d.v[e - 1], f.v[e] = f.v[e - 1], p.v[e] = p.v[e - 1], m.v[e] = m.v[e - 1], s.v[e] = s.v[e - 1], c.v[e] = Math.max(c.v[e - 1], i.v[e]), l.v[e] = Math.min(l.v[e - 1], a.v[e])), u.v[e] = o.v[e];
|
|
3419
|
-
}),
|
|
3404
|
+
}), Da.map((n) => e.calc((e) => f.v[e] === f.v[e] ? Oa(t.kind, d.v[e], f.v[e], p.v[e], m.v[e])[n] : $));
|
|
3420
3405
|
},
|
|
3421
3406
|
reference: "TradingView Pivot Points Standard (Traditional, Fibonacci, Woodie, Classic, DM, Camarilla) from the previous completed period's open/high/low/close; constant over the current period, absent in the first"
|
|
3422
|
-
}),
|
|
3407
|
+
}), ja = a({
|
|
3423
3408
|
id: "hist-vol",
|
|
3424
3409
|
name: "Historical Volatility",
|
|
3425
3410
|
family: "tv",
|
|
@@ -3438,7 +3423,7 @@ var ja = {
|
|
|
3438
3423
|
return [e.map(e.stdev(r, t.length), (e) => e * i)];
|
|
3439
3424
|
},
|
|
3440
3425
|
reference: "TradingView Historical Volatility: 100 * ta.stdev(ln(close/close[1]), 10) * sqrt(annual / periodDays); ta.stdev is the population deviation (biased). annual defaults to 252 trading days (TradingView's script uses 365)."
|
|
3441
|
-
}),
|
|
3426
|
+
}), Ma = a({
|
|
3442
3427
|
id: "adr",
|
|
3443
3428
|
name: "Average Day Range",
|
|
3444
3429
|
family: "tv",
|
|
@@ -3450,8 +3435,20 @@ var ja = {
|
|
|
3450
3435
|
label: (e) => `${e.length}`,
|
|
3451
3436
|
build: (e, t) => [e.sma(e.sub(e.high, e.low), t.length)],
|
|
3452
3437
|
reference: "TradingView Average Day Range: ta.sma(high - low, 14) on the chart's bars"
|
|
3438
|
+
}), Na = a({
|
|
3439
|
+
id: "bars-per-year",
|
|
3440
|
+
name: "Bars per year",
|
|
3441
|
+
family: "tv",
|
|
3442
|
+
needs: "value",
|
|
3443
|
+
pane: "new",
|
|
3444
|
+
inputs: [l(), ga],
|
|
3445
|
+
columns: ["barsPerYear"],
|
|
3446
|
+
plots: [p("barsPerYear", f.gray, { title: "Bars per year" })],
|
|
3447
|
+
label: (e) => `${e.utcOffsetMinutes}`,
|
|
3448
|
+
build: (e, t) => [e.barsPerYear(t.utcOffsetMinutes)],
|
|
3449
|
+
reference: "Annualisation made causal: intraday = median bars per exchange-clock day over the last 60 finished days x 252; bars of a day or longer = 252 for a daily series without weekends, else 365 days / median spacing. Constant within a day; absent before the first day has finished. Use it for sqrt(bars per year) in Sharpe and annualised volatility instead of a typed number"
|
|
3453
3450
|
});
|
|
3454
3451
|
//#endregion
|
|
3455
|
-
export {
|
|
3452
|
+
export { oi as $, Ct as $n, oe as $r, Xr as $t, ea as A, Vt as An, et as Ar, Tr as At, Fi as B, Qt as Bn, Se as Br, Lr as Bt, Gi as C, Ft as Cn, Be as Cr, _r as Ct, Qi as D, zt as Dn, Ne as Dr, xr as Dt, ta as E, Rt as En, Ae as Er, br as Et, ji as F, on as Fn, tt as Fr, Ar as Ft, mi as G, rn as Gn, Ce as Gr, Hr as Gt, ki as H, Gt as Hn, Ie as Hr, Br as Ht, pi as I, nn as In, De as Ir, Nr as It, hi as J, Mt as Jn, le as Jr, Gr as Jt, yi as K, qt as Kn, Ue as Kr, Ur as Kt, Ti as L, sn as Ln, ye as Lr, Pr as Lt, qi as M, Ut as Mn, _e as Mr, Dr as Mt, Li as N, Nt as Nn, me as Nr, Or as Nt, $i as O, $t as On, je as Or, Sr as Ot, Ji as P, tn as Pn, $e as Pr, kr as Pt, Ai as Q, wt as Qn, te as Qr, Yr as Qt, Ci as R, cn as Rn, be as Rr, Fr as Rt, sa as S, Xt as Sn, Ve as Sr, gr as St, oa as T, Lt as Tn, Ze as Tr, yr as Tt, xi as U, Kt as Un, Le as Ur, zr as Ut, fi as V, Wt as Vn, he as Vr, Rr as Vt, Ei as W, Zt as Wn, Re as Wr, Vr as Wt, wi as X, St as Xn, de as Xr, qr as Xt, Di as Y, jt as Yn, ue as Yr, Kr as Yt, ui as Z, Tt as Zn, re as Zr, Jr as Zt, ia as _, Dn as _n, Ye as _r, dr as _t, xa as a, se as ai, ni as an, ht as ar, $n as at, Xi as b, An as bn, We as br, mr as bt, wa as c, ne as ci, ai as cn, _t as cr, nr as ct, ya as d, jn as dn, lt as dr, ar as dt, ce as ei, Zr as en, vt as er, di as et, ua as f, Fn as fn, ct as fr, or as ft, aa as g, En as gn, rt as gr, ur as gt, Ta as h, Tn as hn, st as hr, lr as ht, Ca as i, ee as ii, ti as in, mt as ir, Qn as it, la as j, Ht as jn, nt as jr, Er as jt, ca as k, Bt as kn, He as kr, Cr as kt, ba as l, In as ln, ut as lr, rr as lt, va as m, wn as mn, ot as mr, cr as mt, Ea as n, pe as ni, $r as nn, Et as nr, Xn as nt, Sa as o, ie as oi, ri as on, ft as or, er as ot, _a as p, un as pn, at as pr, sr as pt, vi as q, Jt as qn, ze as qr, Wr as qt, Na as r, E as ri, ei as rn, Ot as rr, Zn as rt, ja as s, ae as si, ii as sn, gt as sr, tr as st, Ma as t, fe as ti, Qr as tn, Dt as tr, Ii as tt, Aa as u, Pn as un, dt as ur, ir as ut, na as v, kn as vn, Xe as vr, fr as vt, Ki as w, It as wn, ge as wr, vr as wt, Yi as x, Pt as xn, Ge as xr, hr as xt, Zi as y, On as yn, Ee as yr, pr as yt, bi as z, ln as zn, xe as zr, Ir as zt };
|
|
3456
3453
|
|
|
3457
|
-
//# sourceMappingURL=tv-volume-
|
|
3454
|
+
//# sourceMappingURL=tv-volume-BYSbfrVk.js.map
|