\documentclass[conference]{IEEEtran}

% ── Packages ─────────────────────────────────────────────────────────────────
\usepackage{cite}
\usepackage{amsmath,amssymb,amsfonts}
\usepackage{algorithmic}
\usepackage{algorithm}
\usepackage{graphicx}
\usepackage{textcomp}
\usepackage{booktabs}
\usepackage{multirow}
\usepackage{tikz}
\usepackage{pgfplots}
\pgfplotsset{compat=1.18}
\usepackage{hyperref}
\usepackage{cleveref}

% ── Meta ─────────────────────────────────────────────────────────────────────
\hypersetup{
  colorlinks=true,
  linkcolor=blue,
  citecolor=blue,
  urlcolor=blue
}
\def\BibTeX{{\rm B\kern-.05em{\sc i\kern-.025em b}\kern-.08em
    T\kern-.1667em\lower.7ex\hbox{E}\kern-.125emX}}

% ── Color palette for tables (optional) ──────────────────────────────────────
\definecolor{colorA}{RGB}{139,69,19}
\definecolor{colorB}{RGB}{0,0,255}
\definecolor{colorC}{RGB}{200,0,0}
\definecolor{colorD}{RGB}{255,192,203}
\definecolor{colorE}{RGB}{0,255,127}
\definecolor{colorF}{RGB}{0,139,139}
\definecolor{colorG}{RGB}{135,206,250}
\definecolor{colorH}{RGB}{255,215,0}
\definecolor{colorI}{RGB}{123,104,238}
\definecolor{colorJ}{RGB}{0,100,0}

\begin{document}

% ══════════════════════════════════════════════════════════════════════════════
% TITLE
% ══════════════════════════════════════════════════════════════════════════════
  \title{CGRMP: Conventional, Gap-Filled, and Range Market Profiles and Their Variants}

  \author{\IEEEauthorblockN{ConQ Research Team}\\
  \IEEEauthorblockA{\textit{Continual Quasars}\\
  \today}
  }

\maketitle

% ══════════════════════════════════════════════════════════════════════════════
% ABSTRACT
% ══════════════════════════════════════════════════════════════════════════════
\begin{abstract}
We present a unified study of twelve distinct market profile constructions that operate on an ordered sequence of price observations, supported by tick volume and auxiliary range parameters. The profiles are categorised into three families: Conventional Market Profile (CMP) that maps each single price datapoint to its own bin; Range Market Profile (RMP) that fills all bins between a high and low price per observation; and Gap‑Filled Market Profile (GMP) that interpolates every integer bin traversed between consecutive points either using a single price series (single‑datapoint mode) or dual high/low series (multiple‑datapoint mode). Each family is examined under three weighting schemes: one‑point normal (weight = 1), tick‑volume holistic (weight = tick volume), and tick‑volume multiplication (weight = tick volume × pre‑specified range). We formalise every variant with explicit definitions, algorithms, and complexity analyses. A complete ten‑point numerical example with coloured profile charts, printed directly from the implementation, illustrates all 12 profiles side‑by‑side. The bin‑size scaling properties are proved, and the practical implications of gap‑filling and volume amplification are discussed.
\end{abstract}

\begin{IEEEkeywords}
Market Profile, gap‑filling, tick volume, price bins, high‑frequency data, range profile.
\end{IEEEkeywords}

% ══════════════════════════════════════════════════════════════════════════════
% I. INTRODUCTION
% ══════════════════════════════════════════════════════════════════════════════
\section{Introduction}\label{sec:intro}

Market Profile~\cite{steidlmayer1986market,dalton2007markets} aggregates price activity into a horizontal histogram, revealing distributional concentrations. In its most common form each price observation is assigned to the bin corresponding to its integer price level; levels that never occur as an exact observation remain empty, even though price must have traversed them. This gap neglect occurs regardless of whether the input is a series of tick prices, bar endpoints, or synthetic paths.

The present paper develops a comprehensive taxonomy of twelve profile constructions that address this shortcoming in a systematic manner. The profiles are built from a primary ten‑point price sequence with associated tick volumes and pre‑computed range multipliers, all hardcoded in a reference Python implementation that generates publication‑quality charts.

The twelve variants are organised into four groups, each containing three sub‑variants that differ only in the weight contributed to each bin:
\begin{enumerate}
    \item \textbf{CMP‑sd} – Conventional Market Profile, single datapoint.
    \item \textbf{RMP‑rd} – Range Market Profile, range datapoint.
    \item \textbf{GMP‑sd} – Gap‑Filled Market Profile, single datapoint.
    \item \textbf{GMP‑md} – Gap‑Filled Market Profile, multiple datapoint (high/low).
\end{enumerate}
For every group the three weighting modes are:
\begin{description}
    \item[opn] one‑point normal mode (weight = 1 per touched bin).
    \item[tvh] tick‑volume holistic mode (weight = the observation’s tick volume $V$, repeated on every touched bin).
    \item[tvm] tick‑volume multiplication mode (weight = $V \times r$, where $r$ is a supplied range parameter).
\end{description}

The key contributions are:
\begin{enumerate}
    \item Rigorous mathematical definitions and pseudo‑code for all 12 profiles.
    \item Complete worked example on the same ten‑point dataset, with exact numerical tables and stacked‑bar charts produced by the reference code.
    \item Proof of the relationship between bin count and bin size $\beta$, showing how gap‑filled and range‑based profiles dramatically increase resolution compared with the conventional approach.
    \item Discussion of the structural properties, computational complexity, and practical implications of each variant.
\end{enumerate}

The remainder of the paper is organised as follows. Section~II reviews related work. Section~III introduces the notation, the raw data tables, and the fundamental binning function. Sections~IV–VII define and illustrate the four profile families in turn. Section~VIII analyses the effect of bin size $\beta$ and proves a scaling proposition. Section~IX discusses advantages, limitations, and future extensions. Section~X concludes.

\section{Related Work}\label{sec:related}

