Introduction
TapeScript is a scripting language for the tick heatmap in the Tape Delta desktop app. Scripts react to trades, book changes and single orders, draw on the heatmap and play alerts.
TapeScript is a scripting language for the tick heatmap. A script runs on every trade, every order-book change and every move of the best bid and ask. On market-by-order venues it also sees every single order: placed, changed, filled or pulled, and iceberg refills. It can start from stored history, draw lines, markers, shaded zones and price levels on the heatmap, plot a pane under it, and play sound or voice alerts.

The TapeScript widget next to a tick heatmap.
TapeScript and Delta DSL
| Delta DSL Script | TapeScript | |
|---|---|---|
| Chart | Candle chart | Tick heatmap |
| Input | OHLCV of the visible bars | Trades, order-book levels, best bid/ask, single orders, a timer |
| Runs | On each redraw | On each market event |
| Stored | In your account | As .tape files on your computer |
| Available in | Web and desktop | Desktop app |
Script structure
A script has two parts:
- Top-level code. Runs once when the script starts. Declare state here: counters, rolling windows, lines to draw.
- Callbacks. Functions with reserved names that TapeScript calls on market events:
onTrade,onDepth,onBbo,onInterval, and on market-by-order venuesonOrderandonIceberg.
Inside a callback you update state, add points to lines, place markers, shade zones and fire alerts. With // @history the script first runs over the stored data of a recent period.
If a script has an error, it stops and the Console shows the message and the line number. Other scripts and the chart keep running.
Example
// @name Big Prints
// @input mult: float = 6 "Size vs average (x)"
const avg = rolling(200)
function onTrade(price, size, side, time) {
const ready = avg.full
const mean = avg.mean
avg.add(size)
if (ready && size >= mean * input.mult) {
marker(time, price, round(size), side === SELL ? "#F6465D" : "#0ECB81")
}
}
The script keeps the size of the last 200 trades. A trade at least mult times the average gets a marker: red for a sell aggressor, green for a buy aggressor. mult can be changed in the Inputs tab.