Visualizing Two-Variable Samples with Scatterplots and Heatmaps
Summary
This Pine library turns paired samples into a chart that shows their joint distribution. Users add x and y values, then choose a scatterplot or a heatmap. A configurable matrix bins observations; cells show points or use color intensity to represent their counts. Tooltips report cell counts and the corresponding x and y ranges, while optional corner tables summarize counts across the four quadrants.
The library can calculate price-displacement pairs from price data over a selected duration, measuring moves either relative to average true range or as a percentage of price. Percentile cutoffs trim extreme values from the displayed range, and an option can instead place outlying observations at the border cells. Users can apply a shared scale to both axes and customize labels, formats, and colors. This is a visualization utility rather than a trading rule or performance study: the document provides no empirical evidence that particular sample patterns predict returns, and interpretation depends on the chosen bin count, scaling, and outlier settings.
Key ideas
- The library bins paired x and y observations into a configurable matrix for visualization.
- Scatterplot mode marks occupied cells, while heatmap mode colors cells according to their relative counts.
- Optional quadrant counters summarize how observations are distributed across the chart's four regions.
- Price samples can measure forward high and low displacements in ATR units or as percentages.
- Percentile bounds affect the displayed range, with an option to retain outliers in border cells.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.