Steidlmayer~\cite{steidlmayer1986market} introduced Market Profile to visualise fair value. Dalton~\cite{dalton2007markets} embedded it in auction‑market theory. Both rely on bar data (OHLCV), filling all bins between the high and low of each bar—a process akin to our RMP‑rd family. When only discrete price ticks are available, practitioners often apply the conventional single‑point mapping (CMP‑sd), which ignores intra‑bin gaps. The gap‑filled approach proposed here is an interpolation of the price path between consecutive observations and is closely related to linear interpolation of histogram counts studied in business‑time sampling~\cite{clark1973subordinated,ane2000order}.

Tick‑volume amplification, where the raw traded size is distributed across touched bins, has been explored in volume‑profile algorithms~\cite{glosten1985bid,ohara1995market,madhavan2000market}, but none of those formulations simultaneously consider gap‑filling on both single‑point and dual‑stream data with multiple weighting schemes. Our work unifies those ideas under a single notational and computational framework.

\section{Preliminaries}\label{sec:prelim}

\subsection{Notation}

\begin{table}[!t]
\centering
\caption{Notation Summary}
\label{tab:notation}
\begin{tabular}{@{}cl@{}}
\toprule
\textbf{Symbol} & \textbf{Description} \\
\midrule
$N$              & Number of observations \\
$p_i$            & Price of $i$‑th observation (single‑datapoint) \\
$H_i, L_i$       & High and low prices of $i$‑th observation \\
$V_i$            & Tick volume of $i$‑th observation \\
$\beta$          & Bin size (price units per bin); default $\beta=1$ \\
$b(p)$           & Bin index of price $p$: $b(p)=\lfloor p/\beta\rfloor$ \\
$r^{\mathrm{cmp}}_i$ & Range multiplier for CMP‑sd \\
$r^{\mathrm{rmp}}_i$ & Range multiplier for RMP‑rd (High − Low) \\
$r^H_i, r^L_i$   & Range multipliers for GMP‑sd/GMP‑md \\
$S[k]$           & Accumulated value (stacks) at bin $k$ \\
$D$              & Cumulative bin displacement \\
\bottomrule
\end{tabular}
\end{table}

\subsection{Raw Data}

The analysis is carried out on the ten‑point sequence shown in Table~\ref{tab:rawdata}. Each observation carries a tick volume and three pre‑computed range multipliers that originate from different definitions of the observation’s span (the last row of the table explains the provenance). These hardcoded values are taken directly from the reference Python implementation.

\begin{table}[!t]
\centering
\caption{Input Observations with All Auxiliary Data}
\label{tab:rawdata}
\resizebox{\columnwidth}{!}{%
\begin{tabular}{@{}c c c c c c c c c@{}}
\toprule
Label & Idx & Price & $V_i$ & $r^{\mathrm{cmp}}_i$ & $(H_i,L_i)$ & $r^{\mathrm{rmp}}_i$ & $r^H_i$ & $r^L_i$ \\
\midrule
A & 1 & 3000.914 & 432 & 1 & (3000.914,\,3000.203) & 1 & 1 & 1 \\
B & 2 & 3003.837 & 141 & 4 & (3003.837,\,3001.982) & 3 & 4 & 2 \\
C & 3 & 3002.432 & 221 & 2 & (3002.432,\,3000.822) & 3 & 2 & 2 \\
D & 4 & 3009.892 & 1011 & 8 & (3009.892,\,3005.721) & 5 & 8 & 6 \\
E & 5 & 3007.698 & 1245 & 3 & (3007.698,\,3006.902) & 2 & 3 & 2 \\
F & 6 & 3009.176 & 261 & 3 & (3009.176,\,3007.749) & 3 & 3 & 2 \\
G & 7 & 3003.381 & 192 & 7 & (3003.381,\,3001.110) & 3 & 7 & 7 \\
H & 8 & 3004.283 & 483 & 2 & (3004.283,\,3003.610) & 2 & 2 & 3 \\
I & 9 & 3003.512 & 157 & 2 & (3003.512,\,3000.410) & 4 & 2 & 4 \\
J &10 & 3003.012 & 249 & 1 & (3003.012,\,3002.009) & 2 & 1 & 3 \\
\bottomrule
\multicolumn{9}{p{\textwidth}}{\footnotesize $r^{\mathrm{cmp}}_i$ is the “Range (r)” column of the CMP raw table; $r^{\mathrm{rmp}}_i$ is the high‑low range; $r^H_i$ and $r^L_i$ are the per‑observation high and low range multipliers.}
\end{tabular}%
}
\end{table}

\subsection{Binning Function}

Throughout the paper we use a bin size of $\beta = 1$ (price units per bin), so the bin of price $p$ is simply its floor:

\begin{equation}\label{eq:bin}
b(p) = \lfloor p \rfloor .
\end{equation}

Thus bins are labelled by the integer price level at their lower boundary, e.g. bin $3000$ covers prices $[3000,3001)$.

\section{Conventional Market Profile – CMP‑sd}\label{sec:cmp}

The conventional profile maps each observation $i$ to exactly the bin of its price $p_i$ (Table~\ref{tab:rawdata}, column “Price”). No filling of intermediate bins occurs.

\subsection{Definitions}

\begin{align}
S^{\mathrm{opn}}_{\mathrm{CMP}}[k] &= \sum_{i=1}^{N} \mathbf{1}[\,b(p_i)=k\,] \label{eq:cmp-opn}\\
S^{\mathrm{tvh}}_{\mathrm{CMP}}[k] &= \sum_{i=1}^{N} V_i \; \mathbf{1}[\,b(p_i)=k\,] \label{eq:cmp-tvh}\\
S^{\mathrm{tvm}}_{\mathrm{CMP}}[k] &= \sum_{i=1}^{N} V_i \, r^{\mathrm{cmp}}_i \; \mathbf{1}[\,b(p_i)=k\,] \label{eq:cmp-tvm}
\end{align}

\subsection{Algorithms}

