Cookbook
Complete ChartScript recipes to copy, run and change - on price, order flow, liquidations and positioning, linked scripts, levels, tables, alerts and backtests.
Every recipe is a whole script that compiles and runs as it is. Copy it with Copy, or press Open in editor to start a new unsaved script from it, then change it until it is yours.
Each recipe has the same parts:
- The script: the complete code.
- How it works: the few ideas that make it tick, in order.
- Customize it: small changes worth trying.
- Run it: which charts, markets and plans it needs, and what it shows when its data is missing.
- Concepts used: the pages to read for more.
Within each group the recipes go from short and simple to longer and more advanced. The data recipes say which plan and which markets they need; every one still compiles and runs without its data, and then shows an empty pane or says why in its legend row.
#On price
Candles only: every market, every plan. Open the group.
| Recipe | What it does | What it teaches |
|---|---|---|
| EMA ribbon with a trend tint | Four EMAs colored by how they are stacked | ta.ema, conditional colors, fill |
| Volatility bands and squeezes | ATR bands shaded while the Bollinger Bands fit inside | tuples, [1], alert.on |
| Anchored VWAP from a date | A VWAP and its bands from a moment you pick | input.time, state sums |
| Session ranges | A growing box per trading session | sessions, functions with state, boxes |
| Higher-timeframe trend filter | Signals kept only with the higher timeframe's trend | request.tf, confirmed bars |
#Order flow
Taker flow per bar, per trade and per price row. Open the group.
| Recipe | What it does | What it teaches |
|---|---|---|
| Delta spikes | Taker delta columns with unusual bars marked | flow.delta, relative thresholds |
| Big prints on the chart | A dot for every large trade, sized by value | flow.prints, flow.print_threshold, labels |
| CVD divergence | Higher highs or lower lows that CVD does not confirm | flow.cvd, pivots, ta.valuewhen |
| Absorption from footprints | Heavy selling at the low that still closed high (Pro) | fp.* per-bar values |
| Stacked-imbalance zones | Footprint stacks kept as zones until price closes through (Pro) | fp.stacks, user types, arrays of boxes |
#Liquidations and positioning
Open interest, funding, the liquidation model and Hyperliquid positions. Open the group.
| Recipe | What it does | What it teaches |
|---|---|---|
| Open interest against price | Who is acting: longs or shorts opening or closing | oi.close, oi.usd, bgcolor |
| Funding extremes | Annualized funding and its z-score | funding.rate, ta.stdev |
| Liquidation levels near the price | The nearest long and short levels and their distance | liq.levels, lines, legend items |
| Hyperliquid net longs and shorts | Positions opened minus closed by Hyperliquid takers (Plus and up) | hl.*, hl.coverage |
#Linking scripts
One script shares, others read. Open the group.
| Recipe | What it does | What it teaches |
|---|---|---|
| Share a trend score | A producer of a score, a flag and flip events | share.series, share.event |
| Filter signals with a linked trend | An RSI filtered by the linked trend | link.script, link.confirmed, ready |
| Let the member pick the trend source | The producer chosen in the settings | input.script, needs |
| Share levels and draw them elsewhere | Prior-day levels shared and their breaks marked | share.level, h.levels, point in time |
#Levels, tables and alerts
Summaries, named levels and messages. Open the group.
| Recipe | What it does | What it teaches |
|---|---|---|
| Heads-up table | Move, RSI, ATR, volume, taker share, OI and funding in one corner | tables, na as "-" |
| Prior-day levels as level tags | Yesterday's high, low, close and today's open | request.tf, tag.new |
| Round numbers near the price | The nearest round numbers, kept tidy | a pool of tags, Auto placement |
| Alerts with their own numbers | Alert messages with placeholders and code-built text | alert.on, alert.send |
#Signals and backtests
Measuring an idea honestly in an indicator. Open the group.
| Recipe | What it does | What it teaches |
|---|---|---|
| A simple backtest in R | EMA-cross trades with stop, target and cost, results in R | tracking a position in state |
| Forward returns after a signal | The move after a signal next to the move after any bar | baselines, state arrays |
#Walk-throughs
Longer tutorials that build one indicator step by step, explaining every line.
| Tutorial | What you build |
|---|---|
| Moving average ribbon | Five EMAs, filled and colored by how they are stacked |
| RSI divergence marks | An RSI pane with pivot-based divergence marks |
| Volume spikes | A volume pane with spikes and alerts |
| Session high and low | The day's or a session's high and low as lines with labels |
| Multi-timeframe trend | A higher-timeframe EMA without repainting |
| Dashboard table | A corner table of trend, RSI and ATR |
#If a recipe does not work
- Nothing is drawn. Check the legend row: a data recipe says there when its data is missing on this market or plan. Try a Binance perpetual chart.
- A red underline in the editor. You changed something: the Problems tab names the line, and each code links its page in Error messages.
- A linked recipe says "Waiting for…" or "No access". Save the producer first, under the name its
indicator(...)gives.
#All pages
- Recipes: on priceFive scripts on candles alone - an EMA ribbon, volatility bands with squeezes, an anchored VWAP, session boxes and a higher-timeframe filter.
- Recipes: order flowFive scripts on who is buying and selling - delta spikes, big prints, CVD divergence, absorption and stacked-imbalance zones from footprints.
- Recipes: liquidations and positioningFour scripts on leverage and positioning - open interest against price, funding extremes, nearby liquidation levels and Hyperliquid net longs and shorts.
- Recipes: linking scriptsShare a trend score and prior-day levels from one script and read them in others - link.script, link.confirmed, input.script and shared levels.
- Recipes: levels, tables and alertsA heads-up table, prior-day levels and round numbers as level tags, and a script whose alerts carry their own numbers.
- Recipes: signals and backtestsMeasure a signal honestly in an indicator - a long and short backtest in R with stops, targets and costs, and forward returns against a baseline.
- Tutorial: moving average ribbonBuild a ribbon of five EMAs over the price, filled between the outer lines and colored green, red or gray by how the averages are stacked.
- Tutorial: RSI divergence marksAn RSI in its own pane with levels and a shaded band, plus triangle marks where simple pivot-based bullish and bearish divergences are confirmed.
- Tutorial: volume spikesA volume histogram colored by bar direction, its moving average, highlighted spikes and alert conditions that fire when volume jumps.
- Tutorial: session high and lowTrack the high and low of each day, or of a trading session you choose, with state variables, and draw them as lines with price labels.
- Tutorial: multi-timeframe trendRead an EMA from a higher timeframe with request.tf, plot it on a lower-timeframe chart, color by trend, and learn which at mode avoids repainting.
- Tutorial: dashboard tablePut a small table in a corner of the chart that shows the trend, RSI and ATR, created once and filled in on the last bar.