Complete, working Indicators you can copy, run, and adapt: the kScript (legacy) cookbook's recipes, each shown as the kScript you know beside the Indicator it became, from a volume-spike detector to a four-venue cumulative volume delta.
Every recipe page is a full Indicator, not a snippet. Paste one into a New indicator tab under the language marker, press Run, and it works. Then read "How it works" for the moving parts, "What changed in the port" for the places where an Indicator is shaped differently from a kScript, and "Customize it" for the variations worth trying. Each recipe ends with the concept pages behind it, so you can go deeper wherever something catches your eye.
The recipes are in the kScript cookbook's order, easy to advanced. The first one is the cleanest introduction to the loop: load a series, compute a number, draw it. By the last one you are holding state across bars and drawing shapes that switch themselves off. Two of the kScript recipes lean on constructs an Indicator cannot express yet; their pages say what the nearest form is and what stays on the kScript engine.
Recipes
| Recipe | What it does | What it teaches |
|---|---|---|
| Volume spike detector | Flags bars whose volume blows past its trailing average, scored as a z-score | one input, a TA class, a gated mark |
| Anchored VWAP | Weekly and daily VWAP that reset on UTC session boundaries, with a shaded band and a stretch readout | the time source, state that resets, a box as a channel |
| Regime filter | A no-repaint 4h trend gate that tints a line by regime and marks entries only when the higher timeframe agrees | higher timeframes without lookahead, color_by, shape_where |
| Key levels | Prior-day and prior-week highs and lows plus the day open, as horizontal levels on any interval | segments as levels, a param as a gate |
| Aggregated CVD | Aggressive buying minus selling, accumulated, with volatility bands, sign coloring, and a four-venue variant | the trades source, accumulators, missing policies, venue pins |
| Zone tracker | Supply and demand zones drawn as boxes that switch off when price mitigates them | boxes with a when gate, ring-buffer windows |
| HUD terminal | A terminal-style readout the package draws itself: a title bar, a body box, and four left-aligned rows refreshed on the live bar | anchored box and label handles, the align word, bar.isLast(), one text slot for many labels |
| Market decision dashboard | A six-row decision table beside the chart, each factor with a reading and a colour-coded state refreshed on the live bar, with an EMA line on price and a bullish count as a metric | a frame feeding a side panel.table, rows built as one string, a count as a data-only output |
| Multi-timeframe terminal | The chart's own trend on the price pane, a side window of the 4h context, and the last 4h swing levels docked on the price axis | inputs pinned to 4h, a side panel.line on its own time axis, plot.levels docked on the price axis |
| Viewport-anchored market HUD | A regime readout pinned to the pane's top-left corner from the chart's own candles, plus an RSI meter at the top-right | anchored handles from indicator numbers alone, draw.meter over a data-only fraction, a regime line coloured by state |
| Large prints | The live trade tape filtered by size: a signed delta and a print count per bar, the live bar's biggest prints boxed at their price, the window's biggest listed in a feed | the tape celled input, box handles moved and deleted by id, a frame feeding draw.feed |
| Plots and panes | Two averages on price, cumulative volume delta and the bar's delta together in the lower pane, and two histogram windows placed below the chart | outputs naming their pane, area and histogram plots, panel.histogram windows fed by frames |
| A series with an address | A package that reads a series your own daemon published, plots it in the lower pane and keeps the latest reading in a status card | a series input by address, a metadata-first sheet, a card with value, average and clock rows |
| Live tape reader | Signed flow and counts from live prints above a size threshold | four-value tape tuples; historical USD size buckets remain unavailable |
| Historical returns matrix | Month-by-year returns as a grid | stays on kScript (legacy); the page names the nearest form |
How to use a recipe
- Open Indicators, then Build, then New indicator. Keep the
//@lang=wrun-tsline and replace everything under it with the recipe's Indicator block. - Run it on a liquid symbol. The order-flow recipe wants a major pair where the venue reports buy and sell volume.
- Open the overlay's settings. Every tunable value is a
param(...), so lookbacks and thresholds change without touching code. - Read the notes. Colors are declared on the outputs, boxes, and segments; edit the hex strings and Run again.
The same file runs on your machine. Scaffold a workspace, replace src/indicator.ts with the recipe (the CLI does not need the //@lang=wrun-ts line), then build, install, and read a value:
om wrun create @you/volume-spike ./volume-spike --template sma-codefirst
om wrun build ./volume-spike
om wrun install ./volume-spike --replace
om metric series --metric wrun/@you/volume-spike/z --symbol BTCUSDT --exchange BINANCE_FUTURES --bars 60Every input on the chart reads the chart's own market and interval (Execution model). The one recipe that pins other venues says so, and that variant is for your machine, where symbol and exchange pins are honored.
What the recipes share
A few shapes come back in every recipe, and they are the shapes most kScript ports need:
- State lives in module-level variables. A kScript
persistis a module-levellet; a kScripttimeseriesyou index into is aStaticArray<f64>ring buffer;reset()puts every one of them back. - Decisions are numbers. A condition the chart should act on is a data-only
noneoutput written as1or0; the sheet turns it into a look throughshape_where,color_by, or a box'swhengate. - Calendar math comes from the
timesource.time.bar_open_secis each bar's open in epoch seconds; dividing by 86400 gives the UTC day, and a boundary in that index is where sessions reset. - Every output is a metric. Once the package is on your machine, each output is an id a watch, a screen, or a series read can use, so a recipe's gate becomes an alert with one
om watch createon the metric.
The port table that maps each kScript construct to its Indicator form is in From kScript; the recipes are that table applied to whole scripts.