Historical Crypto Price Trends Analyzer

Instructions:
  1. Enter the name or symbol of the cryptocurrency.
  2. Paste historical price data as comma-separated values (e.g., 100.50,101.20,100.80,...). These should be sequential closing prices from oldest to newest.
  3. Select the periodicity (frequency) of your price data.
  4. Optionally, enter periods for one or two Simple Moving Averages (SMAs). Ensure MA2 > MA1 if both are used. You need enough data points for the longest MA.

Input Data & Parameters

Moving Average Parameters (Optional)

Price Range: ${hpta_formatNumber(overall.priceRange)}

Total Change: ${hpta_formatPercentage(overall.totalChangePercent)}

Up Periods: ${overall.upPeriods} | Down Periods: ${overall.downPeriods} | Flat Periods: ${overall.flatPeriods}

`; let smaHtml = ""; if (sma && (sma.ma1 || sma.ma2)) { smaHtml += `
Moving Average Analysis
`; smaHtml += `

Latest Price: ${hpta_formatNumber(overall.endPrice)}

`; if (sma.ma1) { smaHtml += `

Latest SMA ${sma.ma1.period} Value: ${hpta_formatNumber(sma.ma1.value)}

`; smaHtml += `

Price vs. SMA ${sma.ma1.period}: ${sma.ma1.priceVs}

`; } if (sma.ma2) { smaHtml += `

Latest SMA ${sma.ma2.period} Value: ${hpta_formatNumber(sma.ma2.value)}

`; smaHtml += `

Price vs. SMA ${sma.ma2.period}: ${sma.ma2.priceVs}

`; } if (sma.comparison) { smaHtml += `

SMA Comparison: ${sma.comparison.text}

`; if(sma.comparison.crossover) smaHtml += `

Crossover Signal: ${sma.comparison.crossover}

`; } smaHtml += `
`; } const interpretationNote_pdf = `This analysis uses historical data. Past trends and SMA signals are not guarantees of future performance. Not financial advice.`; pdfContentEl.innerHTML = `
Historical Price Trends Analysis: ${inputs.assetName}
Input Summary
${inputsHtml}
Overall Trend Statistics
${overallStatsHtml}
${smaHtml}
Note: ${interpretationNote_pdf}
`; document.body.appendChild(pdfContentEl); html2canvas(pdfContentEl, { scale: 2, useCORS: true, logging:true, width: pdfContentEl.scrollWidth, windowHeight: pdfContentEl.scrollHeight }).then(canvas => { const imgData = canvas.toDataURL('image/png'); const pdfWidth = pdf.internal.pageSize.getWidth(); const pdfHeight = pdf.internal.pageSize.getHeight(); const imgProps = pdf.getImageProperties(imgData); let position = 0; const pageMargin = 40; const effectivePageHeight = pdfHeight - 2 * pageMargin; const contentWidth = pdfWidth - 2 * pageMargin; const contentHeight = (imgProps.height * contentWidth) / imgProps.width; let heightLeft = contentHeight; let pageNumber = 0; while (heightLeft > 0) { pageNumber++; if (pageNumber > 1) { pdf.addPage(); } let sourceY = position * (imgProps.width / contentWidth); let sourceHeight = effectivePageHeight * (imgProps.width / contentWidth); sourceHeight = Math.min(sourceHeight, imgProps.height - sourceY); const pageCanvas = document.createElement('canvas'); pageCanvas.width = imgProps.width; pageCanvas.height = sourceHeight; const ctx = pageCanvas.getContext('2d'); ctx.drawImage(canvas, 0, sourceY, imgProps.width, sourceHeight, 0, 0, imgProps.width, sourceHeight); const pageImgData = pageCanvas.toDataURL('image/png'); const pageImgHeight = (sourceHeight * contentWidth) / imgProps.width; pdf.addImage(pageImgData, 'PNG', pageMargin, pageMargin, contentWidth, pageImgHeight, undefined, 'FAST'); position += effectivePageHeight; heightLeft -= effectivePageHeight; } pdf.save(`${inputs.assetName.replace(/[^a-z0-9]/gi, '_') || 'Price_Trend'}_Analysis.pdf`); if(document.body.contains(pdfContentEl)) document.body.removeChild(pdfContentEl); }).catch(err => { console.error("HPTA PDF Error:", err); alert("Error generating Trend Analysis PDF. See console."); if(document.body.contains(pdfContentEl)) document.body.removeChild(pdfContentEl); }); } document.addEventListener('DOMContentLoaded', function() { if (!document.getElementById('hpta_priceData')) { console.error("Critical input 'hpta_priceData' not found. Tool may not function correctly."); } });
Scroll to Top