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

Method setSeries

src/chart/session.js:304–324  ·  view source on GitHub ↗

* @param {import('../types').TimeFrame} timeframe Chart period timeframe * @param {number} [range] Number of loaded periods/candles (Default: 100) * @param {number} [reference] Reference candle timestamp (Default is now)

(timeframe = '240', range = 100, reference = null)

Source from the content-addressed store, hash-verified

302 * @param {number} [reference] Reference candle timestamp (Default is now)
303 */
304 setSeries(timeframe = '240', range = 100, reference = null) {
305 if (!this.#currentSeries) {
306 this.#handleError('Please set the market before setting series');
307 return;
308 }
309
310 const calcRange = !reference ? range : ['bar_count', reference, range];
311
312 this.#periods = {};
313
314 this.#client.send(`${this.#seriesCreated ? 'modify' : 'create'}_series`, [
315 this.#chartSessionID,
316 '$prices',
317 's1',
318 `ser_${this.#currentSeries}`,
319 timeframe,
320 this.#seriesCreated ? '' : calcRange,
321 ]);
322
323 this.#seriesCreated = true;
324 }
325
326 /**
327 * Set the chart market

Callers 5

setMarketMethod · 0.95
allErrors.test.tsFile · 0.80
SimpleChart.jsFile · 0.80
Errors.jsFile · 0.80

Calls 2

#handleErrorMethod · 0.95
sendMethod · 0.80

Tested by

no test coverage detected