Skip to content

πŸ“ˆ Get real-time stocks from TradingView

Bug fix

Mathieu Colmon529181a19f43
diff --git a/src/chart/session.js b/src/chart/session.js
index fa7b23b..6fc439a 100644
--- a/src/chart/session.js
+++ b/src/chart/session.js
@@ -254,7 +254,7 @@ module.exports = (client) => class ChartSession {
's1',
`ser_${this.#currentSeries}`,
timeframe,
- !this.#seriesCreated ? range : '',
+ this.#seriesCreated ? '' : range,
]);
this.#seriesCreated = true;
diff --git a/src/chart/study.js b/src/chart/study.js
index 5a222cc..15763a3 100644
--- a/src/chart/study.js
+++ b/src/chart/study.js
@@ -190,7 +190,7 @@ module.exports = (chartSession) => class ChartStudy {
p.v.forEach((plot, i) => {
const plotName = (i === 0 ? '$time' : this.options.plots[`plot_${i - 1}`]);
- if (!period[plotName]) period[plotName] = plot;
+ if (plotName && !period[plotName]) period[plotName] = plot;
else period[`plot_${i - 1}`] = plot;
});