improved indicator redraw on new candles with error handling
This commit is contained in:
@ -366,10 +366,7 @@ if (data.candles && data.candles.length > 0) {
|
|||||||
this.updateStats(latest);
|
this.updateStats(latest);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Always try to redraw indicators after candles are set
|
window.drawIndicatorsOnChart?.();
|
||||||
if (window.drawIndicatorsOnChart) {
|
|
||||||
window.drawIndicatorsOnChart();
|
|
||||||
}
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error loading data:', error);
|
console.error('Error loading data:', error);
|
||||||
} finally {
|
} finally {
|
||||||
@ -431,10 +428,8 @@ async loadNewData() {
|
|||||||
|
|
||||||
this.updateStats(latest);
|
this.updateStats(latest);
|
||||||
|
|
||||||
// Update indicators - for new candles, update series; for initial loads, redraw
|
console.log('[Chart] Calling drawIndicatorsOnChart after new data');
|
||||||
if (window.drawIndicatorsOnChart) {
|
window.drawIndicatorsOnChart?.();
|
||||||
window.drawIndicatorsOnChart();
|
|
||||||
}
|
|
||||||
|
|
||||||
await this.loadSignals();
|
await this.loadSignals();
|
||||||
|
|
||||||
|
|||||||
@ -842,6 +842,7 @@ export function updateIndicatorCandles() {
|
|||||||
|
|
||||||
// Chart drawing
|
// Chart drawing
|
||||||
export function drawIndicatorsOnChart() {
|
export function drawIndicatorsOnChart() {
|
||||||
|
try {
|
||||||
if (!window.dashboard || !window.dashboard.chart) {
|
if (!window.dashboard || !window.dashboard.chart) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -950,6 +951,9 @@ console.log(`[Indicators] ========== Redrawing ==========`);
|
|||||||
});
|
});
|
||||||
|
|
||||||
console.log(`[Indicators] ========== drawIndicatorsOnChart END ==========`);
|
console.log(`[Indicators] ========== drawIndicatorsOnChart END ==========`);
|
||||||
|
} catch (error) {
|
||||||
|
console.error('[Indicators] Error drawing indicators:', error);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function resetIndicator(id) {
|
function resetIndicator(id) {
|
||||||
|
|||||||
Reference in New Issue
Block a user