\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}}

\begin{document}

% ══════════════════════════════════════════════════════════════════════════════
%  TITLE
% ══════════════════════════════════════════════════════════════════════════════

\title{GMP: Gap-filled Market Profile Universal Construction for Any Data Points}

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

\maketitle

% ══════════════════════════════════════════════════════════════════════════════
%  ABSTRACT
% ══════════════════════════════════════════════════════════════════════════════
\begin{abstract}
Conventional Market Profile (CMP) aggregates price activity into histogram bins, but when applied to any ordered sequence of price points (ticks, candlesticks, or other sampled data), it leaves bins between consecutive points empty. We propose \textbf{GMP (Gap-Filled Market Profile)}, a universal construction method that (i) operates on any sequence of price observations and (ii) interpolates every intermediate price bin traversed between successive points, producing a \emph{gap-filled} profile. Building on this gap‑filled structure, we introduce an \emph{Up/Down‑Bin Footprint Profile} that classifies each bin's contribution directionally, revealing net upward or downward pressure across the price traversal. We formalise CMP and GMP with explicit algorithms, derive the relationship between bin count and a user‑defined bin‑size parameter $\beta$, and present a complete worked example showing how points are grouped into bins under CMP, how gap‑filling transforms the sparse CMP output into a dense GMP profile, and how directional footprints are assigned. Charts and tables demonstrate that GMP yields a strictly denser and more informative distribution than CMP, independent of the original data source.
\end{abstract}

\begin{IEEEkeywords}
Market Profile, gap-filling interpolation, price bins, directional footprint, high-frequency data, time series
\end{IEEEkeywords}

% ── Side‑by‑side introductory CMP vs GMP figure ─────────────────────────────
\begin{figure}[!t]
  \centering
  \begin{tikzpicture}
    \begin{axis}[
      title={\textbf{CMP Profile}},
      xbar,
      xlabel={Stacks},
      ylabel={Price (USD)},
      ytick={3000,3001,...,3010},
      yticklabel style={font=\scriptsize},
      xmin=0, xmax=2,
      ymin=2999.5, ymax=3010.5,
      bar width=4pt,
      width=0.42\columnwidth,
      height=6.5cm,
      enlarge y limits=0.05,
      nodes near coords,
      nodes near coords style={font=\tiny},
      name=cmp
    ]
    \addplot[fill=gray!60, draw=black] coordinates {
      (1,3000) (0,3001) (0,3002) (0,3003) (0,3004) (0,3005)
      (0,3006) (0,3007) (0,3008) (0,3009) (1,3010)
    };
    \end{axis}

    \begin{axis}[
      title={\textbf{GMP Profile}},
      xbar,
      xlabel={Stacks},
      ylabel={},
      ytick={3000,3001,...,3010},
      yticklabel style={font=\scriptsize},
      xmin=0, xmax=2,
      ymin=2999.5, ymax=3010.5,
      bar width=4pt,
      width=0.42\columnwidth,
      height=6.5cm,
      enlarge y limits=0.05,
      nodes near coords,
      nodes near coords style={font=\tiny},
      at={(cmp.east)},
      anchor=west,
      xshift=1.2cm
    ]
    \addplot[fill=blue!50, draw=black] coordinates {
      (1,3000) (1,3001) (1,3002) (1,3003) (1,3004) (1,3005)
      (1,3006) (1,3007) (1,3008) (1,3009) (1,3010)
    };
    \end{axis}
  \end{tikzpicture}
  \caption{Horizontal histogram comparison of CMP (left, grey) and GMP (right, blue) for a price move from 3000 to 3010 with $\beta=1$. CMP shows activity only at the two observed prices; GMP fills all 11 traversed bins. Gap‑filling applies to any data sequence.}
  \label{fig:profile}
\end{figure}

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

The Market Profile, introduced by Steidlmayer~\cite{steidlmayer1986market} and later formalised by Dalton et~al.~\cite{dalton2007markets}, represents price activity as a horizontal histogram whose bins correspond to discrete price levels and whose bar lengths (``stacks'') reflect the amount of activity observed at each level. In practice, most implementations construct the profile from candlestick TOCHLV (time, open, close, high, low, volume) data: each candle contributes one stack to every bin between its high and low.

This approach suffers from a fundamental shortcoming when applied to any sequence of discrete price points: when consecutive points are separated by several price levels, the conventional profile records activity only at the two observed prices, ignoring the fact that price must have traversed every intermediate level. This gap neglect is not specific to any data source—it occurs with ticks, candlesticks, or any sampled price series.

We address this issue with \textbf{GMP (Gap‑Filled Market Profile)}. The construction rule is universal: for every ordered sequence of price observations $\{p_i\}_{i=1}^{N}$, every bin between two successive points receives an interpolated stack, producing a profile with no gaps. The method does not depend on the original data frequency, source, or aggregation level; it applies equally to millisecond tick data, hourly candlesticks, or irregularly sampled price records.

