diff --git a/apps/backtest-report/components/TradingViewChart.tsx b/apps/backtest-report/components/TradingViewChart.tsx index efa202c58..9bc0cbc0a 100644 --- a/apps/backtest-report/components/TradingViewChart.tsx +++ b/apps/backtest-report/components/TradingViewChart.tsx @@ -386,7 +386,19 @@ const TradingViewChart = (props: TradingViewChartProps) => { const chart = useRef(); const resizeObserver = useRef(); const intervals = props.reportSummary.intervals || []; - const [currentInterval, setCurrentInterval] = useState(intervals.length > 0 ? intervals[0] : '1m'); + + intervals.sort((a,b) => { + const as = parseInterval(a) + const bs = parseInterval(b) + if (as < bs) { + return -1; + } else if (as > bs) { + return 1; + } + return 0; + }) + + const [currentInterval, setCurrentInterval] = useState(intervals.length > 0 ? intervals[intervals.length - 1] : '1m'); const [showPositionBase, setShowPositionBase] = useState(false); const [showCanceledOrders, setShowCanceledOrders] = useState(false); const [showPositionAverageCost, setShowPositionAverageCost] = useState(false);