MCPcopy Index your code
hub / github.com/Mathieu2301/TradingView-API / setIndicator

Method setIndicator

src/chart/study.js:376–390  ·  view source on GitHub ↗

* @param {PineIndicator | BuiltInIndicator} indicator Indicator instance

(indicator)

Source from the content-addressed store, hash-verified

374 * @param {PineIndicator | BuiltInIndicator} indicator Indicator instance
375 */
376 setIndicator(indicator) {
377 if (!(indicator instanceof PineIndicator) && !(indicator instanceof BuiltInIndicator)) {
378 throw new Error(`Indicator argument must be an instance of PineIndicator or BuiltInIndicator.
379 Please use 'TradingView.getIndicator(...)' function.`);
380 }
381
382 this.instance = indicator;
383
384 chartSession.send('modify_study', [
385 chartSession.sessionID,
386 `${this.#studID}`,
387 'st1',
388 getInputs(this.instance),
389 ]);
390 }
391
392 /**
393 * When the indicator is ready

Callers 1

indicators.test.tsFile · 0.80

Calls 2

getInputsFunction · 0.85
sendMethod · 0.80

Tested by

no test coverage detected