The main contributions of this work are:
\begin{enumerate}
    \item A rigorous formalisation of CMP and GMP with explicit algorithms and complexity analyses.
    \item A theoretical relationship between the user‑controlled bin‑size parameter $\beta$ and profile resolution, including a scaling proposition.
    \item A universal gap‑filling methodology that can be applied to any ordered price sequence, irrespective of source.
    \item The introduction of an \emph{Up/Down‑Bin Footprint Profile}, a directional classification derived purely from the price traversal without requiring volume or order‑book data.
    \item A complete, self‑contained illustration of the construction on a ten‑point price sequence, demonstrating all theoretical constructs.
\end{enumerate}

The remainder of this paper is organised as follows. \Cref{sec:related} surveys related work. \Cref{sec:prelim} establishes notation. \Cref{sec:method} defines CMP and GMP formally, presents the GMP algorithm, and introduces the Up/Down‑Bin Footprint Profile. \Cref{sec:walkthrough} provides a complete profile construction example using a 10‑point price sequence. \Cref{sec:binsize} analyses the effect of bin size on profile resolution. \Cref{sec:example} offers a minimal illustrative example. \Cref{sec:discussion} discusses theoretical implications, and \Cref{sec:conclusion} concludes.

% ══════════════════════════════════════════════════════════════════════════════
%  II.  RELATED WORK
% ══════════════════════════════════════════════════════════════════════════════
\section{Related Work}\label{sec:related}

\subsection{Market Profile}
The Market Profile concept originates with Steidlmayer's observation that price distributions at each level reveal where market participants find ``fair value''~\cite{steidlmayer1986market}. Dalton et~al.~\cite{dalton2007markets} extended the framework with auction‑market theory, using half‑hour brackets as time‑price opportunities (TPOs). Both formulations rely on time‑based bars rather than raw ticks, but the underlying logic of binning price activity is independent of the data source.

\subsection{Interpolation in Financial Time Series}
Interpolation techniques are common in high‑frequency finance. Clark~\cite{clark1973subordinated} demonstrated that subordinating returns to trade‑count time yields closer‑to‑Gaussian distributions, motivating trade‑indexed analysis. An\'{e} and Geman~\cite{ane2000order} confirmed that business‑time transformations normalise returns at the tick level. The gap‑filling approach we propose is conceptually similar to linear interpolation on the price axis, but applied to histogram bin counts rather than to prices themselves.

\subsection{Footprint and Order‑Flow Analysis}
Market microstructure theory, including Glosten and Milgrom~\cite{glosten1985bid}, O'Hara~\cite{ohara1995market}, and Madhavan~\cite{madhavan2000market}, provides foundations for analysing directional pressure. Traditional footprint charts distinguish trades at bid versus ask prices. Our Up/Down‑Bin Footprint provides a complementary directional classification derived purely from the sequence of price observations, without requiring volume or order‑book data.

% ══════════════════════════════════════════════════════════════════════════════
%  III.  PRELIMINARIES
% ══════════════════════════════════════════════════════════════════════════════
\section{Preliminaries}\label{sec:prelim}

\Cref{tab:notation} summarises the notation used throughout.

\begin{table}[!t]
  \centering
  \caption{Notation Summary}
  \label{tab:notation}
  \begin{tabular}{@{}cl@{}}
    \toprule
    \textbf{Symbol} & \textbf{Description} \\
    \midrule
    $N$       & Total number of price observations in the sequence \\
    $p_i$     & Price of the $i$-th observation, $i\in\{1,\dots,N\}$ \\
    $\beta$   & Bin size (price units per bin); default $\beta=1$ \\
    $b(p)$    & Bin index of price $p$: $b(p)=\lfloor p/\beta \rfloor$ \\
    $S[k]$    & Stack count (profile value) at bin~$k$ \\
    $\Delta_i$ & Price displacement: $\Delta_i = p_i - p_{i-1}$ \\
    $K_i$     & Number of bins traversed from observation $i{-}1$ to $i$ \\
    $U[k]$    & Up‑bin count at bin $k$ \\
    $D[k]$    & Down‑bin count at bin $k$ \\
    $\delta[k]$ & Net footprint delta at bin $k$: $\delta[k] = U[k] - D[k]$ \\
    \bottomrule
  \end{tabular}
\end{table}

\begin{definition}[Price observation sequence]
  A \emph{price observation sequence} is an ordered set $\mathcal{P}=\{(t_i,\,p_i)\}_{i=1}^{N}$ where $t_i$ is an index (time, trade number, or any monotonic identifier) and $p_i$ is the observed price.
\end{definition}

\begin{definition}[Bin]
  Given bin size $\beta>0$, the \emph{bin} for price $p$ is the integer index
  \begin{equation}\label{eq:bin}
    b(p) = \left\lfloor \frac{p}{\beta} \right\rfloor.
  \end{equation}
  All prices $p$ satisfying $k\beta \le p < (k+1)\beta$ map to bin~$k$.
