Documentation
1. Authoring Overview
- Created
- Jun 5, 2026
- Updated
- Jun 5, 2026
Fractal Chart lets you write your own custom indicators and backtest strategies. Both are authored through the same engine with the same language and rules, so what you learn for one transfers directly to the other.
One engine, two surfaces
- Custom indicators are written in the custom-indicator editor and plot values on the chart. See Writing Custom Indicators.
- Strategies are written in the Strategy Tester's Compose tab and place trades during a backtest. See Writing Strategies.
Under the hood both compile through one authoring engine: your code is transpiled with TypeScript types stripped (never type-checked), wrapped in strict mode, and run with browser globals hidden.
The per-bar model
Authored code is a module you export default, with two lifecycle hooks:
export default {
name: "My Study",
init(ctx) {
// optional — runs once before the bars. Read config, set up state on `this`.
},
next(ctx) {
// runs once per bar, oldest → newest. Emit values / submit orders here.
}
};
next(ctx) runs once per bar in order, and state you keep on this (or via ctx.var/ctx.series) persists across bars — so each bar's work is O(1) rather than recomputing the whole history. A bare top-level return { … } is also accepted.
What's in this section
- Authoring Language & Syntax — the supported TypeScript/JavaScript and what is rejected.
- Writing Custom Indicators — the editor, plots, inputs, and styles.
- Custom Indicator API Reference — the full
ctxsurface for indicators. - Writing Strategies, the Strategy API Reference, and Composing Indicators & Patterns.
Next steps
Start with the language both surfaces share.