MCPcopy
hub / github.com/Mathieu2301/TradingView-API / addIndicator

Function addIndicator

examples/ReplayMode.js:85–99  ·  view source on GitHub ↗
(name, pineId, options = {})

Source from the content-addressed store, hash-verified

83});
84
85async function addIndicator(name, pineId, options = {}) {
86 loading += 1;
87
88 const indic = pineId.includes('@')
89 ? new TradingView.BuiltInIndicator(pineId)
90 : await TradingView.getIndicator(pineId);
91 Object.keys(options).forEach((o) => { indic.setOption(o, options[o]); });
92
93 const std = new chart.Study(indic);
94
95 std.onReady(() => {
96 indicators.push([name, std]);
97 if (loading === indicators.length) step();
98 });
99}
100
101addIndicator('Volume', 'Volume@tv-basicstudies-241');
102addIndicator('EMA_50', 'STD;EMA', { Length: 50 });

Callers 1

ReplayMode.jsFile · 0.85

Calls 3

onReadyMethod · 0.80
stepFunction · 0.70
setOptionMethod · 0.45

Tested by

no test coverage detected