Historical Crypto Price Trends Analyzer
Instructions:
- Enter the name or symbol of the cryptocurrency.
- 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. - Select the periodicity (frequency) of your price data.
- 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)
Trend Analysis for
Input Summary:
Asset Name:
Number of Price Data Points:
Data Periodicity:
Overall Trend Statistics:
Start Price:
End Price:
Highest Price:
Lowest Price:
Price Range:
Total Percentage Change:
Number of Up Periods:
Number of Down Periods:
Number of Flat Periods:
Moving Average Analysis:
Latest Price:
Note: This analysis is based purely on the historical price data you provided.
- **Overall Trend Statistics** provide a general overview of price movements during the period.
- **Moving Averages (SMAs)** help smooth out price data to identify trend direction.
- Price above an SMA can be seen as bullish; below as bearish for that SMA's timeframe.
- A shorter-term SMA crossing above a longer-term SMA (a "golden cross") is often considered a bullish signal, while the reverse ("death cross") is bearish. This tool indicates the current relationship and if a very recent crossover (last period) was detected.
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 += `
`;
}
const interpretationNote_pdf = `This analysis uses historical data. Past trends and SMA signals are not guarantees of future performance. Not financial advice.`;
pdfContentEl.innerHTML = `
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 += `Historical Price Trends Analysis: ${inputs.assetName}
Input Summary
${inputsHtml}
Overall Trend Statistics
${overallStatsHtml}
${smaHtml}
Note: ${interpretationNote_pdf}
Generated on: ${pdfCreationTimestamp}.
`;
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.");
}
});
