This commit is contained in:
Dobromir Popov
2025-11-22 01:47:53 +02:00
parent 21813fbfe3
commit d4c0483675
4 changed files with 34 additions and 18 deletions

View File

@@ -1902,10 +1902,11 @@ class ChartManager {
// Add prediction traces (ghost candles)
if (predictionTraces.length > 0) {
// Remove existing ghost traces first (heuristic: traces with name 'Ghost Prediction')
// Remove existing ghost traces safely
// We iterate backwards to avoid index shifting issues when deleting
const currentTraces = plotElement.data.length;
const indicesToRemove = [];
for (let i = 0; i < currentTraces; i++) {
for (let i = currentTraces - 1; i >= 0; i--) {
if (plotElement.data[i].name === 'Ghost Prediction') {
indicesToRemove.push(i);
}