Changed around line 1
+ document.addEventListener('DOMContentLoaded', () => {
+ // Initialize trading chart
+ const ctx = document.getElementById('tradingChart').getContext('2d');
+ initializeChart(ctx);
+
+ // Populate active trades
+ populateActiveTrades();
+
+ // Update indicators
+ updateIndicators();
+ });
+
+ function initializeChart(ctx) {
+ // Sample data for demonstration
+ const labels = Array.from({length: 24}, (_, i) => `${i}:00`);
+ const data = Array.from({length: 24}, () => Math.random() * 100 + 50);
+
+ const gradient = ctx.createLinearGradient(0, 0, 0, 400);
+ gradient.addColorStop(0, 'rgba(41, 98, 255, 0.3)');
+ gradient.addColorStop(1, 'rgba(41, 98, 255, 0)');
+
+ new Chart(ctx, {
+ type: 'line',
+ data: {
+ labels: labels,
+ datasets: [{
+ label: 'Price',
+ data: data,
+ borderColor: '#2962ff',
+ backgroundColor: gradient,
+ tension: 0.4,
+ fill: true
+ }]
+ },
+ options: {
+ responsive: true,
+ maintainAspectRatio: false,
+ plugins: {
+ legend: {
+ display: false
+ }
+ },
+ scales: {
+ y: {
+ grid: {
+ color: 'rgba(255, 255, 255, 0.1)'
+ }
+ },
+ x: {
+ grid: {
+ display: false
+ }
+ }
+ }
+ }
+ });
+ }
+
+ function populateActiveTrades() {
+ const tradesList = document.getElementById('tradesList');
+ const sampleTrades = [
+ { pair: 'BTC/USDT', position: 'Long', entry: '42,150.00', current: '42,350.00', pl: '+2.1%' },
+ { pair: 'ETH/USDT', position: 'Short', entry: '2,850.00', current: '2,830.00', pl: '+1.4%' },
+ { pair: 'SOL/USDT', position: 'Long', entry: '120.50', current: '118.20', pl: '-1.9%' }
+ ];
+
+ sampleTrades.forEach(trade => {
+ const tradeElement = document.createElement('div');
+ tradeElement.className = 'trade-row';
+ tradeElement.innerHTML = `
+ ${trade.pair}
+ ${trade.position}
+ ${trade.entry}
+ ${trade.current}
+ ${trade.pl}
+ `;
+ tradesList.appendChild(tradeElement);
+ });
+ }
+
+ function updateIndicators() {
+ // Simulate real-time updates
+ setInterval(() => {
+ document.getElementById('rsiValue').textContent = Math.floor(Math.random() * 100);
+ document.getElementById('macdValue').textContent = Math.random() > 0.5 ? 'Bullish' : 'Bearish';
+ document.getElementById('maValue').textContent = ['Strong Buy', 'Buy', 'Neutral', 'Sell', 'Strong Sell'][Math.floor(Math.random() * 5)];
+ }, 5000);
+ }