\begin{algorithm}[!t]
\caption{CMP‑sd Construction}
\label{alg:cmp}
\begin{algorithmic}[1]
\REQUIRE $\{p_i\},\{V_i\},\{r^{\mathrm{cmp}}_i\}$, $\beta$
\ENSURE $S_{\mathrm{opn}},S_{\mathrm{tvh}},S_{\mathrm{tvm}}$
\STATE Initialise all arrays to 0
\FOR{$i=1$ \TO $N$}
  \STATE $k \gets \lfloor p_i/\beta\rfloor$
  \STATE $S_{\mathrm{opn}}[k] \mathrel{+}= 1$
  \STATE $S_{\mathrm{tvh}}[k] \mathrel{+}= V_i$
  \STATE $S_{\mathrm{tvm}}[k] \mathrel{+}= V_i \, r^{\mathrm{cmp}}_i$
\ENDFOR
\RETURN $S_{\mathrm{opn}},S_{\mathrm{tvh}},S_{\mathrm{tvm}}$
\end{algorithmic}
\end{algorithm}

Complexity: $\mathcal{O}(N)$.

\subsection{Worked Example}

Applying (\ref{eq:cmp-opn})–(\ref{eq:cmp-tvm}) to the data of Table~\ref{tab:rawdata} yields Tables~\ref{tab:cmp-opn}–\ref{tab:cmp-tvm} and the stacked‑bar charts of Fig.~\ref{fig:cmp}.

\begin{table}[!t]
\centering
\caption{CMP‑sd‑opn Profile}
\label{tab:cmp-opn}
\begin{tabular}{@{}ccccc@{}}
\toprule
Bin & Range & Group & Stacks \\
\midrule
3000 & 3000–3001 & A      & 1 \\
3002 & 3002–3003 & C      & 1 \\
3003 & 3003–3004 & B,G,I,J& 4 \\
3004 & 3004–3005 & H      & 1 \\
3007 & 3007–3008 & E      & 1 \\
3009 & 3009–3010 & D,F    & 2 \\
\cmidrule{4-4}
\multicolumn{3}{c}{\textbf{Total}} & \textbf{10} \\
\bottomrule
\end{tabular}
\end{table}

\begin{table}[!t]
\centering
\caption{CMP‑sd‑tvh Profile}
\label{tab:cmp-tvh}
\begin{tabular}{@{}ccccc@{}}
\toprule
Bin & Range & Group & $V$ sum \\
\midrule
3000 & 3000–3001 & A      & 432 \\
3002 & 3002–3003 & C      & 221 \\
3003 & 3003–3004 & B,G,I,J& 739 \\
3004 & 3004–3005 & H      & 483 \\
3007 & 3007–3008 & E      & 1245 \\
3009 & 3009–3010 & D,F    & 1272 \\
\bottomrule
\end{tabular}
\end{table}

\begin{table}[!t]
\centering
\caption{CMP‑sd‑tvm Profile}
\label{tab:cmp-tvm}
\begin{tabular}{@{}ccccc@{}}
\toprule
Bin & Range & Group & $V\cdot r^{\mathrm{cmp}}$ \\
\midrule
3000 & 3000–3001 & A      & 432 \\
3002 & 3002–3003 & C      & 442 \\
3003 & 3003–3004 & B,G,I,J& 2471 \\
3004 & 3004–3005 & H      & 966 \\
3007 & 3007–3008 & E      & 3735 \\
3009 & 3009–3010 & D,F    & 8871 \\
\bottomrule
\end{tabular}
\end{table}

\begin{figure}[!t]
\centering
\begin{tabular}{ccc}
\includegraphics[width=0.31\linewidth]{CMP-sd-opn.png} &
\includegraphics[width=0.31\linewidth]{CMP-sd-tvh.png} &
\includegraphics[width=0.31\linewidth]{CMP-sd-tvm.png} \\
(a) CMP‑sd‑opn & (b) CMP‑sd‑tvh & (c) CMP‑sd‑tvm
\end{tabular}
\caption{Conventional Market Profile, single datapoint. Four bins remain empty; the 3003 bin concentrates four letters.}
\label{fig:cmp}
\end{figure}

\section{Range Market Profile – RMP‑rd}\label{sec:rmp}

For each observation $i$ the range market profile uses the high price $H_i$ and low price $L_i$ to fill every bin that lies between them, inclusive of the boundary bins. This is the classical profile construction when bar data (OHLC) is available.

\subsection{Definitions}

Let $\mathcal{R}_i = \{ k \in \mathbb{Z} \mid \min(b(H_i),b(L_i)) \le k \le \max(b(H_i),b(L_i)) \}$.

\begin{align}
S^{\mathrm{opn}}_{\mathrm{RMP}}[k] &= \sum_{i=1}^{N} \mathbf{1}[\,k \in \mathcal{R}_i\,] \label{eq:rmp-opn}\\
S^{\mathrm{tvh}}_{\mathrm{RMP}}[k] &= \sum_{i=1}^{N} V_i \; \mathbf{1}[\,k \in \mathcal{R}_i\,] \label{eq:rmp-tvh}\\
S^{\mathrm{tvm}}_{\mathrm{RMP}}[k] &= \sum_{i=1}^{N} V_i \, r^{\mathrm{rmp}}_i \; \mathbf{1}[\,k \in \mathcal{R}_i\,] \label{eq:rmp-tvm}
\end{align}

\subsection{Algorithm}

\begin{algorithm}[!t]
\caption{RMP‑rd Construction}
\label{alg:rmp}
\begin{algorithmic}[1]
\REQUIRE $\{H_i\},\{L_i\},\{V_i\},\{r^{\mathrm{rmp}}_i\}$, $\beta$
\ENSURE $S_{\mathrm{opn}},S_{\mathrm{tvh}},S_{\mathrm{tvm}}$
\STATE Initialise all arrays to 0
\FOR{$i=1$ \TO $N$}
  \STATE $k_{\mathrm{lo}} \gets \lfloor \min(H_i,L_i)/\beta\rfloor$
  \STATE $k_{\mathrm{hi}} \gets \lfloor \max(H_i,L_i)/\beta\rfloor$
  \FOR{$k = k_{\mathrm{lo}}$ \TO $k_{\mathrm{hi}}$}
    \STATE $S_{\mathrm{opn}}[k] \mathrel{+}= 1$
    \STATE $S_{\mathrm{tvh}}[k] \mathrel{+}= V_i$
    \STATE $S_{\mathrm{tvm}}[k] \mathrel{+}= V_i \, r^{\mathrm{rmp}}_i$
  \ENDFOR
