Cookbook
Complete, working wrun indicators you can copy, run, and adapt, in six groups: what to draw on price, how to read order flow, prediction-market odds read against the markets they move with, HUD cards that read a market at a glance, views beyond the time axis (profiles, volatility curves and surfaces, fund flows, the order book, cross-market maps, calendars, the yield curve), and strategies that trade. Seventy-nine of them are also the templates the chart's New indicator starter list offers, one card each, under the same group names; the other six are shorter recipes that build up the loop one idea at a time, each with the indicator in full and the reasoning behind it.
Every recipe page is a full indicator, not a snippet. Pick its card in the editor's starter list, or paste it into a blank indicator tab under the language marker, press Run, and it works. Then read "How it works" for the moving parts, "Where it runs" and "When data is missing" for the markets it serves and what it says on the ones it does not, 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.
Inside a group the shorter recipes come first, easy to advanced, then the picker's templates in the picker's order. The first one is the cleanest introduction to the loop: load a series, compute a number, draw it.
- On price: marks, zones and tints drawn on the chart's own bars.
- Order flow: buyers and sellers, open interest, liquidations and options flow, bar by bar.
- Prediction markets: a Polymarket market's odds against the market they move with.
- HUDs: one reading of the whole market, kept beside the candles.
- Beyond the time axis: profiles, curves, chains and fund flows on a second axis.
- Strategies: packages that trade, replayed by the Strategy Tester.
On price
Marks, zones and tints drawn on the candles themselves, from the chart's own bars.
| 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 |
| Typed inputs tour | Every kind of setting but text on one small channel indicator, with two pages, presets, a hover card, a HUD card and legend entries | fourteen of the fifteen setting kinds, the layout words and the "@name" bindings, the block kit |
| Anchored VWAP | Weekly and daily VWAP that reset on UTC session boundaries, with a shaded band and a stretch readout | bar.time(), 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 |
| Zone tracker | Supply and demand zones drawn as boxes that switch off when price mitigates them | boxes with a when gate, ring-buffer windows |
| Session map | Asia, London and New York each boxed around the session's high and low with a tag, the live session growing bar by bar | box and label handles keyed by the UTC clock, a ring of ids reused by day, one text slot for many tags |
| Volume heat hours | Every clock hour boxed over its range and tinted by its volume against the last day's average hour, hot hours tagged with their multiple | folding hours from the chart's own bars, a rolling baseline, opacity as the reading |
| Supply and demand zones | A zone at every confirmed swing, extended right until a close breaks it, with breakout marks and the nearest zone on each side tagged with its price | PivotHigh and PivotLow, zones as box handles that stop extending, right-anchored price tags |
| Trend alignment | The chart's EMA beside the 1h and 4h EMAs as steps, the background tinted while all three agree, a three-cell strip reading the state | closed 1h and 4h candles streams, render.bgcolor gated by a data-only output, an anchored strip |
| Trend candles | The chart's own candles tinted by where the close sits against two averages, a dot on each flip, a counter of how long the state has held | render.barcolor, shape outputs for events, a counter in an anchored label |
| Strike matrix | The live options chain by strike across the four nearest expiries, net gamma exposure or another lens (delta, vega, vanna, charm, open interest), docked on the price axis with the ATM row outlined, the per-strike bars beside the board, and the largest GEX strike, the gamma flip, max pain and the put wall drawn across the chart as labelled levels | options_ on the live bar, a plot.matrix and a plot.levels docked on one side and kept apart by an offset, draw.line levels with plain label handles, the kit's GammaCurve for the flip and OptionsChain for the walls and max pain |
| Session OI levels | Where open interest was built and unwound in each day, drawn as one profile per day, each anchored inside its own span of time | plot.levels with span: "time", a spans frame, a colour per row |
Order flow
Who traded, who is positioned and who was forced out, from sided trades, open interest and liquidations, and where the options money went, from the US listed options flow of a stock's own options.
| Recipe | What it does | What it teaches |
|---|---|---|
| Aggregated CVD | Aggressive buying minus selling on the chart's market, accumulated, with volatility bands and sign coloring | the trades source, accumulators, missing policies, which inputs the chart pins to another market |
| CVD divergence | Cumulative volume delta in its own pane, price swings dotted on it, and the evidence drawn when price and CVD disagree at two swings | side-split trades.volume, a displaced shape output, line and polyline handles across two panes |
| Positioning regimes | Each bar's open-interest change in coins colored by who moved, a key card with each regime's share, a dot where the leading regime changed hands | oi.close reading NaN, one histogram output per regime, draw.card with text slots |
| Absorption | Bars where heavy one-sided volume failed to move price, lit in the delta pane, boxed on the chart and dotted on the absorbed side | a ratio against a rolling norm, two histograms sharing a pane, sign palettes, a plot.spans box a bar |
| Liquidation bursts | Long and short liquidations in USD stacked in one column per bar in their own pane, a burst marked on price by a bubble sized and captioned by its USD size | the liquidations source by side, a z-score gate, a plot.marks bubble with a size law bound to a setting |
| Book heat | The order book painted as a heatmap behind the candles, resting size per level, the scale read off the run | book.cells, plot.heatmap over cells on the chart's one-ink ramp, a quantile scale |
| Liquidation heat | Estimated liquidation levels as a grid of 64 rows around the close, hot rows lit, rewritten every bar | out.grid, plot.heatmap over a grid on the chart's one-ink ramp, with a floor |
| OI liquidation heat | The Liquidation Map's estimate drawn through time: positions opened from open interest, folded every bar onto a grid of 128 rows around the close and swept where price trades through | oi.close and side-split trades.volume read as positions, out.grid and plot.heatmap with a dollar tooltip, data-only outputs for alerts |
| Volume footprint | One footprint column per bar from the profile buckets, imbalances marked and stacked, the point of control per column | volume_, plot.footprint, imbalance words |
| TPO letters | Thirty-minute letters per day on the chart's own candles, the initial balance bracketed, single prints lit | plot.tpo, the letter interval rule, initial_balance |
| Session volume profile | A volume profile per session from the profile buckets, the value area shaded, each session boxed | plot.profile with span: "session", value_, background |
| Option prints | The underlying's option prints on its chain (a US stock's on OPRA, a CME future's, a coin's on its venue), filtered by premium, calls or puts, the side of the quote, days to expiry and moneyness, newest first in a table whose rows name their contracts, each print a mark on price | option_ holding the window's newest prints and each bar's largest (newest beside overflow: "largest"), options_flow of scope prints for the per-bar sums, the present mask, a panel.table with markets written by fb_contract, plot.marks |
| Flow tape | The underlying's option prints merged into orders (sweeps across venues, splits on one venue, blocks in one print, inferred) and tagged opening, volume over open interest and unusual against the chain summary, newest first | prints merged by contract, side and a time window, option_ on the live bar, tags as styled table cells |
| Flow marks | The underlying's large option prints as marks on price, the up colour bullish and the down colour bearish, sized by premium, over a column of each bar's bullish minus bearish premium | option_ cut to each bar's 24 largest at the floor and types settings with history: "90d", options_flow of scope prints for the per-bar sums, plot.marks with a size unit bound to a setting, a ladder-coloured histogram |
| Contract sides | The underlying's option contracts by side of the quote (above the ask, at the ask, the mid, at the bid, below the bid, no side), calls beside puts over today or the last bars, with each bar's bullish minus bearish contracts as a column | options_flow sums by side of the quote kept in a ring of bars, panel.bars with a per-run title |
| Strike footprint | The underlying's option flow strike by strike and bar by bar behind the candles: bullish net premium, the calls' or the puts' alone, or contracts, around each bar's close | option_ folded onto out.grid rows placed at strike prices, plot.heatmap with a diverging scale, a strike step learnt from the listed strikes |
| Premium tide | The whole options market's net call and net put premium (every US listed underlying, the coin on every crypto venue, or CME's market) summed through the session (the regular session on a US stock, the whole trading day on CME), each print capped, with the net volume below; tides over every strike or the out-of-the-money ones and every expiry or the same-day ones, several at once as one net line each | options_flow market scope, a param.multi gating each tide's inputs through when and when_bit, a histogram in a named pane, a card |
| Options market stats | The whole market's put/call ratios by contracts and by premium through the day, a table of the day for every underlying, equities, ETFs, indices and the same-day expiries, and a card that says which side leads | options_flow market scopes summed by trade date, a panel.table over a frame, breakdown rows gated by a param.multi |
| Net flow | Net call premium and net put premium on the chart's underlying (bought at the ask minus sold at the bid) summed through each session as two lines, the whole market's on a toggle, a card with the session's lean | options_flow fields as scalar inputs with missing: "nan", a scope: "market" input fetched only while a setting is on (when), sums restarting on time.trade_date |
| Flow VWAP | The chart's price weighted by the options premium bought at the ask since the session or the week, a line on the candles with dotted 1σ and 2σ bands lightly shaded, the premium of the chart's own chain or of another root (QQQ on an NQ chart), a card that reads where the close sits in σ | options_flow inputs on the chain a param.choice names (underlying: "@chain" over its style_values), a 0DTE set fetched only while a setting is on (when), a weighted Welford mean and deviation restarting on time.trade_date or its week, two fills |
| Options volume | The contracts each bar traded as stacked columns, calls above zero and puts below, split by side or into bullish, neutral and bearish, a card with the put/call ratio | one stack of bar outputs, positives up and negatives down, two splits written by one setting |
| Greek flow | The share delta and the vega the tape traded, bought at the ask minus sold at the bid, summed through each session in two panes, the out-of-the-money contracts on a toggle | sided options_flow model sums, a named pane for the second line, moneyness: "otm" behind when |
| NOPE | The session's option share delta as a percent of the stock's own volume, one line in the up colour above zero and the down colour below | options_flow beside the chart's ohlcv.volume, the session from time.session (the regular session on a US stock, the whole trading day on CME, by market.zone()), a split line |
| Interval flow | The contracts one bar's interval traded, ranked by premium or volume in a table with ask and bid shares, fill, IV and share of the day, a histogram of every bar's busy contracts | option_ read tuple by tuple, a session volume table by contract, hasBit for the VWAP and IV, a styled panel.table |
| Premium by strike | Net premium strike by strike as a heat map behind the candles on the chain's strike spacing, the session's net by strike docked on the price axis, partial bars dotted | option_ with strike_, out.grid and plot.heatmap with center: 0, plot.levels with per-row colours, isPartial |
Prediction markets
A Polymarket market's odds set against the market they move with.
| Recipe | What it does | What it teaches |
|---|---|---|
| Odds vs price | A Polymarket market's odds against a pinned asset: rolling correlation, a divergence histogram, the asset's close in a window below the chart, a verdict card | a leg pinned to another market, Correlation and Zscore, a four-rung ladder on a histogram |
HUDs
One card pinned to the price pane, in the chart's default look, that answers one question first and reads the numbers behind it underneath, kept current on the live bar.
| Recipe | What it does | What it teaches |
|---|---|---|
| Market HUD | The trend in a word, then RSI, the taker buy share and the last closed bar's volume against its average on three rings, ATR percent and the open-interest change in coins as a sparkline | one render.hud card in the default look, a headline pill coloured by a ladder output, a rings tile, data-only outputs read by the tiles |
| Decision board | A headline written from six factors ("Buyers Ahead, 3 to 1"), the net score as a sparkline and each factor's reading in a row | each factor as a rule with its thresholds as settings, counts as data-only outputs, a headline written into a string slot |
| Order flow HUD | Who is pushing price in a word, each bar's taker buy share as a sparkline, the window's buy share, the net taker delta in dollars and the liquidations on each side | side-split trades and liquidations, rolling windows kept as rings, a value tile with this bar's delta beside it |
| Order book HUD | The heavier side of the book in a word, the bid share within 1% of the mid on a meter, the dollars resting by distance and the biggest walls, dotted on price | book.cells read in two passes, depth bands summed by distance, line handles set on the live bar |
| Session HUD | The session trading now, how much of it has passed and the session up next, the share of an average day's range used, the close in today's range, the distance from the VWAP and the prior day's high and low | param.session windows read with inSession, a daily candles stream, a countdown written into a string slot |
| Greek exposure | The dealers' exposure one greek at a time (gamma, delta, vanna, charm, vega, IV times open interest, open interest) by strike on the price axis and by expiry under the chart, over every expiry, the same day, a week, a month, the nearest N or stacked by days to go, read in one plain line on a card | options_ on the live bar, the kit's Greeks for vanna and charm and GammaCurve for the regime and the flip, three plot.levels shapes and a panel.bars |
| Risk reversal skew | One expiry's risk reversal (the call's IV minus the put's) at nine deltas in bars under the chart, the 25 and 10 delta numbers, the four wing IVs and the smile's asymmetry, with puts rich, calls rich or flat as the card's headline | options_ on the live bar, the kit's IvTerm (nearest, deltaIv), a panel.bars with a per-run title |
| Expected move | The expected move by a horizon from 1 to 90 days or to the earnings expiry on a US stock or ETF (0.85 of the at-the-money straddle) beside the 1σ range, drawn as two pairs of rails from the prior session's close (today's 00:00 UTC open on crypto), each tagged on the price axis, with the at-the-money IV at seven constant maturities and the next six expiries' expected moves | the numbers and vol_term book folds read through BookStamp, OptionNumbers, Expected and VolTerm, timed from the book's priced instant, time.trade_date for the prior close, guide outputs with axis_label and axis_look for the rails |
| Volatility context | The term structure (contango, flat or backwardation from the 90-day over the 30-day at-the-money IV), the 25 delta skew over the 30-day IV (puts or calls rich) with the risk reversal, the 30-day IV against the realized volatility of the daily candles, and the front expiry's expected move, three verdicts in one line on a card | options_ on the live bar, the kit's ExpectedMoves (constant maturities, the expected move) and IvTerm (25 delta wings), a daily candles stream in a CandleList |
| Contract odds | One contract of the chart's chain, named by its settings and held to expiry: the odds of profit, the breakeven, the most it can make and lose and Kelly's fractions | options_ on the live bar, the kit's Greeks and normCdf, param.price and param.time naming the contract |
| Options stats | Today's option activity of the underlying, calls against puts: who leads by the put/call ratio, contracts and premium with their ratios, the net premium, the bullish share and the open interest with its change | options_flow fields over every expiry and the same-day ones summed over today's bars, option_ on the live bar, a headline pill |
| Option stance | Where the chart's underlying's options stand (the IV rank and percentile, dealer gamma against the gamma flip, the walls, the put/call ratios, the skew, the front move, the next earnings date) and whether selling premium, selling vega, directional, long-dated and cheap option buying run with it, against it or neither | scalar option_daily inputs landing once per session, the kit's DayHistory, market., pill tiles written by the rules |
| Options sentiment gauge | Fear to greed from 0 to 100 over the underlying's own options and price: six inputs scored by their percentile against their own history and blended once four score, a step line under the chart with guides at the band edges, and a dial | option_daily per session, a daily candles stream for momentum, one DayHistory per input, tile.gauge |
| Day type | The session's state from its 10-minute options statistics (pinned, trending, volatile or unsettled) and the counted odds that it holds 30 minutes to 2 hours on, the typical move, the forward range boxed ahead of the live bar and the levels on price | option_ samples on the bars holding them, outcomes counted per state and horizon, a box handle, a state ribbon |
| Estimated dealer positioning | An estimate of option dealers' book every ten minutes: the gamma regime and its hedge per 1% move, the charm drift to the close, the vanna hedge, the delta today's signed flow left behind and net gamma against 10 to 30 minutes ago | option_ keyed by 10-minute slot in a DayHistory, options_flow at the ask and the bid summed per session, two named panes |
| Spot exposures | The dealers' exposure bar by bar: a headline over every expiry from the 10-minute chain statistics (open interest), or from the strike rows of the expiries still trading and 7 or fewer trade days out (Greek exposure's week) where the chart has none; the headline's net gamma, delta or vega exposure as a line, the week's gamma flip and walls as step lines on price, a heat map of the week's exposure by strike behind the candles (the level or its change), and the gamma regime on a card with the week's net gamma in its rows | option_ for the headline, option_ as the strike kit fold with its curve row (fold: "kit", levels, curve: the server measures each bar's week), the kit's Option, NodeBoard and dealerRegime, an out.grid heat map, a split line |
| OI changes | Where open interest built and unwound since its prior observation: a board of the change by strike and expiry on the price axis (or the change in percent, the open interest, the day's volume or the net volume), the largest increases and decreases in a table, the net change on a card | option_ on the live bar, its present bits, three plot.matrix boards, a panel.table |
| Top contracts | The most active contracts by the day's volume, open interest, premium or gain in a table, the three most traded and the three most held strikes drawn across the chart, the top contract on a card | option_ on the live bar, a panel.table of styled cells, line and label handles |
| Options sentiment | One score from the volume-weighted strike offset of the day's volume and the 25 delta call IV minus put IV at 30 days, bullish at +20 and bearish at -20 on a meter, the IV gap as a line and the volume-weighted strike across the chart | option_ on the live bar, option_ on every bar (crypto, CME and US stock charts), the kit's totalVarianceIv |
Beyond the time axis
Views whose second axis is price, tenor or the calendar.
| Recipe | What it does | What it teaches |
|---|---|---|
| Volume profile and value area | The rolling volume profile docked on the price axis with POC and the value area lit, the three levels drawn with price tags, a heatmap of volume by UTC hour below the chart | volume_ as a block, plot.levels docked on the axis, panel.heatmap |
| Open Interest Profile | The current day, week or month's open interest change by price docked on the right as a two-sided column, the OI POC and value area tagged on the axis side, the period's bounds and its net change, the same rows on every chart finer than a week | oi_candles and volume_ streams a month deep, the forming hour from the chart's own bars, plot.levels with baseline: "center" and tag_place: "axis" |
| Options dashboard | Nine tiles over the chart's own option book (net GEX, the flip, the dealer regime, max pain, the put/call ratio, net VEX and net DEX over every live expiry, today's move in 1σ moves, the front expiry's 25-delta risk reversal), the gamma exposure curve over hypothetical spots with a signed fill and callouts, and a rolling CVD pane | one options_chain input naming three book folds (numbers, strike_profile, vol_term) read on the live bar through BookStamp, OptionNumbers, StrikeProfile and VolTerm, panel.tiles and panel.line over frames with markers and a caption, a named pane |
| Spot ETF flow | The chart coin's daily spot-ETF net flow as one bar per day, the running sum in a strip on the price pane, a wash behind each day's candles, a card | etf_ landing once per day, lower-pane box handles, out.inset, render.bgcolor |
| Liquidation map | An estimate of where open positions would be liquidated, docked on the price axis as a two-sided profile, the largest rows drawn across the chart with tags, a card | open interest split by taker side into leverage tiers, plot.levels with baseline: "center", line and label handles |
| Options odds cloud | Where the options market expects price to settle at an expiry, docked on the price axis as one hump with the most likely row marked, the 68% and 95% bands drawn across the chart, a card | options_ turned into odds per price row, per-row colours and a gradient on plot.levels, declared draw.line and plain draw.label drawings |
| Who is trading | The window's dollar volume shared out by trade size as a donut, bought against sold per size as bars with the verdict as the caption, a card with the whales' buy share | trade_ over a rolling window, panel.pie, panel.bars with a per-run caption |
| Rotation map | Eight coins placed by strength against BTC and its momentum on a four-quadrant map with trails, the leader's label carrying its move against BTC, and a card | nine hourly candles streams on Binance Futures smoothed in days, panel.scatter with guides, quadrants and trails, param.color inks written into the frame |
| Correlation matrix | How the chart's market moved with eight others as a market by market heatmap with an average row, a card with the most tied and most free markets | eight pins with missing: "nan", Pearson correlation on the live bar, panel.heatmap on category axes with a palette scale, a highlight row and a summary row |
| Venue share | Each venue's share of the last 24 hours of BTC dollar volume as a donut, a table of venue, last, premium, volume and share, a card with the widest premium | pinned close and volume on four venues, panel.pie, a styled panel.table, param.text and param.color settings, chart. |
| Volatility surface | Implied volatility by strike and expiry (the six nearest expiries, the 21 strikes nearest spot) as a heatmap with the row nearest the chart's price marked and an ATM summary row, the term structure as tiles, a card | the surface and vol_term book folds read through SurfaceMatrix and VolTerm, panel.heatmap with row_title, a summary row and a highlight row, panel.tiles, a render.legend entry |
| Volatility character | Realized volatility from the chart's own daily candles in one pane the View setting picks (historical volatility by window, the cone, the return structure, the seasonality or the character readings), a card naming the character with its half-life | one candles stream at 1d, prefix sums, five frames of which one is written, panel.line on time and number axes, panel.bars, panel.table, tile.pill and tile.meter |
| Strike breakdown | The underlying's options by strike, one chart per upcoming expiry, calls up and puts down: open interest, its change, contracts, premium or net premium today, totals in each chart's caption | option_ and option_ summed by contract over today, three panel.bars on a number axis of strikes |
| Market share | Each US options exchange's share of the market's contracts, today or over the newest sessions, nine exchanges by name (five picked by default) and the rest as Other, as a donut and a table, with the leader in a card | options_flow venue scope over the market scope's totals, nine exchanges gated by a param.multi, ten reads within a Plus chart's data budget, a ring of sessions, panel.pie and panel.table |
| Premium by expiry | The session's bullish minus bearish option premium per expiry as bars under the chart, or the two sides apart, labelled by date and days to go, a note at the top of the chart when a bar's contracts were cut down | option_ summed per expiry, the kit's fbExpiryLabel for the dates, a panel.bars with a per-run caption |
| Options at price | The options a stock traded over 1 to 30 sessions by the price it stood at, docked on the price axis as bullish, neutral and bearish (or calls and puts), in contracts or premium | options_flow rows kept in a ring at each bar's typical price, a stacked plot.levels with series and a poc_price |
| IV rank | Where the 30-day implied volatility sits against its past year: the IV rank and the IV percentile as step lines with guides at the bands, a card with the window's low, high and sessions, and a clear wait while the history is short | option_daily with missing: "nan", the kit's DayHistory (rank, percentile, span), step lines with guide outputs at the bands |
| Variance risk premium | The 30-day IV against the realized volatility of the chart's daily closes: the spread now, and the premium completed 21 sessions later (never drawn before it is known) with its rank's sell and stand-down zones read on a card | option_daily beside a daily candles stream, a forward-aligned history in a second DayHistory, spread columns coloured by sign |
| Skew history | The 30-day 25 delta risk reversal per session with its percentile and z-score, one expiry's risk reversal per bar from the option surface with partial bars on their own dotted line, that expiry's put tail with its z-score in five steps, the candles tinted where the risk reversal moves against spot, and the term structure now against its median and quartiles | option_daily and option_surface (crypto, CME and US stock charts) cells read through hasBit and isPartial, Day, a Zscore over solid bars, a buffer of past bars behind a render.barcolor gate, panel.line over category maturities |
| Volatility regime | The 30-day IV's z-score against its earlier sessions as columns, the candles of stressed bars (the IV at its 80th percentile or above) dimmed, and the vol of vol with its own percentile | Day and percentile, an exponentially weighted deviation, render.barcolor behind a gate |
| Exposure history | Dealers' net gamma, delta, vega, charm or vanna per session as columns, the walls, the gamma flip and max pain on price as steps, with the change from the prior session and the percentile | eleven option_daily fields, a lens param.choice, sign-coloured columns, a value tile with its change |
| Options history | Options volume, open interest or premium per session, the volume against its 30-session average, and a table of the newest sessions with the put/call ratio, the volume against its average, the open interest change and the IV | one DayHistory per field, stacked bar outputs, a panel.table written on the live bar |
| Seasonality grid | A year by month grid of returns on daily charts, a weekday by hour grid of the average move on intraday charts, the best cell named, a card | two candles streams of the chart's own market (26 weeks of 1h, 12 years of 1d) picked by chart., one panel.heatmap with a highlight and an Avg summary row, a signed scale |
| Depth curve | The order book as two cumulative staircases meeting at the mid, the biggest walls called out, the heavier side in the caption, a card with the ratio, the wall and the spread | book.cells summed outward from the mid, panel.line step series with fills, markers with an exact y, a caption |
| Yield curve | The Treasury curve today against a week and a month ago over a tenor axis, 2Y and 10Y callouts, the 2s10s spread on a card | nine economic.value pins, prints kept in a ring, days turned into bars with chart., panel.line with three series |
Strategies
Packages that trade: orders placed in the file, replayed by the Strategy Tester under the chart.
| Recipe | What it does | What it teaches |
|---|---|---|
| Moving-average cross | Long when the fast average crosses above the slow one, flat when it crosses back under, with a tinted ribbon and a mark on each cross | strategy(...) in the source, orders in onBar(), a range ribbon |
| Risk-sized reversion | Buys the dip as RSI leaves oversold, protects it with an ATR-sized stop and target, leaves on recovery; each trade's rails drawn on price | an entry sized from its stop with qty(...) and strategy., a protective exit re-armed each bar, rails as line handles |
How to use a recipe
- The ring is the loop: the Editor, Templates, the recipe's card, Run, a setting changed, a value read at the Console prompt, and back to the editor.
- Publish leaves the ring: the indicator goes to other charts, to readers and to alerts.
- The three verbs in the middle are what every recipe does: load a series, compute a number, draw it.
- Open the editor: the chart toolbar's Editor button, or the Build icon in the Indicators dialog.
- For a recipe that is also a template, press the Templates icon ("Browse starter templates") in the editor's Explorer and pick the recipe's card under its group. The pick fills an untouched draft, or opens in a tab of its own, with the
//@lang=wrun-tsline on top. For any other recipe, press New indicator in the Explorer, pick Blank indicator (a tab holding the//@lang=wrun-tsline alone), and paste the recipe's indicator block under that line. - Press Run on a liquid symbol. Run compiles the file in your browser and draws it on the chart. The order-flow recipes want a market where the venue reports buy and sell volume; each page's "Where it runs" names the markets it serves.
- Open the overlay's settings. Every setting is a row there, labelled by its description and drawn as the control its kind names (a number field bounded by its
minandmaxforparam(...)andparam.int, a toggle forparam.bool, a menu forparam.choice), so lookbacks and thresholds change without touching code, and a change reruns the indicator over the loaded bars. Colors are declared on the outputs, boxes, and segments, as theme words such astheme.upor as hex strings: edit them and Run again. - Read a value at the editor's Console prompt, which reads the last run without a new build (below).
- Publish it from the editor to add it to other charts, share it, or put an alert on it (Publishing, Alerts). A published indicator runs in each reader's browser, or on OpenMarket's servers when its code is Protected.
What the Console prompt answers after a Run, with the Volume spike detector's z as the output:
outputs every output with its value on the newest bar
params the settings the last run used
rows the bars the run covered, the first and last bar time, the warm-up bars
z the output's value on the newest bar
z[-3] the same output three bars back
last 20 z its last 20 bars; a data-only output reads the same wayMost recipes read the chart's own market and interval (Execution model). The ones that pin say so on their page. The chart serves a pin on a secondary ohlcv input: an interval coarser than the chart's and a whole multiple of it (Multi-timeframe), or another market at the chart's interval (Odds vs price). A market pin on any other source is refused by name, which is why Aggregated CVD reads the chart's own venue. Stocks, forex and gold pin the same way (Multi-source). On CME markets an indicator runs in the browser once you have accepted the CME market data terms, and the results stay on the chart.
What the recipes share
A few shapes come back in every recipe:
- State lives in module-level variables. A value that must survive from bar to bar is a module-level
let; a window of past values you index into is aStaticArray<f64>ring buffer, whichHistorypackages as a class (Stats, history and lists). - Decisions are numbers. A condition the chart should act on is a data-only
noneoutput written as1or0; the declarations turn it into a look throughshape_where,color_by, or a box'swhengate. - Calendar math comes from the bar's open time.
bar.time()is each bar's open in epoch seconds; dividing by 86400 gives the UTC day, and a boundary in that index is where sessions reset. - An output can carry an alert. Once the indicator is published and on a chart, the chart's alert dialog offers every drawn output with conditions such as Crosses above and Greater than, and a data-only gate becomes a ready-made signal through
alert(name, { when })in the file (Alerts).