Technical Analysis Training Simulator

All Prices: ${prices.join(', ')}

EMA: ${ema.toFixed(2)}

`; } document.getElementById('simulationResult').innerHTML = result; } window.downloadSimulationPDF = function () { const resultElement = document.getElementById('simulationResult'); const button = document.getElementById('downloadPDF'); if (!resultElement.innerHTML.trim()) { alert("Please simulate a strategy before downloading the PDF."); return; } button.style.display = 'none'; html2canvas(resultElement).then(canvas => { const imgData = canvas.toDataURL('image/png'); const { jsPDF } = window.jspdf; const pdf = new jsPDF(); const pdfWidth = pdf.internal.pageSize.getWidth(); const pdfHeight = (canvas.height * pdfWidth) / canvas.width; pdf.addImage(imgData, 'PNG', 0, 10, pdfWidth, pdfHeight); pdf.save("Technical_Analysis_Simulation.pdf"); button.style.display = 'inline-block'; }); } });
Scroll to Top