\ENDFOR
\RETURN $S_{\mathrm{opn}},S_{\mathrm{tvh}},S_{\mathrm{tvm}}$
\end{algorithmic}
\end{algorithm}

Complexity: $\mathcal{O}(N + \sum_i |b(H_i)-b(L_i)|)$.

\subsection{Worked Example}

Tables~\ref{tab:rmp-opn}–\ref{tab:rmp-tvm} give the exact per‑bin sums; Fig.~\ref{fig:rmp} displays the corresponding stacked profiles.

\begin{table}[!t]
\centering
\caption{RMP‑rd‑opn Profile}
\label{tab:rmp-opn}
\begin{tabular}{@{}ccccc@{}}
\toprule
Bin & Range & Group & Stacks \\
\midrule
3000 & 3000–3001 & A,C,I       & 3 \\
3001 & 3001–3002 & B,C,G,I     & 4 \\
3002 & 3002–3003 & B,C,G,I,J   & 5 \\
3003 & 3003–3004 & B,G,H,I,J   & 5 \\
3004 & 3004–3005 & H           & 1 \\
3005 & 3005–3006 & D           & 1 \\
3006 & 3006–3007 & D,E         & 2 \\
3007 & 3007–3008 & D,E,F       & 3 \\
3008 & 3008–3009 & D,F         & 2 \\
3009 & 3009–3010 & D,F         & 2 \\
\cmidrule{4-4}
\multicolumn{3}{c}{\textbf{Total}} & \textbf{28} \\
\bottomrule
\end{tabular}
\end{table}

\begin{table}[!t]
\centering
\caption{RMP‑rd‑tvh Profile}
\label{tab:rmp-tvh}
\begin{tabular}{@{}ccccc@{}}
\toprule
Bin & Range & Group & $V$ sum \\
\midrule
3000 & 3000–3001 & A,C,I       & 810 \\
3001 & 3001–3002 & B,C,G,I     & 711 \\
3002 & 3002–3003 & B,C,G,I,J   & 960 \\
3003 & 3003–3004 & B,G,H,I,J   & 1222 \\
3004 & 3004–3005 & H           & 483 \\
3005 & 3005–3006 & D           & 1011 \\
3006 & 3006–3007 & D,E         & 2256 \\
3007 & 3007–3008 & D,E,F       & 2517 \\
3008 & 3008–3009 & D,F         & 1272 \\
3009 & 3009–3010 & D,F         & 1272 \\
\bottomrule
\end{tabular}
\end{table}

\begin{table}[!t]
\centering
\caption{RMP‑rd‑tvm Profile}
\label{tab:rmp-tvm}
\begin{tabular}{@{}ccccc@{}}
\toprule
Bin & Range & Group & $V\cdot r^{\mathrm{rmp}}$ \\
\midrule
3000 & 3000–3001 & A,C,I       & 1723 \\
3001 & 3001–3002 & B,C,G,I     & 2290 \\
3002 & 3002–3003 & B,C,G,I,J   & 2788 \\
3003 & 3003–3004 & B,G,H,I,J   & 3091 \\
3004 & 3004–3005 & H           & 966 \\
3005 & 3005–3006 & D           & 5055 \\
3006 & 3006–3007 & D,E         & 7545 \\
3007 & 3007–3008 & D,E,F       & 8328 \\
3008 & 3008–3009 & D,F         & 5838 \\
3009 & 3009–3010 & D,F         & 5838 \\
\bottomrule
\end{tabular}
\end{table}

\begin{figure}[!t]
\centering
\begin{tabular}{ccc}
\includegraphics[width=0.31\linewidth]{RMP-rd-opn.png} &
\includegraphics[width=0.31\linewidth]{RMP-rd-tvh.png} &
\includegraphics[width=0.31\linewidth]{RMP-rd-tvm.png} \\
(a) RMP‑rd‑opn & (b) RMP‑rd‑tvh & (c) RMP‑rd‑tvm
\end{tabular}
\caption{Range Market Profile. Every bin between the high and low of each observation is filled; no empty bins remain.}
\label{fig:rmp}
\end{figure}

\section{Gap‑Filled Market Profile, Single Datapoint – GMP‑sd}\label{sec:gmpsd}

The gap‑filled single‑datapoint profile interpolates the bins traversed between consecutive observations using only the discrete price sequence $p_1,\dots,p_N$. Moving from $p_{i-1}$ to $p_i$, every integer bin that lies strictly between $b(p_{i-1})$ and $b(p_i)$ (in the direction of the move) plus the bin of $p_i$ receives a contribution from observation $i$. The first observation contributes only to its own bin. This construction completely eliminates the gaps inherent in CMP‑sd.

\subsection{Definitions}

For $i>1$ define the set of bins touched by the transition from $p_{i-1}$ to $p_i$ as
\begin{equation}\label{eq:gmpsd-set}
\mathcal{G}^{\mathrm{sd}}_i = 
\begin{cases}
\{b(p_i)\}, & \text{if } b(p_i)=b(p_{i-1}), \\[4pt]
\bigl\{ b(p_i),\; b(p_i)-d,\; \dots,\; b(p_{i-1})+d \bigr\}, & \text{otherwise},
\end{cases}
\end{equation}
where $d = \operatorname{sgn}(b(p_i)-b(p_{i-1}))$ and the enumeration runs from $b(p_i)$ toward $b(p_{i-1})$ (exclusive of $b(p_{i-1})$). For $i=1$ we set $\mathcal{G}^{\mathrm{sd}}_1 = \{b(p_1)\}$. Then the three weighting modes are
\begin{align}
S^{\mathrm{opn}}_{\mathrm{GMPsd}}[k] &= \sum_{i=1}^{N} \mathbf{1}[\,k \in \mathcal{G}^{\mathrm{sd}}_i\,] \label{eq:gmpsd-opn}\\
S^{\mathrm{tvh}}_{\mathrm{GMPsd}}[k] &= \sum_{i=1}^{N} V_i \; \mathbf{1}[\,k \in \mathcal{G}^{\mathrm{sd}}_i\,] \label{eq:gmpsd-tvh}\\
S^{\mathrm{tvm}}_{\mathrm{GMPsd}}[k] &= \sum_{i=1}^{N} V_i \, r^H_i \; \mathbf{1}[\,k \in \mathcal{G}^{\mathrm{sd}}_i\,] \label{eq:gmpsd-tvm}
\end{align}

