(name, pineId, options = {})
| 83 | }); |
| 84 | |
| 85 | async 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 | |
| 101 | addIndicator('Volume', 'Volume@tv-basicstudies-241'); |
| 102 | addIndicator('EMA_50', 'STD;EMA', { Length: 50 }); |
no test coverage detected