-
Notifications
You must be signed in to change notification settings - Fork 43
/
pgo.src.js
40 lines (36 loc) · 998 Bytes
/
pgo.src.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
function getBufferSize (periods) {
return periods;
}
function getRunUpCount (periods) {
return periods * 2;
}
function getStudyAxisConfig () {
return {
gridLineWidth: 0,
plotLines: [
{value: -3, width: 1, color: "#EEE"},
{value: 0, width: 1, color: "#EEE", dashStyle: "Dash"},
{value: 3, width: 1, color: "#EEE"}
]
};
}
function validate (periods) {
if (typeof periods !== "number") {
error("Pretty Good Oscillator periods must be a number");
}
if (periods % 1 !== 0) {
error("Pretty Good Oscillator periods must be an integer");
}
if (periods > 100) {
error("Pretty Good Oscillator maximum periods is 100");
}
if (periods <= 0) {
error("Pretty Good Oscillator periods must be greater than zero");
}
}
function onIntervalClose (periods) {
return {
overlay: false,
value: (CLOSE - Math.average(prices(periods))) / atr(periods)
};
}