\subsection{Algorithm}

\begin{algorithm}[!t]
\caption{GMP‑sd Construction}
\label{alg:gmpsd}
\begin{algorithmic}[1]
\REQUIRE $\{p_i\},\{V_i\},\{r^H_i\}$, $\beta$
\ENSURE $S_{\mathrm{opn}},S_{\mathrm{tvh}},S_{\mathrm{tvm}}$
\STATE Initialise all arrays to $0$
\STATE $k_{\mathrm{prev}} \gets \lfloor p_1/\beta \rfloor$
\STATE Add contributions for $i=1$ to bin $k_{\mathrm{prev}}$ (opn = 1, tvh = $V_1$, tvm = $V_1 r^H_1$)
\FOR{$i=2$ \TO $N$}
  \STATE $k_{\mathrm{curr}} \gets \lfloor p_i/\beta \rfloor$
  \STATE $d \gets \operatorname{sgn}(k_{\mathrm{curr}}-k_{\mathrm{prev}})$
  \STATE $k \gets k_{\mathrm{curr}}$
  \WHILE{$k \neq k_{\mathrm{prev}}$}
    \STATE Add to bin $k$: opn + 1, tvh + $V_i$, tvm + $V_i\,r^H_i$
    \STATE $k \gets k - d$
  \ENDWHILE
  \STATE (If $k_{\mathrm{curr}} = k_{\mathrm{prev}}$, add once to bin $k_{\mathrm{curr}}$)
  \STATE $k_{\mathrm{prev}} \gets k_{\mathrm{curr}}$
\ENDFOR
\RETURN profiles
\end{algorithmic}
\end{algorithm}

Complexity: $\mathcal{O}(N + D)$ where $D = \sum_{i=2}^N |b(p_i)-b(p_{i-1})|$.

\subsection{Worked Example}

Using the same price sequence, the gaps are filled exactly as described. Tables~\ref{tab:gmpsd-opn}–\ref{tab:gmpsd-tvm} record the resulting per‑bin values; Fig.~\ref{fig:gmpsd} shows the corresponding charts. The total number of stacks in the opn mode rises from 10 (CMP) to 25; the 3003 bin now contains five different letters.

\begin{table}[!t]
\centering
\caption{GMP‑sd‑opn Profile}
\label{tab:gmpsd-opn}
\begin{tabular}{@{}ccccc@{}}
\toprule
Bin & Range & Group & Stacks \\
\midrule
3000 & 3000–3001 & A      & 1 \\
3001 & 3001–3002 & A      & 1 \\
3002 & 3002–3003 & A,C    & 2 \\
3003 & 3003–3004 & B,C,G,I,J & 5 \\
3004 & 3004–3005 & C,F,H  & 3 \\
3005 & 3005–3006 & C,F    & 2 \\
3006 & 3006–3007 & C,F    & 2 \\
3007 & 3007–3008 & C,E,F  & 3 \\
3008 & 3008–3009 & C,D,E,F& 4 \\
3009 & 3009–3010 & D,F    & 2 \\
\cmidrule{4-4}
\multicolumn{3}{c}{\textbf{Total}} & \textbf{25} \\
\bottomrule
\end{tabular}
\end{table}

\begin{table}[!t]
\centering
\caption{GMP‑sd‑tvh Profile}
\label{tab:gmpsd-tvh}
\begin{tabular}{@{}ccccc@{}}
\toprule
Bin & Range & Group & $V$ sum \\
\midrule
3000 & 3000–3001 & A      & 432 \\
3001 & 3001–3002 & A      & 141 \\
3002 & 3002–3003 & A,C    & 362 \\
3003 & 3003–3004 & B,C,G,I,J & 1750 \\
3004 & 3004–3005 & C,F,H  & 1686 \\
3005 & 3005–3006 & C,F    & 1203 \\
3006 & 3006–3007 & C,F    & 1203 \\
3007 & 3007–3008 & C,E,F  & 2448 \\
3008 & 3008–3009 & C,D,E,F& 2709 \\
3009 & 3009–3010 & D,F    & 1272 \\
\bottomrule
\end{tabular}
\end{table}

\begin{table}[!t]
\centering
\caption{GMP‑sd‑tvm Profile}
\label{tab:gmpsd-tvm}
\begin{tabular}{@{}ccccc@{}}
\toprule
Bin & Range & Group & $V\cdot r^H$ \\
\midrule
3000 & 3000–3001 & A      & 432 \\
3001 & 3001–3002 & A      & 564 \\
3002 & 3002–3003 & A,C    & 1006 \\
3003 & 3003–3004 & B,C,G,I,J & 10559 \\
3004 & 3004–3005 & C,F,H  & 10398 \\
3005 & 3005–3006 & C,F    & 9432 \\
3006 & 3006–3007 & C,F    & 9432 \\
3007 & 3007–3008 & C,E,F  & 13167 \\
3008 & 3008–3009 & C,D,E,F& 13950 \\
3009 & 3009–3010 & D,F    & 8871 \\
\bottomrule
\end{tabular}
\end{table}