\end{definition}

\begin{definition}[Market Profile]
  A \emph{market profile} is a mapping $S:\mathbb{Z}\to\mathbb{N}_0$ where $S[k]$ counts the number of stacks accumulated at bin~$k$.
\end{definition}

% ══════════════════════════════════════════════════════════════════════════════
%  IV.  METHODOLOGY
% ══════════════════════════════════════════════════════════════════════════════
\section{Methodology}\label{sec:method}

\subsection{Conventional Market Profile (CMP)}\label{sec:cmp}

CMP records a stack only at the bin of each observed data point:
\begin{equation}\label{eq:cmp}
  S_{\text{CMP}}[k] \;=\; \sum_{i=1}^{N} \mathbf{1}\!\bigl[b(p_i)=k\bigr],
\end{equation}
where $\mathbf{1}[\cdot]$ is the indicator function. Bins with no observed point receive $S_{\text{CMP}}[k]=0$.

\begin{algorithm}[!t]
  \caption{CMP Construction}\label{alg:cmp}
  \begin{algorithmic}[1]
    \REQUIRE Price sequence $\{p_i\}_{i=1}^{N}$, bin size $\beta$
    \ENSURE  Profile array $S_{\text{CMP}}[\cdot]$
    \STATE Initialise $S_{\text{CMP}}[k]\leftarrow 0\;\;\forall\,k$
    \FOR{$i = 1$ \TO $N$}
      \STATE $k \leftarrow \lfloor p_i / \beta \rfloor$
      \STATE $S_{\text{CMP}}[k] \leftarrow S_{\text{CMP}}[k] + 1$
    \ENDFOR
    \RETURN $S_{\text{CMP}}$
  \end{algorithmic}
\end{algorithm}

\textbf{Complexity.} CMP performs exactly $N$ bin‑index computations and $N$ increments, giving $\mathcal{O}(N)$ time complexity.

\subsection{Gap‑Filled Market Profile (GMP)}\label{sec:gmp}

GMP augments CMP by filling every \emph{intermediate} bin between two consecutive observations. The construction proceeds in two phases:

\begin{enumerate}
  \item \textbf{CMP placement.} Each observation $p_i$ contributes one stack to its own bin $b(p_i)$, exactly as in CMP.
  \item \textbf{Gap‑filling.} For each consecutive pair $(p_{i-1},\,p_i)$ with $i\ge 2$, every bin \emph{strictly between} $b(p_{i-1})$ and $b(p_i)$ (exclusive of both endpoints) receives one additional stack.
\end{enumerate}

Formally, writing $b_i = b(p_i)$:
\begin{equation}\label{eq:gmp}
  S_{\text{GMP}}[k]
  \;=\;
  \underbrace{\sum_{i=1}^{N}\mathbf{1}\!\bigl[b_i=k\bigr]}_{S_{\text{CMP}}[k]}
  \;+\;
  \sum_{i=2}^{N}
  \;\sum_{j=\min(b_{i-1},\,b_i)+1}^{\max(b_{i-1},\,b_i)-1}
  \!\mathbf{1}\!\bigl[j=k\bigr].
\end{equation}

When $|b_i - b_{i-1}| \le 1$ (adjacent or same bin), the inner sum is empty and no gap‑filling occurs. When $|b_i - b_{i-1}| > 1$, the number of gap‑filled (intermediate) bins is
\begin{equation}\label{eq:Ki}
  G_i \;=\; \bigl|b(p_i) - b(p_{i-1})\bigr| - 1.
\end{equation}
The total span of bins traversed, inclusive of both endpoints, is $K_i = G_i + 2 = |b_i - b_{i-1}| + 1$.

\begin{algorithm}[!t]
  \caption{GMP Construction (Two‑Phase)}\label{alg:gmp}
  \begin{algorithmic}[1]
    \REQUIRE Price sequence $\{p_i\}_{i=1}^{N}$, bin size $\beta$
    \ENSURE  Profile array $S_{\text{GMP}}[\cdot]$
    \STATE Initialise $S_{\text{GMP}}[k]\leftarrow 0\;\;\forall\,k$
    \FOR{$i = 1$ \TO $N$} \COMMENT{Phase~1: CMP placement}
      \STATE $S_{\text{GMP}}[\lfloor p_i/\beta \rfloor] \leftarrow S_{\text{GMP}}[\lfloor p_i/\beta \rfloor] + 1$
    \ENDFOR
    \FOR{$i = 2$ \TO $N$} \COMMENT{Phase~2: gap‑fill}
      \STATE $k_{\text{from}} \leftarrow \lfloor p_{i-1}/\beta \rfloor$; $k_{\text{to}} \leftarrow \lfloor p_i/\beta \rfloor$
      \IF{$|k_{\text{to}} - k_{\text{from}}| > 1$}
        \STATE $d \leftarrow \text{sign}(k_{\text{to}} - k_{\text{from}})$
        \FOR{$k = k_{\text{from}} + d$ \TO $k_{\text{to}} - d$ \textbf{step} $d$}
          \STATE $S_{\text{GMP}}[k] \leftarrow S_{\text{GMP}}[k] + 1$
        \ENDFOR
      \ENDIF
    \ENDFOR
    \RETURN $S_{\text{GMP}}$
  \end{algorithmic}
