Skip to content

Commit 85f23dc

Browse files
author
everget
committed
Add repo
1 parent 6de9a4c commit 85f23dc

19 files changed

+425
-56
lines changed

.gitignore

Lines changed: 6 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,11 @@
1-
# Logs
2-
logs
3-
*.log
4-
npm-debug.log*
5-
yarn-debug.log*
6-
yarn-error.log*
7-
8-
# Runtime data
9-
pids
10-
*.pid
11-
*.seed
12-
*.pid.lock
13-
14-
# Directory for instrumented libs generated by jscoverage/JSCover
15-
lib-cov
16-
17-
# Coverage directory used by tools like istanbul
18-
coverage
19-
20-
# nyc test coverage
21-
.nyc_output
22-
23-
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
24-
.grunt
25-
26-
# Bower dependency directory (https://bower.io/)
27-
bower_components
28-
29-
# node-waf configuration
30-
.lock-wscript
31-
32-
# Compiled binary addons (https://nodejs.org/api/addons.html)
33-
build/Release
34-
35-
# Dependency directories
36-
node_modules/
37-
jspm_packages/
1+
__docs__/
382

39-
# TypeScript v1 declaration files
40-
typings/
41-
42-
# Optional npm cache directory
3+
*.log
4+
*.tgz
435
.npm
44-
45-
# Optional eslint cache
466
.eslintcache
47-
48-
# Optional REPL history
497
.node_repl_history
50-
51-
# Output of 'npm pack'
52-
*.tgz
53-
54-
# Yarn Integrity file
558
.yarn-integrity
56-
57-
# dotenv environment variables file
58-
.env
59-
60-
# next.js build output
61-
.next
9+
.idea
10+
.vscode
11+
.DS_Store

scripts/build.js

Whitespace-only changes.

scripts/updatePineScriptVersion.js

Whitespace-only changes.

