Skip to content

Commit

Permalink
Add a built-in indicator
Browse files Browse the repository at this point in the history
  • Loading branch information
Mathieu2301 committed Sep 12, 2024
1 parent 4ad99eb commit 29409bf
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
8 changes: 7 additions & 1 deletion examples/BuiltInIndicator.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,13 @@ const TradingView = require('../main');

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

if (!process.argv[2] && !['VbPFixed@tv-basicstudies-241!', 'Volume@tv-basicstudies-241'].includes(volumeProfile.type)) {
const AUTHENTICATED_INDICATORS = [
'VbPFixed@tv-basicstudies-241',
'VbPFixed@tv-basicstudies-241!',
'Volume@tv-basicstudies-241',
];

if (!process.argv[2] && !AUTHENTICATED_INDICATORS.includes(volumeProfile.type)) {
throw Error('Please specify your \'sessionid\' cookie');
}

Expand Down
12 changes: 12 additions & 0 deletions src/classes/BuiltInIndicator.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/**
* @typedef {'Volume@tv-basicstudies-241'
* | 'VbPFixed@tv-basicstudies-241'
* | 'VbPFixed@tv-basicstudies-241!'
* | 'VbPFixed@tv-volumebyprice-53!'
* | 'VbPSessions@tv-volumebyprice-53'
Expand All @@ -21,6 +22,17 @@ const defaultValues = {
length: 20,
col_prev_close: false,
},
'VbPFixed@tv-basicstudies-241': {
rowsLayout: 'Number Of Rows',
rows: 24,
volume: 'Up/Down',
vaVolume: 70,
subscribeRealtime: false,
first_bar_time: NaN,
last_bar_time: Date.now(),
extendToRight: false,
mapRightBoundaryToBarStartTime: true,
},
'VbPFixed@tv-basicstudies-241!': {
rowsLayout: 'Number Of Rows',
rows: 24,
Expand Down

0 comments on commit 29409bf

Please sign in to comment.