ht High-Frequency Trading Strategy Simulator High-Frequency Trading Strategy Simulator Test automated trading strategies against simulated real-time market data. 1. Strategy Setup 2. Simulation 3. Results & Export Configure Simulation Trading Strategy Strategy Type Mean Reversion Momentum Trade Size (Shares) Market Conditions Initial Price ($) Market Volatility LowMediumHigh Live Simulation Start Stop Simulation Complete The simulation has ended. You can now download the full trade report. Download Trade Report Previous Next Strategy: ${simulation.config.strategy} | Date: ${new Date().toLocaleDateString()} NET P/L$${pnl.toFixed(2)} WIN RATE${winRate.toFixed(1)}% TOTAL TRADES${totalTrades} AVG P/L PER TRADE$${(pnl / totalTrades || 0).toFixed(2)} Trade Log TimestampTypeSharesPriceP/L${tableRows} `; const pdfTemplate = document.getElementById('pdf-template'); pdfTemplate.innerHTML = reportHtml; pdfTemplate.classList.remove('invisible'); try { const { jsPDF } = window.jspdf; const canvas = await html2canvas(pdfTemplate.querySelector('.pdf-page'), { scale: 2 }); const imgData = canvas.toDataURL('image/png'); const pdf = new jsPDF({ orientation: 'p', unit: 'pt', format: 'a4' }); const pdfWidth = pdf.internal.pageSize.getWidth(), pdfHeight = (canvas.height * pdfWidth) / canvas.width; pdf.addImage(imgData, 'PNG', 0, 0, pdfWidth, pdfHeight); pdf.save('HFT_Simulation_Report.pdf'); } catch (e) { console.error('PDF Generation Error:', e); } finally { downloadPdfBtn.disabled = false; downloadPdfBtn.textContent = 'Download Trade Report'; pdfTemplate.classList.add('invisible'); pdfTemplate.innerHTML = ''; } } // --- EVENT LISTENERS --- startBtn.addEventListener('click', startSimulation); stopBtn.addEventListener('click', stopSimulation); downloadPdfBtn.addEventListener('click', generatePdfReport); // --- INITIALIZATION --- switchTab(0); });