\begin{figure}[!t]
\centering
\begin{tabular}{ccc}
\includegraphics[width=0.31\linewidth]{GMP-sd-opn.png} &
\includegraphics[width=0.31\linewidth]{GMP-sd-tvh.png} &
\includegraphics[width=0.31\linewidth]{GMP-sd-tvm.png} \\
(a) GMP‑sd‑opn & (b) GMP‑sd‑tvh & (c) GMP‑sd‑tvm
\end{tabular}
\caption{Gap‑Filled Market Profile, single datapoint. All integer bins between consecutive observations are populated; no empty bins remain.}
\label{fig:gmpsd}
\end{figure}

\section{Gap‑Filled Market Profile, Multiple Datapoint – GMP‑md}\label{sec:gmpmd}

When each observation supplies both a high price $H_i$ and a low price $L_i$, we can gap‑fill the two series independently. This yields two parallel gap‑filled traces—one for the high line and one for the low line—that are superimposed on the same profile. The colour labels differentiate high‑side (suffix “H”) and low‑side (suffix “L”) contributions.

\subsection{Definitions}

Define the gap‑fill sets for the high series $\mathcal{G}^{H}_i$ and for the low series $\mathcal{G}^{L}_i$ exactly as in (\ref{eq:gmpsd-set}) but applied to the sequences $\{H_i\}$ and $\{L_i\}$ respectively. The three weighting schemes become
\begin{align}
S^{\mathrm{opn}}_{\mathrm{GMPmd}}[k] &= \sum_{i=1}^{N} \Bigl( \mathbf{1}[k\in\mathcal{G}^{H}_i] + \mathbf{1}[k\in\mathcal{G}^{L}_i] \Bigr) \label{eq:gmpmd-opn}\\
S^{\mathrm{tvh}}_{\mathrm{GMPmd}}[k] &= \sum_{i=1}^{N} V_i \Bigl( \mathbf{1}[k\in\mathcal{G}^{H}_i] + \mathbf{1}[k\in\mathcal{G}^{L}_i] \Bigr) \label{eq:gmpmd-tvh}\\
S^{\mathrm{tvm}}_{\mathrm{GMPmd}}[k] &= \sum_{i=1}^{N} \Bigl( V_i\,r^H_i\,\mathbf{1}[k\in\mathcal{G}^{H}_i] + V_i\,r^L_i\,\mathbf{1}[k\in\mathcal{G}^{L}_i] \Bigr) \label{eq:gmpmd-tvm}
\end{align}

\subsection{Algorithm}

\begin{algorithm}[!t]
\caption{GMP‑md Construction}
\label{alg:gmpmd}
\begin{algorithmic}[1]
\REQUIRE $\{H_i\},\{L_i\},\{V_i\},\{r^H_i\},\{r^L_i\}$, $\beta$
\ENSURE $S_{\mathrm{opn}},S_{\mathrm{tvh}},S_{\mathrm{tvm}}$
\STATE Initialise all arrays to $0$
\STATE $k^H_{\mathrm{prev}} \gets \lfloor H_1/\beta\rfloor$, $k^L_{\mathrm{prev}} \gets \lfloor L_1/\beta\rfloor$
\STATE Add contributions of observation 1 to bins $k^H_{\mathrm{prev}}$ (high side) and $k^L_{\mathrm{prev}}$ (low side)
\FOR{$i=2$ \TO $N$}
  \STATE Process high side: gap-fill from $k^H_{\mathrm{prev}}$ to $\lfloor H_i/\beta\rfloor$ with weights $(1,V_i,V_i r^H_i)$, adding to relevant bins.
  \STATE Process low side: similarly from $k^L_{\mathrm{prev}}$ to $\lfloor L_i/\beta\rfloor$ with weights $(1,V_i,V_i r^L_i)$.
  \STATE Update $k^H_{\mathrm{prev}},k^L_{\mathrm{prev}}$
\ENDFOR
\RETURN profiles
\end{algorithmic}
\end{algorithm}

Complexity: $\mathcal{O}(N + D_H + D_L)$.

\subsection{Worked Example}

Tables~\ref{tab:gmpmd-opn}–\ref{tab:gmpmd-tvm} present the exact per‑bin accumulations; Fig.~\ref{fig:gmpmd} displays the stacked charts (each bar is split into high‑side and low‑side segments). Notice that the two‑stream approach produces a richer distribution than the single‑datapoint version: for instance, bin 3002 receives contributions from both the high and low gap‑fills.

\begin{table}[!t]
\centering
\caption{GMP‑md‑opn Profile}
\label{tab:gmpmd-opn}
\begin{tabular}{@{}ccccc@{}}
\toprule
Bin & Range & Group (High+Low) & Stacks \\
\midrule
3000 & 3000–3001 & AH,AL,CL,IL           & 4 \\
3001 & 3001–3002 & AH,BL,DL,GL,IL,JL     & 6 \\
3002 & 3002–3003 & AH,CH,DL,GL,HL,IL,JL  & 7 \\
3003 & 3003–3004 & BH,CH,DH,GH,IH,JH,AL,CL,IL & 8 \\
3004 & 3004–3005 & CH,DH,FH,HH,GH,IL     & 5 \\
3005 & 3005–3006 & CH,DH,FH,GH          & 4 \\
3006 & 3006–3007 & CH,DH,FH,GH,EL       & 4 \\
3007 & 3007–3008 & CH,DH,EH,FH,GH,FL    & 4 \\
3008 & 3008–3009 & CH,DH,EH,FH,GH       & 4 \\
3009 & 3009–3010 & DH,FH                & 2 \\
\cmidrule{4-4}
\multicolumn{3}{c}{\textbf{Total}} & \textbf{48} \\
\bottomrule
\end{tabular}
\end{table}

