Illustrative Momentum Asset Ranker

Manually input assets and their pre-calculated momentum scores to see a ranked selection.

** VERY IMPORTANT - PLEASE READ **
  • This tool is for educational and illustrative purposes ONLY.
  • It uses **your manually entered momentum scores**. It does NOT calculate momentum from price data or use live market data.
  • This is **NOT a backtesting tool** and cannot predict future performance. Past momentum is not a guarantee of future returns.
  • This tool **DOES NOT provide investment advice.** All investment strategies, including momentum, carry risks.
  • Consult with a qualified financial advisor before making any investment decisions.

1. Input Asset Data & Momentum Scores

2. Strategy Parameters

%

Lookback Period for Scores: ${i.lookbackPeriodDesc || 'N/A'}

`; pdfHtml += `

Number of Top Assets to Select: ${i.numTopAssets}

`; pdfHtml += `

Absolute Momentum Threshold: ${i.absMomentumThreshold.toFixed(2)}

`; pdfHtml += `

All Entered Assets & Scores

    `; i.enteredAssets.forEach(a => { pdfHtml += `
  • ${a.name} ${this.formatPercent(a.score).replace(' %','')}
  • `; }); pdfHtml += `
`; pdfHtml += `

Ranked Eligible Assets (Score >= ${i.absMomentumThreshold}%)

`; if (eligible.length > 0) { pdfHtml += `
    `; eligible.forEach(asset => { pdfHtml += `
  • ${asset.name} ${this.formatPercent(asset.score).replace(' %','')}
  • `; }); pdfHtml += `
`; } else { pdfHtml += `

No assets met the absolute momentum threshold.

`; } pdfHtml += `

Hypothetical Selected Portfolio (Top ${i.numTopAssets})

`; if (selected.length > 0) { pdfHtml += `
    `; selected.forEach(asset => { pdfHtml += `
  • ${asset.name} ${this.formatPercent(asset.score).replace(' %','')}
  • `; }); pdfHtml += `
`; } else { pdfHtml += `

No assets selected based on criteria.

`; } pdfExportContainer.innerHTML = pdfHtml; document.body.appendChild(pdfExportContainer); try { const canvas = await html2canvas(pdfExportContainer, { scale: 1.5, useCORS: true, logging: false, windowWidth: pdfExportContainer.scrollWidth }); document.body.removeChild(pdfExportContainer); const imgData = canvas.toDataURL('image/png'); const { jsPDF } = window.jspdf; const pdf = new jsPDF({ orientation: 'p', unit: 'pt', format: 'a4' }); const pdfWidth = pdf.internal.pageSize.getWidth(); const pdfHeight = pdf.internal.pageSize.getHeight(); const imgProps = pdf.getImageProperties(imgData); let imgFinalWidth = pdfWidth - 40; let imgFinalHeight = (imgProps.height * imgFinalWidth) / imgProps.width; if (imgFinalHeight > pdfHeight - 40) { imgFinalHeight = pdfHeight - 40; imgFinalWidth = (imgProps.width * imgFinalHeight) / imgProps.height; } let currentY = 20; let heightProcessed = 0; const pageMargin = 20; const pageHeightAvailable = pdfHeight - 2 * pageMargin; while(heightProcessed < canvas.height) { let pageSegmentHeightOnCanvas = Math.min(canvas.height - heightProcessed, (pageHeightAvailable / imgFinalHeight) * canvas.height ); if (pageSegmentHeightOnCanvas <=0) break; const segmentCanvas = document.createElement('canvas'); segmentCanvas.width = canvas.width; segmentCanvas.height = pageSegmentHeightOnCanvas; const sctx = segmentCanvas.getContext('2d'); sctx.drawImage(canvas, 0, heightProcessed, canvas.width, pageSegmentHeightOnCanvas, 0, 0, canvas.width, pageSegmentHeightOnCanvas); const segmentImgData = segmentCanvas.toDataURL('image/png'); if(heightProcessed > 0) pdf.addPage(); pdf.addImage(segmentImgData, 'PNG', pageMargin, pageMargin, imgFinalWidth, (segmentCanvas.height * imgFinalWidth) / segmentCanvas.width); // Adjust height of segment heightProcessed += pageSegmentHeightOnCanvas; } pdf.save('Momentum_Asset_Ranking.pdf'); } catch (error) { console.error("Error generating PDF:", error); alert("An error occurred while generating PDF."); if (document.body.contains(pdfExportContainer)) document.body.removeChild(pdfExportContainer); } } }; document.addEventListener('DOMContentLoaded', function() { msaApp.init(); });
Scroll to Top