src/channels/acceleration_bands.pine

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
//@version=3
2+
// Copyright (c) 2018-present, Alex Orekhov (everget)
3+
// Acceleration Bands indicator script may be freely distributed under the MIT license.
4+
study(title="Acceleration Bands", shorttitle="ABANDS", overlay=true)
5+
6+
length = input(title="Length", type=integer, defval=20)
7+
factor = input(title="Factor", type=float, defval=0.001, step=0.0001)
8+
src = input(title="Source", type=source, defval=close)
9+
10+
mult = 4 * factor * 1000 * (high - low) / (high + low)
11+
12+
upperBandSrc = high * (1 + mult)
13+
upperBand = sma(upperBandSrc, length)
14+
15+
basis = sma(src, length)
16+
17+
lowerBandSrc = low * (1 - mult)
18+
lowerBand = sma(lowerBandSrc, length)
19+
20+
upperBandPlot = plot(upperBand, title="Upper", linewidth=1, color=#138484, transp=0)
21+
22+
plot(basis, title="Basis", linewidth=1, color=#741b47, transp=0)
23+
24+
lowerBandPlot = plot(lowerBand, title="Lower", linewidth=1, color=#138484, transp=0)
25+
26+
fill(upperBandPlot, lowerBandPlot, title="Background", color=color(#ffd966, 84))
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
//@version=3
2+
// Copyright (c) 2018-present, Alex Orekhov (everget)
3+
// Adaptive Laguerre Filter indicator script may be freely distributed under the MIT license.
4+
study("Adaptive Laguerre Filter", shorttitle="ALF", overlay=true)
5+
6+
length = input(title="Length", type=integer, defval=20, minval=1)
7+
medianLength = input(title="Median Length", type=integer, defval=5, minval=1)
8+
src = input(title="Source", type=source, defval=close)
9+
10+
sort(src, i) =>
11+
min = -10000.0
12+
13+
for j = 0 to i - 1
14+
min_local = 10000.0
15+
16+
for l = 0 to medianLength - 1
17+
if (nz(src[l]) <= min)
18+
continue
19+
20+
min_local := min(min_local, max(min, nz(src[l])))
21+
22+
if min_local != 10000
23+
min := min_local
24+
min
25+
26+
median(src, length) =>
27+
result = 0.0
28+
29+
if length % 2 == 0
30+
result := (sort(src, length / 2) + sort(src, length / 2 + 1)) / 2
31+
else
32+
result := sort(src, ceil(length / 2))
33+
34+
diff = 0.0
35+
HH = 0.0
36+
LL = 0.0
37+
38+
alpha = 0.0
39+
L0 = 0.0
40+
L1 = 0.0
41+
L2 = 0.0
42+
L3 = 0.0
43+
alf = 0.0
44+
45+
diff := abs(src - nz(alf[1]))
46+
47+
HH := diff
48+
LL := diff
49+
50+
for i = 0 to length - 1
51+
if nz(diff[i]) > HH
52+
HH := nz(diff[i])
53+
54+
if nz(diff[i]) < LL
55+
LL := nz(diff[i])
56+
57+
alpha := HH - LL != 0 ? median((diff - LL) / (HH - LL), medianLength) : nz(alpha[1])
58+
59+
L0 := alpha * src + (1 - alpha) * nz(L0[1])
60+
L1 := -(1 - alpha) * L0 + nz(L0[1]) + (1 - alpha) * nz(L1[1])
61+
L2 := -(1 - alpha) * L1 + nz(L1[1]) + (1 - alpha) * nz(L2[1])
62+
L3 := -(1 - alpha) * L2 + nz(L2[1]) + (1 - alpha) * nz(L3[1])
63+
64+
alf := (L0 + 2 * L1 + 2 * L2 + L3) / 6
65+
66+
plot(alf, title="ALF", linewidth=2, color=#741b47, transp=0)
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
//@version=3
2+
// Copyright (c) 2018-present, Alex Orekhov (everget)
3+
// Adaptive Moving Average indicator script may be freely distributed under the MIT license.
4+
study("Adaptive Moving Average", shorttitle="AMA", overlay=true)
5+
6+
length = input(title="Length", type=integer, defval=14, minval=1)
7+
fastLength = input(title="Fast MA Length", type=integer, defval=2, minval=1)
8+
slowLength = input(title="Slow MA Length", type=integer, defval=30, minval=1)
9+
showKAMA = input(title="Show KAMA ?", type=bool, defval=true)
10+
src = input(title="Source", type=source, defval=close)
11+
12+
kama(src, length, fastLength, slowLength) =>
13+
change = abs(nz(src[1]) - nz(src[length]))
14+
volatility = sum(abs(src - nz(src[1])), length)
15+
16+
// Efficiency Ratio
17+
ER = iff(volatility != 0, change / volatility, 0)
18+
19+
fastSC = 2 / (fastLength + 1)
20+
slowSC = 2 / (slowLength + 1)
21+
22+
// Smoothing constant
23+
SC = pow((ER * (fastSC - slowSC)) + slowSC, 2)
24+
25+
kama = 0.0
26+
kama := SC * src + (1 - SC) * nz(kama[1])
27+
28+
ama(src, length, fastLength, slowLength) =>
29+
pds = length + 1
30+
fastSC = 2 / (fastLength + 1)
31+
slowSC = 2 / (slowLength + 1)
32+
33+
MLTP = abs((src - lowest(low, pds)) - (highest(high, pds) - src)) / (highest(high, pds) - lowest(low, pds))
34+
35+
SSC = MLTP * (fastSC - slowSC) + slowSC
36+
37+
ama = 0.0
38+
ama := nz(ama[1]) + (SSC * SSC) * (src - nz(ama[1]))
39+
40+
plot(showKAMA ? kama(src, length, fastLength, slowLength) : na, title="KAMA", linewidth=2, color=#e69138, transp=0)
41+
plot(ama(src, length, fastLength, slowLength), title="AMA", linewidth=2, color=#741b47, transp=0)

src/movings/adaptive_rsi.pine

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
//@version=3
2+
// Copyright (c) 2018-present, Alex Orekhov (everget)
3+
// Adaptive RSI indicator script may be freely distributed under the MIT license.
4+
study(title="Adaptive RSI", shorttitle="ARSI", overlay=true)
5+
6+
length = input(title="Length", type=integer, defval=14, minval=1)
7+
src = input(title="Source", type=source, defval=close)
8+
9+
alpha = abs(rsi(src, length) / 100 - 0.5) * 2
10+
11+
arsi = 0.0
12+
arsi := alpha * src + (1 - alpha) * nz(arsi[1])
13+
14+
plot(arsi, title="ARSI", color=#741b47, linewidth=2, transp=0)
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
//@version=3
2+
// Copyright (c) 2018-present, Alex Orekhov (everget)
3+
// Ahrens Moving Average indicator script may be freely distributed under the MIT license.
4+
study("Ahrens Moving Average", shorttitle="AhMA", overlay=true)
5+
6+
length = input(title="Length", type=integer, defval=9, minval=1)
7+
src = input(title="Source", type=source, defval=close)
8+
9+
ahma = 0.0
10+
ahma := nz(ahma[1]) + (src - (nz(ahma[1]) + nz(ahma[length])) / 2) / length
11+
12+
plot(ahma, title="AhMA", linewidth=2, color=#6d1e7f, transp=0)
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
//@version=3
2+
// Copyright (c) 2018-present, Alex Orekhov (everget)
3+
// Geometric Mean indicator script may be freely distributed under the MIT license.
4+
study("Geometric Mean", shorttitle="GM", overlay=true)
5+
6+
length = input(title="Length", type=integer, defval=14, minval=1)
7+
src = input(title="Source", type=source, defval=close)
8+
9+
// https://en.wikipedia.org/wiki/Nth_root_algorithm
10+
// https://en.wikipedia.org/wiki/Nth_root
11+
// http://www.calculator.net/root-calculator.html?cvar3=14&cvar4=5&ctype=3&x=77&y=23
12+
// https://www.rapidtables.com/calc/math/Root_Calculator.html
13+
// https://rosettacode.org/wiki/Nth_root#JavaScript
14+
15+
precision = 0.00001
16+
17+
nthRoot(value, degree) =>
18+
x0 = 1
19+
xk = ((degree - 1) * x0 + value / pow(x0, degree - 1)) / degree
20+
xkDelta = (value / (pow(x0, degree - 1)) - x0) / degree
21+
22+
for i = 0 to 99999
23+
if abs(xkDelta) <= precision
24+
break
25+
26+
xkDelta := (value / (pow(xk, degree - 1)) - xk) / degree
27+
xk := xk + xkDelta
28+
xk
29+
30+
gm(src, length) =>
31+
prod = 1.0
32+
33+
for i = 0 to length - 1
34+
prod := prod * (na(src[i]) ? 1 : src[i])
35+
36+
nthRoot(prod, length)
37+
38+
plot(gm(src, length), title="GM", linewidth=2, color=#6d1e7f, transp=0)

src/movings/moving_harmonic_mean.pine

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
//@version=3
2+
// Copyright (c) 2018-present, Alex Orekhov (everget)
3+
// Harmonic Mean indicator script may be freely distributed under the MIT license.
4+
study("Harmonic Mean", shorttitle="HM", overlay=true)
5+
6+
length = input(title="Length", type=integer, defval=14, minval=1)
7+
src = input(title="Source", type=source, defval=close)
8+
9+
hm(src, length) =>
10+
sum = 0.0
11+
12+
for i = 0 to length - 1
13+
sum := sum + 1 / (na(src[i]) ? 1 : src[i])
14+
length / sum
15+
16+
plot(hm(src, length), title="HM", linewidth=2, color=#6d1e7f, transp=0)

0 commit comments

Comments
 (0)