\begin{table}[!t]
\centering
\caption{GMP‑md‑tvh Profile}
\label{tab:gmpmd-tvh}
\begin{tabular}{@{}ccccc@{}}
\toprule
Bin & Range & Group & $V$ sum (H + L) \\
\midrule
3000 & 3000–3001 & AH,AL,CL,IL           & 1242 \\
3001 & 3001–3002 & AH,BL,DL,GL,IL,JL     & 1891 \\
3002 & 3002–3003 & AH,CH,DL,GL,HL,IL,JL  & 2454 \\
3003 & 3003–3004 & BH,CH,DH,GH,IH,JH,AL,CL,IL & 3436 \\
3004 & 3004–3005 & CH,DH,FH,HH,GH,IL     & 2889 \\
3005 & 3005–3006 & CH,DH,FH,GH          & 2406 \\
3006 & 3006–3007 & CH,DH,FH,GH,EL       & 2640 \\
3007 & 3007–3008 & CH,DH,EH,FH,GH,FL    & 2709 \\
3008 & 3008–3009 & CH,DH,EH,FH,GH       & 2709 \\
3009 & 3009–3010 & DH,FH                & 1272 \\
\bottomrule
\end{tabular}
\end{table}

\begin{table}[!t]
\centering
\caption{GMP‑md‑tvm Profile}
\label{tab:gmpmd-tvm}
\begin{tabular}{@{}ccccc@{}}
\toprule
Bin & Range & Group & $V\cdot r$ sum (H + L) \\
\midrule
3000 & 3000–3001 & AH,AL,CL,IL           & 1934 \\
3001 & 3001–3002 & AH,BL,DL,GL,IL,JL     & 9631 \\
3002 & 3002–3003 & AH,CH,DL,GL,HL,IL,JL  & 11240 \\
3003 & 3003–3004 & BH,CH,DH,GH,IH,JH,AL,CL,IL & 19418 \\
3004 & 3004–3005 & CH,DH,FH,HH,GH,IL     & 17808 \\
3005 & 3005–3006 & CH,DH,FH,GH          & 16842 \\
3006 & 3006–3007 & CH,DH,FH,GH,EL       & 13266 \\
3007 & 3007–3008 & CH,DH,EH,FH,GH,FL    & 13689 \\
3008 & 3008–3009 & CH,DH,EH,FH,GH       & 13950 \\
3009 & 3009–3010 & DH,FH                & 8871 \\
\bottomrule
\end{tabular}
\end{table}

\begin{figure}[!t]
\centering
\begin{tabular}{ccc}
\includegraphics[width=0.31\linewidth]{GMP-md-opn.png} &
\includegraphics[width=0.31\linewidth]{GMP-md-tvh.png} &
\includegraphics[width=0.31\linewidth]{GMP-md-tvm.png} \\
(a) GMP‑md‑opn & (b) GMP‑md‑tvh & (c) GMP‑md‑tvm
\end{tabular}
\caption{Gap‑Filled Market Profile, multiple datapoint. Each bin receives separate high‑side (suffix “H”) and low‑side (suffix “L”) contributions.}
\label{fig:gmpmd}
\end{figure}

\section{Effect of Bin Size on Profile Resolution}\label{sec:binsize}

The bin size $\beta$ directly controls the number of bins traversed by a given price displacement $\Delta p$. For a single‑datapoint gap‑filled profile, the number of bins touched by the transition from $p_{i-1}$ to $p_i$ is
\begin{equation}\label{eq:bins_gmp}
K_{\mathrm{GMP}}(\beta) = |\,b(p_i)-b(p_{i-1})\,| + 1,
\end{equation}
where $b(p) = \lfloor p/\beta\rfloor$. In contrast, CMP‑sd always occupies exactly two bins (the bins of $p_{i-1}$ and $p_i$) regardless of $\beta$, provided $b(p_{i-1}) \neq b(p_i)$.

\begin{proposition}[Bin‑count scaling]\label{prop:scaling}
For a fixed price change $\Delta p = p_i-p_{i-1}$ and two bin sizes $\beta_1 > \beta_2 > 0$,
\begin{equation}\label{eq:scaling}
K_{\mathrm{GMP}}(\beta_2) \;\ge\; \left\lfloor\frac{\beta_1}{\beta_2}\right\rfloor \bigl( K_{\mathrm{GMP}}(\beta_1) - 1 \bigr) + 1 .
\end{equation}
\end{proposition}

\begin{proof}
Write $\Delta p = (K_{\mathrm{GMP}}(\beta_1)-1)\beta_1 + \epsilon$ with $0\le\epsilon<\beta_1$. Then
\begin{align}
K_{\mathrm{GMP}}(\beta_2) &= \left\lfloor \frac{\Delta p}{\beta_2} \right\rfloor + 1 \nonumber\\
&\ge \left\lfloor \frac{(K_{\mathrm{GMP}}(\beta_1)-1)\beta_1}{\beta_2} \right\rfloor + 1 \nonumber\\
&\ge \left\lfloor\frac{\beta_1}{\beta_2}\right\rfloor (K_{\mathrm{GMP}}(\beta_1)-1) + 1 .
\end{align}
\end{proof}

\Cref{tab:binsize} illustrates the scaling for a representative $\Delta p = 10$. Both GMP‑sd and RMP‑rd (which also fills all bins between extremes) scale inversely with $\beta$, whereas CMP‑sd remains locked at two bins.

\begin{table}[!t]
\centering
\caption{Bin count vs.\ $\beta$ for $\Delta p = 10$}
\label{tab:binsize}
\begin{tabular}{@{}cccc@{}}
\toprule
$\beta$ & $K_{\mathrm{CMP}}$ & $K_{\mathrm{GMP}}$ & $K_{\mathrm{RMP}}$ \\
\midrule
2.0  & 2 & 6  & 6  \\
1.0  & 2 & 11 & 11 \\
0.5  & 2 & 21 & 21 \\
0.25 & 2 & 41 & 41 \\
0.1  & 2 & 101& 101\\
\bottomrule
\end{tabular}
\end{table}

\section{Discussion}\label{sec:discussion}

\subsection{Structural Properties}

\textbf{Gap elimination.} The GMP‑sd and GMP‑md families are intentionally designed to leave no empty bin between the minimum and maximum price reached by the sequence. This is a direct consequence of the forward fill rule (\ref{eq:gmpsd-set}): every integer between consecutive floors is included. The RMP‑rd family achieves a comparable completeness by construction. In the worked example, CMP‑sd has four empty bins (3001,3005,3006,3008), whereas all gap‑filled and range‑based profiles are fully populated.

