* @param {PineIndicator | BuiltInIndicator} indicator Indicator instance
(indicator)
| 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 |
no test coverage detected