\end{algorithm}

\textbf{Complexity.} Let $D=\sum_{i=2}^{N}|b(p_i)-b(p_{i-1})|$ denote the cumulative bin displacement. GMP performs $\mathcal{O}(N + D)$ operations. In the degenerate case where all observations share the same bin, $D=0$ and GMP reduces to CMP. In the worst case, $D=\mathcal{O}(N\cdot\Delta p_{\max}/\beta)$.

\subsection{GMP as a Universal Construction}\label{sec:universal}

The key contribution of GMP is its universality: the gap‑filling rule applies to \emph{any} ordered price sequence, regardless of the original data's temporal spacing, source, or aggregation level. This includes:
\begin{itemize}
  \item Raw tick data (millisecond‑resolution bid/ask records)
  \item Candlestick TOCHLV sequences (using close, high, low, or any representative price)
  \item Irregularly sampled price points
  \item Synthetic price paths or simulated data
\end{itemize}

The only requirement is that the sequence be ordered (by time, trade index, or any monotonic index). The construction makes no assumption about the mechanism that generated the prices; it purely interpolates bin traversals between consecutive observations.

\subsection{Up/Down‑Bin Footprint Profile}\label{sec:updown}

Building upon the gap‑filled structure of GMP, we introduce a directional classification layer termed the \emph{Up/Down‑Bin Footprint Profile}. For every consecutive pair $(p_{i-1},\,p_i)$, the trajectory is evaluated as upward or downward based on the price difference. The origin bin $b(p_{i-1})$ is assigned no directional credit for this move (it has already been evaluated by prior action). However, every subsequent bin along the traversed path up to and including the destination bin $b(p_i)$ increments its \emph{up‑bin} count $U[k]$ if $p_i > p_{i-1}$, or its \emph{down‑bin} count $D[k]$ if $p_i \le p_{i-1}$.

\begin{algorithm}[!t]
  \caption{Up/Down‑Bin Footprint Construction}\label{alg:updown}
  \begin{algorithmic}[1]
    \REQUIRE Price sequence $\{p_i\}_{i=1}^{N}$, bin size $\beta$
    \ENSURE  Profile arrays $U[\cdot], D[\cdot], \delta[\cdot]$
    \STATE Initialise $U[k]\leftarrow 0, D[k]\leftarrow 0\;\;\forall\,k$
    \FOR{$i = 2$ \TO $N$}
      \STATE $k_{\text{from}} \leftarrow \lfloor p_{i-1}/\beta \rfloor$; $k_{\text{to}} \leftarrow \lfloor p_i/\beta \rfloor$
      \IF{$k_{\text{from}} = k_{\text{to}}$}
        \IF{$p_i > p_{i-1}$}
          \STATE $U[k_{\text{from}}] \leftarrow U[k_{\text{from}}] + 1$
        \ELSE
          \STATE $D[k_{\text{from}}] \leftarrow D[k_{\text{from}}] + 1$
        \ENDIF
        \STATE \textbf{continue}
      \ENDIF
      \STATE $\text{is\_up} \leftarrow (k_{\text{to}} > k_{\text{from}})$
      \STATE $d \leftarrow \text{sign}(k_{\text{to}} - k_{\text{from}})$
      \STATE $k \leftarrow k_{\text{from}} + d$
      \WHILE{\textbf{true}}
        \IF{$\text{is\_up}$}
          \STATE $U[k] \leftarrow U[k] + 1$
        \ELSE
          \STATE $D[k] \leftarrow D[k] + 1$
        \ENDIF
        \IF{$k = k_{\text{to}}$}
          \STATE \textbf{break}
        \ENDIF
        \STATE $k \leftarrow k + d$
      \ENDWHILE
    \ENDFOR
    \FORALL{$k$}
      \STATE $\delta[k] \leftarrow U[k] - D[k]$
    \ENDFOR
    \RETURN $U,\,D,\,\delta$
  \end{algorithmic}
\end{algorithm}

This algorithm traces the same $\mathcal{O}(N+D)$ bins as the GMP phase, maintaining computational efficiency while providing deep structural insight into directional dominance across the price range.

% ══════════════════════════════════════════════════════════════════════════════
%  V.  PROFILE CONSTRUCTION WALKTHROUGH
% ══════════════════════════════════════════════════════════════════════════════
\section{Profile Construction Walkthrough}\label{sec:walkthrough}

We illustrate the construction on a ten‑point price sequence. Each observation is a triple $(\text{label}, x, y)$ where \textit{label} is an alphabetic identifier, $x$ is the index, and $y$ the price. \Cref{tab:datapoints} lists the data.

