Skip to content

Commit 29409bf

Browse files
committed
Add a built-in indicator
1 parent 4ad99eb commit 29409bf

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

examples/BuiltInIndicator.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,13 @@ const TradingView = require('../main');
66

77
const volumeProfile = new TradingView.BuiltInIndicator('VbPFixed@tv-basicstudies-241!');
88

9-
if (!process.argv[2] && !['VbPFixed@tv-basicstudies-241!', 'Volume@tv-basicstudies-241'].includes(volumeProfile.type)) {
9+
const AUTHENTICATED_INDICATORS = [
10+
'VbPFixed@tv-basicstudies-241',
11+
'VbPFixed@tv-basicstudies-241!',
12+
'Volume@tv-basicstudies-241',
13+
];
14+
15+
if (!process.argv[2] && !AUTHENTICATED_INDICATORS.includes(volumeProfile.type)) {
1016
throw Error('Please specify your \'sessionid\' cookie');
1117
}
1218

src/classes/BuiltInIndicator.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/**
22
* @typedef {'Volume@tv-basicstudies-241'
3+
* | 'VbPFixed@tv-basicstudies-241'
34
* | 'VbPFixed@tv-basicstudies-241!'
45
* | 'VbPFixed@tv-volumebyprice-53!'
56
* | 'VbPSessions@tv-volumebyprice-53'
@@ -21,6 +22,17 @@ const defaultValues = {
2122
length: 20,
2223
col_prev_close: false,
2324
},
25+
'VbPFixed@tv-basicstudies-241': {
26+
rowsLayout: 'Number Of Rows',
27+
rows: 24,
28+
volume: 'Up/Down',
29+
vaVolume: 70,
30+
subscribeRealtime: false,
31+
first_bar_time: NaN,
32+
last_bar_time: Date.now(),
33+
extendToRight: false,
34+
mapRightBoundaryToBarStartTime: true,
35+
},
2436
'VbPFixed@tv-basicstudies-241!': {
2537
rowsLayout: 'Number Of Rows',
2638
rows: 24,

0 commit comments

Comments
 (0)