AlertaScript: Writing Your Own Indicators and Strategies
9 min read
AlertaScript is AlertaChart's custom indicator language. It lets you write your own technical indicators, custom overlays, and full backtestable strategies — all rendered against the same live chart you use every day.
What you can build
- Custom overlays: lines, channels, bands drawn over the price pane. - Custom sub-panes: oscillators, ratio plots, anything that lives below the chart. - Alerts from indicator output: trigger an AlertaChart alert when your script's condition becomes true. - Backtests and strategy reports: a strategy mode produces win rate, profit factor, drawdown, and equity-curve charts via the Strategy Tester panel.
You can't (yet) place real orders from AlertaScript. The strategy mode is for analysis and reports — live trading is on the roadmap but isn't shipping today.
The editor
Open AlertaScript from the top nav. The editor is split into three columns: file tree on the left (your saved scripts), code in the middle, and a live preview chart on the right. Save stores the script in your library (Pro), Run executes it against the visible chart and renders the result, and Apply binds the script as a chart indicator so it travels with you across symbol switches.
What the language supports
- Built-in series: open, high, low, close, volume, time. - Math: math.abs, math.max, math.min, math.round, math.log, plus everything in JavaScript's Math accessible from the alerta. prefix. - Plotting: plot, plotshape, plotcandle, bgcolor, hline. - Conditionals + state: if/else, var for persistent state, ta.crossover, ta.crossunder, ta.highest, ta.lowest, plus most TA library functions. - Strategies: strategy.entry, strategy.exit, strategy.close_all with a Strategy Tester panel that produces metrics.
The alerta. namespace adds AlertaChart-specific built-ins: alerta.session, alerta.market_type, alerta.is_futures, alerta.funding_rate (futures only), alerta.open_interest (futures only).
Sharing scripts
The Share button generates a URL that loads your script into another user's editor when they click it. Useful for community templates. Scripts are read-only when loaded via share link until the recipient clones them into their own library.