\begin{table}[!t]
  \centering
  \caption{Input Observations (10 Points)}
  \label{tab:datapoints}
  \begin{tabular}{@{}ccc@{}}
    \toprule
    \textbf{Label} & \textbf{Index \#} & \textbf{Price (USD)} \\
    \midrule
    A &  1 & 3000.914 \\
    B &  2 & 3003.837 \\
    C &  3 & 3002.432 \\
    D &  4 & 3009.892 \\
    E &  5 & 3007.698 \\
    F &  6 & 3009.176 \\
    G &  7 & 3003.381 \\
    H &  8 & 3004.283 \\
    I &  9 & 3003.512 \\
    J & 10 & 3003.012 \\
    \bottomrule
  \end{tabular}
\end{table}

\begin{figure}[!t]
  \centering
  \begin{tikzpicture}
    \begin{axis}[
      title={Price vs.\ Index},
      xlabel={Index},
      ylabel={Price (USD)},
      ymin=2999.5, ymax=3011,
      grid=both,
      width=\columnwidth,
      height=5cm,
      legend style={at={(0.5,-0.15)}, anchor=north, legend columns=-1}
    ]
    \addplot[
      only marks,
      mark=*,
      mark size=2pt,
      blue
    ] coordinates {
      (1,3000.914) (2,3003.837) (3,3002.432) (4,3009.892) (5,3007.698)
      (6,3009.176) (7,3003.381) (8,3004.283) (9,3003.512) (10,3003.012)
    };
    \legend{Observed price}
    \end{axis}
  \end{tikzpicture}
  \caption{Price vs.\ index for the 10‑point example.}
  \label{fig:price_scatter}
\end{figure}

\subsection{CMP Profile Table}\label{sec:cmp_table}

With $\beta=1$, the bin index is $b(p)=\lfloor p\rfloor$. CMP counts points per bin. \Cref{tab:cmp_profile} shows that bins 2, 6, 7, and 9 are empty—the gaps in the conventional profile.

\begin{table}[!t]
  \centering
  \caption{CMP Profile Table ($\beta=1$)}
  \label{tab:cmp_profile}
  \begin{tabular}{@{}ccccc@{}}
    \toprule
    \textbf{Bin} & \textbf{From} & \textbf{Until} & \textbf{Group} & \textbf{Stacks} \\
    \midrule
     1 & 3000 & 3001 & A      & 1 \\
     2 & 3001 & 3002 &        & 0 \\
     3 & 3002 & 3003 & C      & 1 \\
     4 & 3003 & 3004 & BGIJ   & 4 \\
     5 & 3004 & 3005 & H      & 1 \\
     6 & 3005 & 3006 &        & 0 \\
     7 & 3006 & 3007 &        & 0 \\
     8 & 3007 & 3008 & E      & 1 \\
     9 & 3008 & 3009 &        & 0 \\
    10 & 3009 & 3010 & DF     & 2 \\
    \midrule
    \multicolumn{4}{c}{\textbf{Total stacks}} & \textbf{10} \\
    \bottomrule
  \end{tabular}
\end{table}

\begin{figure}[!t]
  \centering
  \begin{tikzpicture}
    \begin{axis}[
      title={CMP Profile},
      xbar,
      xlabel={Stacks},
      ylabel={Price (USD)},
      ytick={3000,3001,...,3009},
      yticklabel style={font=\scriptsize},
      xmin=0, xmax=5,
      ymin=2999.5, ymax=3010,
      bar width=4pt,
      width=\columnwidth,
      height=5cm,
      enlarge y limits=0.05,
      nodes near coords,
      nodes near coords style={font=\tiny}
    ]
    \addplot[fill=orange!50, draw=black] coordinates {
      (1,3000) (0,3001) (1,3002) (4,3003) (1,3004)
      (0,3005) (0,3006) (1,3007) (0,3008) (2,3009)
    };
    \end{axis}
  \end{tikzpicture}
  \caption{CMP profile for the 10‑point example ($\beta=1$). Four bins are empty.}
  \label{fig:cmp_chart}
\end{figure}

\subsection{GMP Profile Table}\label{sec:gmp_table}

GMP fills intermediate bins between consecutive points. \Cref{tab:gmp_profile} shows every bin now populated, with total stack count 25.

\begin{table}[!t]
  \centering
  \caption{GMP Profile Table ($\beta=1$)}
  \label{tab:gmp_profile}
  \begin{tabular}{@{}ccccc@{}}
    \toprule
    \textbf{Bin} & \textbf{From} & \textbf{Until} & \textbf{Group} & \textbf{Stacks} \\
    \midrule
     1 & 3000 & 3001 & A      & 1 \\
     2 & 3001 & 3002 & A      & 1 \\
     3 & 3002 & 3003 & AC     & 2 \\
     4 & 3003 & 3004 & BCGIJ  & 5 \\
     5 & 3004 & 3005 & CFH    & 3 \\
     6 & 3005 & 3006 & CF     & 2 \\
     7 & 3006 & 3007 & CF     & 2 \\
     8 & 3007 & 3008 & CEF    & 3 \\
     9 & 3008 & 3009 & CDEF   & 4 \\
    10 & 3009 & 3010 & DF     & 2 \\
    \midrule
    \multicolumn{4}{c}{\textbf{Total stacks}} & \textbf{25} \\
    \bottomrule
  \end{tabular}
\end{table}

\begin{figure}[!t]
  \centering
  \begin{tikzpicture}
    \begin{axis}[
      title={GMP Profile},
      xbar,
      xlabel={Stacks},
      ylabel={Price (USD)},
      ytick={3000,3001,...,3009},
      yticklabel style={font=\scriptsize},
      xmin=0, xmax=6,
      ymin=2999.5, ymax=3010,
      bar width=4pt,
      width=\columnwidth,
      height=5cm,
      enlarge y limits=0.05,
      nodes near coords,
      nodes near coords style={font=\tiny}
    ]
    \addplot[fill=green!40, draw=black] coordinates {
      (1,3000) (1,3001) (2,3002) (5,3003) (3,3004)
      (2,3005) (2,3006) (3,3007) (4,3008) (2,3009)
    };
    \end{axis}
  \end{tikzpicture}
  \caption{GMP profile for the 10‑point example ($\beta=1$). Every bin is populated.}
  \label{fig:gmp_chart}
\end{figure}

\subsection{CMP vs.\ GMP Side‑by‑Side}\label{sec:cmp_gmp_compare}

\Cref{fig:cmp_vs_gmp_10pt} places both profiles side by side. CMP (10 stacks) leaves 40\% of bins empty; GMP (25 stacks) fully covers the range.

\begin{figure}[!t]
  \centering
  \begin{tikzpicture}
    \begin{axis}[
      title={CMP},
      xbar,
      xlabel={Stacks},
      ylabel={Price (USD)},
      ytick={3000,3001,...,3009},
      yticklabel style={font=\scriptsize},
      xmin=0, xmax=6,
      ymin=2999.5, ymax=3010,
      bar width=4pt,
      width=0.42\columnwidth,
      height=6cm,
      enlarge y limits=0.05,
      name=cmp_10
    ]
    \addplot[fill=orange!50, draw=black] coordinates {
      (1,3000) (0,3001) (1,3002) (4,3003) (1,3004)
      (0,3005) (0,3006) (1,3007) (0,3008) (2,3009)
    };
    \end{axis}
    \begin{axis}[
      title={GMP},
      xbar,
      xlabel={Stacks},
      ylabel={},
      ytick={3000,3001,...,3009},
      yticklabel style={font=\scriptsize},
      xmin=0, xmax=6,
      ymin=2999.5, ymax=3010,
      bar width=4pt,
      width=0.42\columnwidth,
      height=6cm,
      enlarge y limits=0.05,
      at={(cmp_10.east)},
      anchor=west,
      xshift=0.8cm
    ]
    \addplot[fill=green!40, draw=black] coordinates {
      (1,3000) (1,3001) (2,3002) (5,3003) (3,3004)
      (2,3005) (2,3006) (3,3007) (4,3008) (2,3009)
    };
    \end{axis}
  \end{tikzpicture}
  \caption{CMP vs.\ GMP side‑by‑side.}
  \label{fig:cmp_vs_gmp_10pt}
\end{figure}

\Cref{fig:combined_3panel} presents the entire construction pipeline—raw data, CMP, GMP—in a single three‑panel TikZ graphic, ensuring full reproducibility.

\begin{figure*}[!t]
  \centering
  \begin{tikzpicture}
    % Panel 1: raw data scatter
    \begin{axis}[
      title={Raw Data},
      xlabel={Index},
      ylabel={Price (USD)},
      ymin=2999.5, ymax=3011,
      width=0.30\textwidth,
      height=6cm,
      name=raw
    ]
    \addplot[only marks, mark=*, mark size=2pt, blue] coordinates {
      (1,3000.914) (2,3003.837) (3,3002.432) (4,3009.892) (5,3007.698)
      (6,3009.176) (7,3003.381) (8,3004.283) (9,3003.512) (10,3003.012)
    };
    \end{axis}
    % Panel 2: CMP profile
    \begin{axis}[
      title={CMP Profile},
      xbar,
      xlabel={Stacks},
      ylabel={},
      ytick={3000,3001,...,3009},
      yticklabel style={font=\scriptsize},
      xmin=0, xmax=5,
      ymin=2999.5, ymax=3010,
      bar width=4pt,
      width=0.30\textwidth,
      height=6cm,
      enlarge y limits=0.05,
      at={(raw.east)},
      anchor=west,
      xshift=1.2cm
    ]
    \addplot[fill=orange!50, draw=black] coordinates {
      (1,3000) (0,3001) (1,3002) (4,3003) (1,3004)
      (0,3005) (0,3006) (1,3007) (0,3008) (2,3009)
    };
    \end{axis}
    % Panel 3: GMP profile
    \begin{axis}[
      title={GMP Profile},
      xbar,
      xlabel={Stacks},
      ylabel={},
      ytick={3000,3001,...,3009},
      yticklabel style={font=\scriptsize},
      xmin=0, xmax=6,
      ymin=2999.5, ymax=3010,
      bar width=4pt,
      width=0.30\textwidth,
      height=6cm,
      enlarge y limits=0.05,
      at={(raw.east)},
      anchor=west,
      xshift=6cm
    ]
    \addplot[fill=green!40, draw=black] coordinates {
      (1,3000) (1,3001) (2,3002) (5,3003) (3,3004)
      (2,3005) (2,3006) (3,3007) (4,3008) (2,3009)
    };
    \end{axis}
  \end{tikzpicture}
  \caption{Three‑panel overview: raw data (left), CMP (centre), and GMP (right). Gap‑filling produces a continuous profile without empty bins.}
  \label{fig:combined_3panel}
\end{figure*}

\subsection{Up/Down‑Bin Footprint Table}\label{sec:updown_table}

Applying \Cref{alg:updown} yields the directional footprint in \Cref{tab:updown_table}. For instance, the move from A to B adds up‑bins at bins~2--4; the move from C to D adds up‑bins at bins~4--10.

\begin{table}[!t]
  \centering
  \caption{Up/Down‑Bin Footprint Table ($\beta=1$)}
  \label{tab:updown_table}
  \begin{tabular}{@{}cccccrr@{}}
    \toprule
    \textbf{Bin} & \textbf{From} & \textbf{Until} & \textbf{Group} & \textbf{Down} & \textbf{Up} & \textbf{Delta} \\
    \midrule
     1 & 3000 & 3001 & A      & 0 & 0 &  0 \\
     2 & 3001 & 3002 & A      & 0 & 1 & +1 \\
     3 & 3002 & 3003 & AC     & 1 & 1 &  0 \\
     4 & 3003 & 3004 & BCGIJ  & 3 & 2 & -1 \\
     5 & 3004 & 3005 & CFH    & 1 & 2 & +1 \\
     6 & 3005 & 3006 & CF     & 1 & 1 &  0 \\
     7 & 3006 & 3007 & CF     & 1 & 1 &  0 \\
     8 & 3007 & 3008 & CEF    & 2 & 1 & -1 \\
     9 & 3008 & 3009 & CDEF   & 2 & 2 &  0 \\
    10 & 3009 & 3010 & DF     & 0 & 2 & +2 \\
    \bottomrule
  \end{tabular}
\end{table}

\begin{figure}[!t]
  \centering
  \begin{tikzpicture}
    \begin{axis}[
      title={Up/Down‑Bin Footprint},
      xbar,
      xlabel={Count (Down / Up)},
      ylabel={Price (USD)},
      ytick={3000,3001,...,3009},
      yticklabel style={font=\scriptsize},
      xmin=-3.5, xmax=3.5,
      ymin=2999.5, ymax=3010,
      bar width=4pt,
      width=\columnwidth,
      height=5cm,
      enlarge y limits=0.05,
      legend style={at={(0.5,-0.15)}, anchor=north, legend columns=2}
    ]
    \addplot[fill=red!60, draw=black] coordinates {
      (0,3000) (0,3001) (-1,3002) (-3,3003) (-1,3004)
      (-1,3005) (-1,3006) (-2,3007) (-2,3008) (0,3009)
    };
    \addplot[fill=teal!60, draw=black] coordinates {
      (0,3000) (1,3001) (1,3002) (2,3003) (2,3004)
      (1,3005) (1,3006) (1,3007) (2,3008) (2,3009)
    };
    \legend{Down bins, Up bins}
    \end{axis}
  \end{tikzpicture}
  \caption{Directional footprint: down‑bins (red) and up‑bins (teal).}
  \label{fig:updown_footprint}
\end{figure}

% ══════════════════════════════════════════════════════════════════════════════
%  VI.  BIN‑SIZE ANALYSIS
% ══════════════════════════════════════════════════════════════════════════════
\section{Effect of Bin Size on Profile Resolution}\label{sec:binsize}

The bin‑size parameter $\beta$ controls granularity. For a single displacement $\Delta p = |p_i - p_{i-1}|$, the number of traversed bins is
\begin{equation}\label{eq:bins_beta}
  K_i(\beta) \;=\;
  \left|\left\lfloor \frac{p_i}{\beta} \right\rfloor
  - \left\lfloor \frac{p_{i-1}}{\beta} \right\rfloor\right|
  + 1.
\end{equation}
Halving $\beta$ roughly doubles $K_i$.

\begin{proposition}[Bin‑count scaling]\label{prop:scaling}
  For fixed $\Delta p$ and $\beta_1 > \beta_2 > 0$,
  \begin{equation}\label{eq:scaling}
    K_i(\beta_2) \;\ge\;
    \left\lfloor \frac{\beta_1}{\beta_2} \right\rfloor
    \cdot \bigl(K_i(\beta_1) - 1\bigr) + 1.
  \end{equation}
\end{proposition}

\begin{proof}
  Write $\Delta p = (K_i(\beta_1)-1)\,\beta_1 + r_1$, $0 \le r_1 < \beta_1$. Then
  $K_i(\beta_2) = \lfloor \Delta p/\beta_2 \rfloor + 1
  \ge \lfloor (K_i(\beta_1)-1)\,\beta_1/\beta_2 \rfloor + 1
  \ge \lfloor \beta_1/\beta_2 \rfloor\,(K_i(\beta_1)-1) + 1$.
\end{proof}

\Cref{tab:binsize} quantifies this for $\Delta p = 10$.

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

Key observations:
\begin{itemize}
  \item \textbf{CMP is invariant:} always 2 bins, regardless of $\beta$.
  \item \textbf{GMP scales as $\mathcal{O}(\Delta p/\beta)$:} resolution improves inversely with $\beta$. The lower bound is the minimum meaningful price increment.
\end{itemize}

% ══════════════════════════════════════════════════════════════════════════════
%  VII.  ILLUSTRATIVE EXAMPLE
% ══════════════════════════════════════════════════════════════════════════════
\section{Illustrative Example}\label{sec:example}

Two observations: $p_1 = 3000$, $p_2 = 3010$, $\beta=1$. \Cref{tab:cmp_vs_gmp} shows CMP (2 stacks) vs.\ GMP (11 stacks). \Cref{fig:profile} plots both.

\begin{table}[!t]
  \centering
  \caption{CMP vs.\ GMP ($\beta=1$)}
  \label{tab:cmp_vs_gmp}
  \begin{tabular}{@{}cccc@{}}
    \toprule
    Observation \# & Price & CMP stacks & GMP stacks \\
    \midrule
    1 & 3000 & 1 & 1 \\
    0 & 3001 & 0 & 1 \\
    0 & 3002 & 0 & 1 \\
    0 & 3003 & 0 & 1 \\
    0 & 3004 & 0 & 1 \\
    0 & 3005 & 0 & 1 \\
    0 & 3006 & 0 & 1 \\
    0 & 3007 & 0 & 1 \\
    0 & 3008 & 0 & 1 \\
    0 & 3009 & 0 & 1 \\
    2 & 3010 & 1 & 1 \\
    \midrule
    \multicolumn{2}{c}{\textbf{Total stacks}} & \textbf{2} & \textbf{11} \\
    \bottomrule
  \end{tabular}
\end{table}

% ══════════════════════════════════════════════════════════════════════════════
%  VIII.  DISCUSSION
% ══════════════════════════════════════════════════════════════════════════════
\section{Discussion}\label{sec:discussion}

\subsection{Advantages}
\begin{enumerate}
  \item \textbf{No profile gaps.} All traversed price levels are represented, avoiding sparse CMP histograms.
  \item \textbf{Volume‑neutral interpolation.} Interpolated stacks mark traversal, not fabricated volume.
  \item \textbf{Directional context.} The footprint reveals net pressure without external order‑flow data.
  \item \textbf{Tunable resolution.} $\beta$ adjusts granularity independently of data frequency.
  \item \textbf{Universality.} GMP applies to any ordered price sequence.
\end{enumerate}

\subsection{Limitations}
\begin{enumerate}
  \item \textbf{Interpolation assumption.} Assumes continuous traversal; genuine price gaps may be over‑represented.
  \item \textbf{Computational cost.} $\mathcal{O}(N+D)$ may be high for large cumulative displacement.
  \item \textbf{Not a volume profile.} GMP is a pure price‑traversal profile; combining with volume is future work.
\end{enumerate}

\subsection{Choosing $\beta$}
\begin{itemize}
  \item Set $\beta$ near the minimum price increment for maximum resolution.
  \item Enlarge $\beta$ to reduce noise or align with psychological levels.
  \item The resolution advantage of GMP over CMP grows as $\beta$ decreases.
\end{itemize}

% ══════════════════════════════════════════════════════════════════════════════
%  IX.  CONCLUSION
% ══════════════════════════════════════════════════════════════════════════════
\section{Conclusion}\label{sec:conclusion}

We have presented \textbf{GMP (Gap‑Filled Market Profile)}, a universal construction that interpolates all intermediate price bins between consecutive observations. We formalised CMP and GMP, provided algorithms with complexity analysis, and derived the inverse relationship between bin size $\beta$ and profile resolution. The detailed 10‑point illustration and accompanying charts demonstrate that GMP yields a strictly denser and more informative profile, closing the gaps inherent in conventional methods. Future work may explore weighted interpolation and application across asset classes.

% ══════════════════════════════════════════════════════════════════════════════
%  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}