\textbf{Tick‑volume amplification.} The tvh mode treats the tick volume $V_i$ as a holistic quantity: the entire $V_i$ is assigned to every bin that observation $i$ touches along its path. This yields a volume‑inventory view—the total profile sum equals $\sum_i V_i \cdot (\text{\#bins touched}_i)$, which can be large when a single observation traverses many bins. The tvm mode multiplies $V_i$ by a pre‑specified range $r_i$; therefore it effectively weights each observation’s contribution by its price span, independently of the bin count. The choice between tvh and tvm depends on whether the user wishes to preserve the raw volume footprint (tvh) or to scale the volume by the observed price magnitude (tvm).

\textbf{Multiple‑datapoint enrichment.} GMP‑md, which processes high and low series independently, recognises that the high and low boundaries may follow different dynamics. The resulting profile contains two interleaved layers, offering a more detailed picture than either CMP‑sd or GMP‑sd alone. For instance, in the example bin 3002 receives heavy low‑side participation (AL,CL,IL,JL) that is invisible in the single‑datapoint traces.

\subsection{Limitations}

\textbf{Assumption of continuous traversal.} Gap‑filling assumes that price passed through every intermediate bin between consecutive observations. True price gaps due to market closure or extreme illiquidity will be synthetically filled. A practical workaround is to reset the gap‑fill whenever a time gap exceeds a chosen threshold.

\textbf{Cumulative displacement.} The computational cost of GMP‑sd and GMP‑md grows with the total bin displacement $D$. In extreme volatile periods this may become large, although it remains linear in $D$ and is typically acceptable for real‑time processing.

\textbf{Interpretation of multiplication mode.} The tvm mode multiplies per‑observation tick volume by a range parameter that is external to the price sequence. If the range $r_i$ is not carefully chosen, the resulting profile may overweight certain observations. In the given example the range values are pre‑computed from the data itself, providing a consistent scaling.

\subsection{Comparison of the Twelve Variants}

Table~\ref{tab:summary} summarises the key characteristics of all 12 profiles. The total profile sum (sum of all bin values) grows from the bare count of observations (CMP‑sd‑opn) to thousands in the amplified versions, reflecting the different weighting philosophies.

\begin{table}[!t]
\centering
\caption{Summary of Profile Characteristics}
\label{tab:summary}
\resizebox{\columnwidth}{!}{%
\begin{tabular}{@{}lccc@{}}
\toprule
Profile & Total Sum & Empty Bins & Bin with Max \\
\midrule
CMP‑sd‑opn  & 10 & 4 & 3003 (4) \\
CMP‑sd‑tvh  & 4392 & 4 & 3009 (1272) \\
CMP‑sd‑tvm  & 16432 & 4 & 3009 (8871) \\
RMP‑rd‑opn  & 28 & 0 & 3002,3003 (5) \\
RMP‑rd‑tvh  & 12416 & 0 & 3007 (2517) \\
RMP‑rd‑tvm  & 43862 & 0 & 3007 (8328) \\
GMP‑sd‑opn  & 25 & 0 & 3003 (5) \\
GMP‑sd‑tvh  & 13544 & 0 & 3008 (2709) \\
GMP‑sd‑tvm  & 78739 & 0 & 3008 (13950) \\
GMP‑md‑opn  & 48 & 0 & 3003 (8) \\
GMP‑md‑tvh  & 23728 & 0 & 3003 (3436) \\
GMP‑md‑tvm  & 126631 & 0 & 3003 (19418) \\
\bottomrule
\end{tabular}
}
\end{table}

\section{Conclusion}\label{sec:conclusion}

We have presented a complete taxonomy of twelve market profile variants structured into four families (CMP‑sd, RMP‑rd, GMP‑sd, GMP‑md) each with three tick‑volume amplification modes (opn, tvh, tvm). Every variant has been formalised mathematically, supplied with an explicit algorithm, and illustrated on a common ten‑point dataset using colour‑coded stacked‑bar charts generated by a reference Python implementation. The gap‑filled families eliminate the empty bins that plague conventional profiles, and the tick‑volume modes enrich the distribution with size information. A bin‑size scaling proposition quantifies the resolution advantage of the gap‑filled and range‑based methods over the conventional approach. The framework is universal, requiring only an ordered price sequence and optional auxiliary parameters, and is computationally efficient enough for real‑time use. Future work may extend the construction to combined up/down directional footprint and to finer volume‑distribution strategies.

% ── REFERENCES ─────────────────────────────────────────────────────────────────
\begin{thebibliography}{10}
\bibitem{steidlmayer1986market}
J.~Steidlmayer, \emph{Market Profile}, Chicago Board of Trade, 1986.
\bibitem{dalton2007markets}
J.~F.~Dalton, E.~T.~Jones, and R.~B.~Dalton, \emph{Markets in Profile: Profiting from the Auction Process}, John Wiley \& Sons, 2007.
\bibitem{clark1973subordinated}
P.~K.~Clark, ``A subordinated stochastic process model with finite variance for speculative prices,'' \emph{Econometrica}, vol.~41, no.~1, pp.~135--155, 1973.
\bibitem{ane2000order}
T.~An\'{e} and H.~Geman, ``Order flow, transaction clock, and normality of asset returns,'' \emph{The Journal of Finance}, vol.~55, no.~5, pp.~2259--2284, 2000.
\bibitem{glosten1985bid}
L.~R.~Glosten and P.~R.~Milgrom, ``Bid, ask and transaction prices in a specialist market with heterogeneously informed traders,'' \emph{Journal of Financial Economics}, vol.~14, no.~1, pp.~71--100, 1985.
\bibitem{ohara1995market}
M.~O'Hara, \emph{Market Microstructure Theory}, Blackwell, 1995.
\bibitem{madhavan2000market}
A.~Madhavan, ``Market microstructure: A survey,'' \emph{Journal of Financial Markets}, vol.~3, no.~3, pp.~205--258, 2000.
\end{thebibliography}

\end{document}