diff --git a/js/ui/chart.js b/js/ui/chart.js index edc989a..dd71a79 100644 --- a/js/ui/chart.js +++ b/js/ui/chart.js @@ -739,6 +739,18 @@ export class TradingDashboard { if (fitToContent) { this.chart.timeScale().scrollToRealTime(); + + const isMobile = window.innerWidth < 768; + const defaultCandles = isMobile ? 125 : 300; + + const dataLength = this.candleSeries.data().length; + if (dataLength > defaultCandles) { + const logicalRange = { + from: dataLength - 1 - defaultCandles, + to: dataLength - 1 + }; + this.chart.timeScale().setVisibleLogicalRange(logicalRange); + } } else if (visibleRange) { this.chart.timeScale().setVisibleLogicalRange(visibleRange); }