Indicator Lab
Write custom indicators in a concise array formula language — price arrays H L O C V, data series like MKTCAP / DATE, overloaded operators and 37 built-in functions, computed by a WASM engine and rendered on TradingView lightweight-charts. Try H+L, MA(C,5) or a preset below.
Syntax cheat sheet
H L O C V — high / low / open / close / volume arrays (one value per bar of the loaded period)
Data series — extra raw data beyond OHLCV, referenced by name and auto-loaded/aligned to the bars (DATE/TIME are UTC; CoinGecko series are daily and forward-filled on intraday charts):
- DATE — Per-bar date as a YYYYMMDD number (UTC), e.g. 20260823.
- TIME — Per-bar time as an HHMM number (UTC), e.g. 1430.
- MKTCAP — CoinGecko historical market cap (USD). Daily granularity — on intraday charts it is a day-level step.
- TVOL — CoinGecko aggregate volume across all exchanges (USD, daily) — unlike V, which is the listed exchange only.
NAME:=expr; intermediate variable · NAME:expr; plotted output (can be referenced by later lines)
+ - * / arithmetic · > < >= <= = == <> != comparisons returning 0/1 · & && AND logical and · | || OR logical or
Plot hints: ,overlay on the price pane · ,stick histogram · ,color=#f0b90b
Comments: { } blocks and // lines; bars without enough history stay blank.
Function reference (0)
MACD for crypto — live chart, free in your browser
The Moving Average Convergence Divergence (MACD) tracks momentum by subtracting a 26-period EMA from a 12-period EMA. A 9-period EMA of that difference forms the signal line, and the gap between the two — plotted as the histogram — grows when momentum accelerates and shrinks as it fades.
This preset renders all three pieces under the price chart of any crypto pair. Because the underlying formulas are visible in the editor, you can retune the classic 12/26/9 settings, apply MACD to any interval from 15 minutes to 1 day, and the WASM engine recomputes everything locally on up to 1000 real candles.
How it works
- Pick any trading pair and an interval from 15 minutes to 1 day.
- The preset formula loads into the editor — every line stays visible and editable.
- The WASM engine evaluates it locally over up to 1000 real exchange candles.
- Results render instantly as price-pane overlays or sub-panes.
Frequently asked questions
What does the MACD histogram show?
The histogram is (MACD − SIGNAL) × 2 — twice the distance between the MACD line and its signal line. Tall bars mean momentum is expanding in that direction; bars shrinking toward zero mean the move is losing steam before the lines actually cross.
How do traders read MACD on crypto charts?
The most common signal is the MACD line crossing its signal line: crossing up is treated as building bullish momentum, crossing down as fading momentum. Many traders also watch for divergence — price making a new high while MACD does not — as a warning that a trend is weakening.
More indicator lab pages
RSI · KDJ · Bollinger Bands · Moving Averages · Volume · Bias · Williams %R · Rate of Change · MA Cross Signals
Related tools
MACD Cross in the Strategy Backtester · RSI in the Indicator Lab