fix prediction candles updates. fix for trend prediction.

This commit is contained in:
Dobromir Popov
2025-11-22 19:25:27 +02:00
parent 44379ae2e4
commit 20fe481ec5
6 changed files with 461 additions and 24 deletions

View File

@@ -2571,7 +2571,7 @@ class ChartManager {
if (predictions.transformer) {
this._addTransformerPrediction(predictions.transformer, predictionShapes, predictionAnnotations);
// Add trend vector visualization
// Add trend vector visualization (shorter projection to avoid zoom issues)
if (predictions.transformer.trend_vector) {
this._addTrendPrediction(predictions.transformer.trend_vector, predictionShapes, predictionAnnotations);
}
@@ -2748,9 +2748,12 @@ class ChartManager {
// Calculate target point
// steepness is [0, 1], angle is in degrees
// We project ahead by e.g. 5 minutes
const projectionMinutes = 5;
const targetTime = new Date(lastTimestamp.getTime() + projectionMinutes * 60000);
// Project ahead based on timeframe to avoid zoom issues
// For 1s: 30s ahead, 1m: 2min ahead, 1h: 30min ahead
const projectionSeconds = timeframe === '1s' ? 30 :
timeframe === '1m' ? 120 :
timeframe === '1h' ? 1800 : 300;
const targetTime = new Date(lastTimestamp.getTime() + projectionSeconds * 1000);
let targetPrice = currentPrice;