Quant Memo
Core

One-Dimensional Convolutions for Price Series

A 1D convolution slides a small, learned pattern-detector along a price series, producing a new series that lights up wherever that pattern appears — the same trick that finds edges in images, applied along time instead of space.

Prerequisites: Convolutional Neural Networks, Recurrent Neural Networks

A trader scanning a chart for a specific shape — a sharp reversal, a breakout, a fading momentum burst — doesn't look at the whole year at once; they scan a short window, slide it along, and note wherever the shape appears. A 1D convolution automates exactly this scan. Instead of feeding an entire price history into a network as one flat vector (which throws away the fact that "nearby in time" means something), it learns a small pattern template and mechanically slides it across the series, checking at every position how well the local window matches the pattern.

The analogy: a stencil dragged along a strip of paper

Picture a small cardboard stencil with a shape cut into it — say, three notches for "down, down, up." Drag it along a strip of numbers, and at each position measure how well the numbers under the stencil match the shape. Slide one step, measure again, repeat. The result is a new strip — one number per position — that spikes wherever the pattern occurred and stays flat elsewhere. A 1D convolution is that stencil, except the shape (the kernel's weights) is learned from data, and a network typically learns many stencils (channels) in parallel, each hunting for a different local shape.

The mechanics: a sliding, weighted dot product

A 1D convolution with kernel size kk and weights w1,,wkw_1, \dots, w_k slides along an input series x1,,xTx_1, \dots, x_T, and at each position tt computes:

yt=i=1kwixt+i1+by_t = \sum_{i=1}^{k} w_i\, x_{t+i-1} + b

In words: take the kk consecutive values starting at position tt, multiply each by its learned weight, add them up with a learned bias, and that sum becomes one entry of the output series. Slide one step forward, repeat, and you get an output series yy — one value per position — where large values indicate the window strongly matched whatever pattern the weights have learned. A layer typically learns many kernels at once, producing a stack of output series — one "channel" per learned pattern.

Worked example 1: a 3-tap kernel by hand

Take the 5-day return series x=(0.5,0.3,0.2,0.8,0.6)x = (0.5, -0.3, 0.2, -0.8, 0.6) (percent), and a learned 3-tap kernel w=(1,1,1)w = (1, -1, 1) with bias b=0b=0, designed to fire on alternating up-down-up or down-up-down patterns. Sliding it across gives 3 output values:

y1=(1)(0.5)+(1)(0.3)+(1)(0.2)=0.5+0.3+0.2=1.0y_1 = (1)(0.5) + (-1)(-0.3) + (1)(0.2) = 0.5+0.3+0.2 = 1.0 y2=(1)(0.3)+(1)(0.2)+(1)(0.8)=0.30.20.8=1.3y_2 = (1)(-0.3) + (-1)(0.2) + (1)(-0.8) = -0.3-0.2-0.8 = -1.3 y3=(1)(0.2)+(1)(0.8)+(1)(0.6)=0.2+0.8+0.6=1.6y_3 = (1)(0.2) + (-1)(-0.8) + (1)(0.6) = 0.2+0.8+0.6 = 1.6

The output (1.0,1.3,1.6)(1.0, -1.3, 1.6) is 3 numbers long — a length-5 input with a size-3 kernel produces 53+1=35-3+1=3 outputs. The largest value, y3=1.6y_3=1.6, marks where the window's contents lined up most strongly with the kernel's alternating weights.

Worked example 2: multiple channels finding different patterns

Add a second kernel, w=(1,1,1)w' = (1,1,1), bias 00 — it just sums the window, firing large whenever three consecutive returns are all positive and sizable. On the same window as y3y_3 above, (0.2,0.8,0.6)(0.2, -0.8, 0.6): y3=0.20.8+0.6=0y_3' = 0.2 - 0.8 + 0.6 = 0, near zero, since this window is mixed in sign, not a clean uptrend — exactly what the "sum" kernel should report low on, even though the "alternating" kernel scored it highest. Running both kernels over the series gives two output channels, each tuned to a different shape, that a deeper layer can combine.

input series channel A: alternating kernel channel B: sum kernel fires on reversals fires on sustained uptrends
The same input series run through two different learned kernels produces two output channels, each tuned to a different local shape.
Input series (5 values) 0.5 -0.3 0.2 -0.8 0.6 window 1 → y₁=1.0 window 2 → y₂=-1.3 window 3 → y₃=1.6
The size-3 kernel slides across the 5-value input one step at a time, producing one output per position — three windows, three outputs.

A 1D convolution slides a small, learned weight pattern along a time series, computing a weighted local sum at every position — the resulting output series lights up wherever the local window resembles the learned pattern, and stacking multiple kernels lets a network hunt for many different local shapes in parallel.

What this means in practice

1D convolutions are cheap, parallelizable (every output position can be computed independently, unlike a recurrent network), and naturally translation-invariant — a pattern is detected the same way whether it occurs on day 10 or day 200, often the right assumption for recurring chart patterns. Their weakness is a limited receptive field per layer: a single layer with a small kernel genuinely cannot see far back, which is why real architectures stack many layers, often with dilation, to build a usefully long view of history.

Practice

  1. For input x=(1,1,1,1,1)x=(1, -1, 1, -1, 1) and kernel w=(1,1,1)w=(1,1,1), b=0b=0, compute the full output series by hand.
  2. How many output values does a length-20 input series produce with a kernel size of 4 (no padding)?
  3. Explain in one sentence why 1D convolutions can be computed in parallel across all time positions, while a recurrent network cannot.

The common confusion is assuming a convolution "looks at the whole series" the way a human scanning a chart intuitively does. A single 1D convolution layer only ever sees a window as wide as its kernel — everything else about "context" comes from stacking layers (or adding dilation) to grow the receptive field indirectly. Judging a shallow, single-layer convolutional model by whether it "should" notice a slow, multi-month trend is a category error: it structurally cannot, no matter how much data it's trained on, until the network is deep or dilated enough for its receptive field to actually span that trend.

Related concepts

Practice in interviews

Further reading

  • Bai, Kolter & Koltun, An Empirical Evaluation of Generic Convolutional and Recurrent Networks for Sequence Modeling (2018)
ShareTwitterLinkedIn