# OpenMarket Indicators > OpenMarket Indicators are chart indicators written as one TypeScript file. You write the file in the chart's editor, Run compiles it in your browser and draws it on the chart, and the same file publishes to the OpenMarket registry by scope and name, where alerts, screens, series, and backtests read it by metric id. The tree mirrors the kScript (legacy) docs section for section: getting started, core concepts, the function library, a cookbook of complete Indicators, FAQ, strategies and backtests, the migration from kScript (legacy), the quick and limits references, and releases. ## Getting Started - **Intro —** [What Indicators add](https://openmarket.xyz/indicators/getting-started/whats-new-v3.md): kScript (legacy) v3 turned a script from plot-an-indicator into model-a-trading-idea. Indicators keep everything scalar that v3 could do and add what a script… - **Intro —** [Introducing Indicators](https://openmarket.xyz/indicators/getting-started/introduction.md): Indicators are designed to be approachable whether you are coming from kScript (legacy), from Pine, or from a TypeScript codebase. Create technical indicators… - **Intro —** [Why Indicators](https://openmarket.xyz/indicators/getting-started/why-indicators.md): An Indicator is one TypeScript file that compiles in your browser, publishes as a versioned package under your name, and runs on your own machine unchanged… - **Intro —** [Indicators overview](https://openmarket.xyz/indicators/getting-started/overview.md): A complete guide to how an Indicator works: the four functions the host calls, the three ways state is kept between bars, the data types, how market data… - **Intro —** [First steps](https://openmarket.xyz/indicators/getting-started/primer-first-steps.md): Write your first Indicator and see a line appear on the chart. No prior experience with Indicators, or with kScript (legacy), is needed: by the end of this… - **Intro —** [Build your first Indicator](https://openmarket.xyz/indicators/getting-started/primer-first-indicator.md): Build a real EMA crossover step by step, one idea at a time, from a single average to a finished Indicator with a mark on every cross. On the last page you… - **Intro —** [Next steps](https://openmarket.xyz/indicators/getting-started/primer-next-steps.md): You built your first Indicator. Here is where to go next, framed by what you will want to do. You have a working crossover and you understand the three parts… - **Intro —** [The editor](https://openmarket.xyz/indicators/getting-started/the-editor.md): The chart's editor is where most Indicators start: Build on the chart toolbar opens it, New indicator seeds a TypeScript file, Run compiles it in your browser… - **Intro —** [Author with an agent](https://openmarket.xyz/indicators/getting-started/with-an-agent.md): om chat and any MCP client that connects to om share one set of Indicator tools: the agent scaffolds a workspace, writes the source, builds and installs the… - **Intro —** [Quick start: author on your machine](https://openmarket.xyz/indicators/getting-started/quick-start.md): Build, install, and read an Indicator from a terminal in five steps. The same file the chart editor compiles authors from your machine with the om CLI and bun… - **Intro —** [The CLI](https://openmarket.xyz/indicators/getting-started/cli.md): om indicator is the command group for authoring Indicators on your machine: the templates, a workspace, a build, a local install, and the reads that prove a… ## Core Concepts - **Reference —** [Data types](https://openmarket.xyz/indicators/core-concepts/data-types.md): The types an Indicator is built from. The file is AssemblyScript, TypeScript syntax over fixed-width numbers, so every value has a declared width and the… - **Reference —** [Variables: locals, module state, and history](https://openmarket.xyz/indicators/core-concepts/core-variables.md): Variable declaration and bar-state behavior in an Indicator: what a local in state() is, what a module-level variable is, and how a value with history is kept.… - **Reference —** [Type system](https://openmarket.xyz/indicators/core-concepts/type-system.md): A comprehensive guide to the Indicator type system: static typing, how types are inferred from literals, explicit casts, the per-bar value that replaces a… - **Reference —** [Collections](https://openmarket.xyz/indicators/core-concepts/collections.md): Arrays and maps in an Indicator, the loops that replace the reducer methods of kScript (legacy), sorting with a comparator, and the two limits that keep a… - **Reference —** [Lambdas and reducers](https://openmarket.xyz/indicators/core-concepts/lambdas-and-reducers.md): Arrow functions, function values, and the loops that replace the reducer methods of kScript (legacy) (map, filter, reduce, forEach, find, some, every). kScript… - **Reference —** [User-defined types](https://openmarket.xyz/indicators/core-concepts/user-defined-types.md): Define your own typed classes with fields and methods, construct them, call methods, and mutate state through this. Model trading state in the shape of the… - **Reference —** [NaN and color](https://openmarket.xyz/indicators/core-concepts/na-and-scalar-types.md): Working with missing values in an Indicator: NaN and the two-line helpers that replace the isna, nz, and fixnan builtins of kScript (legacy), how NaN behaves… - **Reference —** [Named streams](https://openmarket.xyz/indicators/core-concepts/named-streams.md): Multi-output indicators like Bollinger bands, MACD, and the stochastic produce several lines at once. In kScript (legacy) they returned one result whose… - **Reference —** [Multi-timeframe](https://openmarket.xyz/indicators/core-concepts/multi-timeframe.md): Read higher timeframes from any Indicator: on the chart, a bucket fold on time.bar_open_sec that confirms a candle only after it closes; on your machine, an… - **Reference —** [Multi-source and aggregation](https://openmarket.xyz/indicators/core-concepts/multi-source.md): Combine several markets, venues, and data types in one Indicator: other symbols and other venues through symbol + exchange pins, other feeds through their… - **Reference —** [Data sources](https://openmarket.xyz/indicators/core-concepts/data-sources.md): The market feeds an Indicator can read, the fields each one serves, the knobs each one takes or requires, and the celled source classes that serve a whole… - **Reference —** [Execution model](https://openmarket.xyz/indicators/core-concepts/execution-model.md): An Indicator is a function the host calls once per bar, oldest bar first, with state that lives between calls in module-level variables. This page is the… - **Reference —** [Repainting](https://openmarket.xyz/indicators/core-concepts/repainting.md): What repainting is, why it breaks backtests, and why an Indicator does not repaint by construction: state() sees one bar and nothing later, a higher timeframe… - **Reference —** [Time and sessions](https://openmarket.xyz/indicators/core-concepts/time-and-sessions.md): Read the current bar's clock and trading session from the time source: hour, day of week, day of month, month, year, and session predicates, all in UTC, all as… - **Reference —** [Keyword arguments](https://openmarket.xyz/indicators/core-concepts/keyword-arguments.md): In Indicators this is the options object on param, input, output, box, and segment: every optional setting of a declaration is a named field of its last… - **Reference —** [Color constants](https://openmarket.xyz/indicators/core-concepts/color-constants.md): The named colors a chart accepts in an Indicator's declarations, where a name is refused and a hex form is required, and how to build a palette array for… - **Reference —** [User-defined functions](https://openmarket.xyz/indicators/core-concepts/user-functions.md): Create custom, reusable functions with the function keyword: typed parameters, a typed return, default values, functions as values, and the rules that keep… ## Functions - **Reference —** [Script definition](https://openmarket.xyz/indicators/functions/script-definition.md): Everything a kScript (legacy) define(), input(), source(), and print() call did, an Indicator declares: placement per output, settings as param(...), feeds as… - **Reference —** [Strategy functions](https://openmarket.xyz/indicators/functions/strategy-functions.md): In Indicators this is the strategy({ ... }) declaration from ./gen/strategy beside the outputs (the engine's own setting names: capital, quantity, commission… - **Reference —** [Control flow](https://openmarket.xyz/indicators/functions/control-flow.md): Control flow decides what runs on each bar. An Indicator is AssemblyScript, so the toolkit is the familiar typed C-style one: if/else branches, for loops, the… - **Reference —** [Moving averages](https://openmarket.xyz/indicators/functions/moving-averages.md): These classes smooth price into a trend line or wrap it in a band. Every one of them ships in every workspace as part of src/sdk/ta.ts: the whole kScript… - **Reference —** [Oscillators](https://openmarket.xyz/indicators/functions/oscillators.md): Oscillators measure momentum, overbought and oversold pressure, and trend strength. Every oscillator of the kScript (legacy) roster ships in every workspace as… - **Reference —** [Trend indicators](https://openmarket.xyz/indicators/functions/trend-indicators.md): Trend indicators identify direction and strength: the directional movement system, the Ichimoku cloud, MACD, the parabolic stop-and-reverse, the ATR trailing… - **Reference —** [Special indicators](https://openmarket.xyz/indicators/functions/special-indicators.md): Four tools that do not fit the average-or-oscillator mold. VWAP tracks the volume-weighted fair price and can reset on a calendar anchor. Ichimoku bundles five… - **Reference —** [Volume indicators](https://openmarket.xyz/indicators/functions/volume-indicators.md): Volume indicators fold volume into the calculation to read buying and selling pressure, money flow, and participation. kScript (legacy) shipped mfi, obv, vwap… - **Reference —** [TA library](https://openmarket.xyz/indicators/functions/ta-library.md): Every workspace ships src/sdk/ta.ts: the whole kScript (legacy) TA catalog as stateful classes, one class per builtin, 52 in all. Each class folds one bar per… - **Reference —** [Volume profile](https://openmarket.xyz/indicators/functions/volume-profile.md): The volume_profile source carries a variable number of price-level buckets per bar, each one a low, high, buy, sell tuple, so "did buyers or sellers do the… - **Reference —** [Orderbook functions](https://openmarket.xyz/indicators/functions/orderbook-functions.md): Orderbook functions read a book snapshot to measure depth, the distribution of resting liquidity, and bid-versus-ask pressure. kScript (legacy) shipped six… - **Reference —** [Plotting](https://openmarket.xyz/indicators/functions/plotting.md): An Indicator draws by declaring, not by calling. In kScript (legacy) a plotLine(...) call ran on every bar and handed the chart a styled series; an Indicator… - **Reference —** [Drawing objects](https://openmarket.xyz/indicators/functions/drawing-objects.md): kScript (legacy) drawings were objects you created and owned: line.new(), box.new(), label.new(), polyline.new(), linefill.new(), and table.new() returned… - **Reference —** [Drawing primitives](https://openmarket.xyz/indicators/functions/drawing-primitives.md): Declarative visuals over outputs and string slots: markers on some bars, a background tint, a band between two lines, a dashboard's cells and a status card.… - **Reference —** [Styling](https://openmarket.xyz/indicators/functions/styling.md): How outputs draw. The rule that keeps packages portable: outputs are numbers, some numbers are decisions, and the sheet maps decisions to looks. Styling is… - **Reference —** [Typed inputs](https://openmarket.xyz/indicators/functions/typed-inputs.md): param() turns a value into a setting users can change without editing code. Each param you declare shows up in the chart's settings for the overlay and in om… - **Reference —** [Alerts](https://openmarket.xyz/indicators/functions/alerts.md): An alert on an Indicator is a watch condition on one of its outputs: nothing in the file declares it, and every output, drawn or not, is a metric an alert can… - **Reference —** [Libraries](https://openmarket.xyz/indicators/functions/libraries.md): Sharing code between Indicators is publishing a package: the unit of reuse on the registry is a whole Indicator, addressed as @scope/name, that anyone installs… - **Reference —** [Publishing](https://openmarket.xyz/indicators/functions/publishing.md): Publishing turns an Indicator into a release on the OpenMarket platform: om publish sends the package (the built module, the sheet, the manifest and the one… - **Reference —** [Math functions](https://openmarket.xyz/indicators/functions/math-functions.md): The kScript (legacy) math namespace becomes AssemblyScript's Math: absolute value, rounding, powers and roots, logarithms, and the full trig and hyperbolic… - **Reference —** [Color functions](https://openmarket.xyz/indicators/functions/color-functions.md): kScript (legacy) built colors at runtime: color.rgb, color.new, opacity, lighten, darken, blend, and a colorGradient that mapped a value onto a ramp per bar.… - **Reference —** [String functions](https://openmarket.xyz/indicators/functions/string-functions.md): Strings in an Indicator live in string slots: byte-capped channels written once per ready bar in finalize() and read by text renderers and drawing labels. They… - **Reference —** [Series functions](https://openmarket.xyz/indicators/functions/series-functions.md): Series functions answer the questions that come up constantly when writing an indicator: did two lines just cross, is a series rising, what is the highest high… - **Reference —** [Utility functions](https://openmarket.xyz/indicators/functions/utility-functions.md): Statistics over a window, cross detection, level helpers, and value validation: the building blocks the kScript (legacy) utility page grouped together. In… - **Reference —** [Conditionals and loops](https://openmarket.xyz/indicators/functions/loops.md): Conditionals and loops control which code runs during each bar's state() call. Use them for decision logic, counted iteration over a buffer, and conditional… - **Reference —** [Foreign-domain panes](https://openmarket.xyz/indicators/functions/foreign-panes.md): In Indicators this is render.table over string slots for a grid of values at a viewport anchor, and render.stats_row for a per-bar strip under the price pane… ## Cookbook - **Recipes —** [Cookbook](https://openmarket.xyz/indicators/cookbook/overview.md): Complete, working Indicators you can copy, run, and adapt: the kScript (legacy) cookbook's recipes, each shown as the kScript you know beside the Indicator it… - **Recipes —** [Volume Spike Detector](https://openmarket.xyz/indicators/cookbook/volume-spike.md): Flag bars whose volume blows past its trailing average, scored as a z-score against a rolling mean and standard deviation. The kScript (legacy) recipe and the… - **Recipes —** [Anchored VWAP](https://openmarket.xyz/indicators/cookbook/anchored-vwap.md): Weekly and daily VWAP that reset on real UTC session boundaries, with a shaded band and a stretch readout for mean-reversion context. The kScript (legacy)… - **Recipes —** [Regime Filter (4h Trend Gate)](https://openmarket.xyz/indicators/cookbook/regime-filter.md): A no-repaint higher-timeframe trend gate that tints a line by regime and only marks entries when the confirmed 4h trend agrees with the signal. The kScript… - **Recipes —** [Key Levels](https://openmarket.xyz/indicators/cookbook/key-levels.md): Prior-day and prior-week highs and lows plus the running day open, drawn as horizontal levels that are calendar-correct on any chart interval. The kScript… - **Recipes —** [Aggregated CVD](https://openmarket.xyz/indicators/cookbook/aggregated-cvd.md): One cumulative volume-delta line with volatility bands and sign coloring, first on the chart's own market, then summed across four exchanges with a live venue… - **Recipes —** [Whale vs Retail CVD](https://openmarket.xyz/indicators/cookbook/tape-reader.md): In Indicators this is not available yet as the kScript (legacy) recipe: the trade_volume_by_size class that hands every bar's tape pre-bucketed into USD order-… - **Recipes —** [Zone Tracker](https://openmarket.xyz/indicators/cookbook/zone-tracker.md): Supply and demand zones drawn as boxes that switch themselves off when price mitigates them, with a live count of the zones still active. The kScript (legacy)… - **Recipes —** [HUD terminal](https://openmarket.xyz/indicators/cookbook/hud-terminal.md): A terminal-style readout the package draws itself: a title bar, a body box, and four left-aligned rows (last close, the bar's change, a rolling 20-bar signed… - **Recipes —** [Historical Returns Matrix](https://openmarket.xyz/indicators/cookbook/historical-returns.md): In Indicators this is a table, not a matrix pane: there is no renderer that ignores the time axis, so the kScript (legacy) month-by-year grid has no Indicator… - **Recipes —** [Market decision dashboard](https://openmarket.xyz/indicators/cookbook/market-dashboard.md): A six-row decision table the package keeps beside the chart: the close against its EMA, RSI, ATR as a share of price, volume against its own average, the open-… - **Recipes —** [Multi-timeframe terminal](https://openmarket.xyz/indicators/cookbook/multi-timeframe-terminal.md): The chart's own trend on the price pane, a side window of the 4h context, and the last 4h swing levels docked on the price axis, all from one file. Two EMA… - **Recipes —** [Viewport-anchored market HUD](https://openmarket.xyz/indicators/cookbook/viewport-hud.md): A regime readout the package draws itself: one box and four left-aligned rows pinned to the top-left corner of the price pane (the close's distance from EMA 50… - **Recipes —** [Large prints](https://openmarket.xyz/indicators/cookbook/large-prints.md): The live trade tape filtered by size, in four surfaces: every print of 5 or more (in the market's own amount unit) reaches the Indicator as one block per bar… - **Recipes —** [Plots and panes](https://openmarket.xyz/indicators/cookbook/plots-and-panes.md): Two exponential averages on the price pane, cumulative volume delta as an area and the bar's own delta as columns together in the package's lower pane, and two… - **Recipes —** [A series with an address](https://openmarket.xyz/indicators/cookbook/series-address.md): A package that reads a series by its address, plots it in the lower pane and keeps the latest reading in a status card. The series is one your own daemon… ## FAQ - **Topics —** [General FAQ](https://openmarket.xyz/indicators/faq/general.md): Frequently asked questions about Indicators, grouped the way the kScript (legacy) FAQ is grouped: getting started, data sources and context, technical… - **Topics —** [Best Practices](https://openmarket.xyz/indicators/faq/best-practices.md): Guidelines for writing Indicators that are fast, honest about warm-up, and safe to replay: where state lives, what reset() owes the forming bar, why the… - **Topics —** [Limitations](https://openmarket.xyz/indicators/faq/limitations.md): What an Indicator does not do yet, and where to find the numbers. An Indicator is a sandboxed, declared computation over market data; a few things a kScript… - **Topics —** [Common Errors](https://openmarket.xyz/indicators/faq/common-errors.md): The messages an Indicator author actually meets, each with its cause and its fix, in the order the build produces them: declaration errors first, then the… - **Topics —** [Debugging](https://openmarket.xyz/indicators/faq/debugging.md): A practical workflow for finding out why an Indicator is wrong: emit what you cannot see, read the Problems lane, isolate one output, read the numbers on your… - **Topics —** [Exchange and Symbol Format](https://openmarket.xyz/indicators/faq/symbol-format.md): The exchange ids and the venue-native symbol spellings an Indicator uses everywhere a market is named: pinned inputs, om metric get and om metric series, watch… ## Strategies - **Backtesting —** [Strategies Overview](https://openmarket.xyz/indicators/strategies/overview.md): A strategy is an Indicator that places orders. The file declares strategy({ ... }) beside its outputs and calls strategy.long, strategy.exit, strategy.closeAll… - **Backtesting —** [Build Your First Strategy](https://openmarket.xyz/indicators/strategies/first-strategy.md): One idea taken from a sentence to a backtest you can evaluate honestly: write the strategy as one Indicator file, install it, run it, read every part of the… - **Backtesting —** [Reading the Strategy Tester](https://openmarket.xyz/indicators/strategies/reading-the-tester.md): A strategy package produces the same result on every host that runs it: the Strategy Tester panel under a chart, the backtest card in the terminal, and the… - **Backtesting —** [Writing Strategies](https://openmarket.xyz/indicators/strategies/writing-strategies.md): The strategy({ ... }) declaration, the order API from ./gen/strategy, the position model and sizing. The semantics are the kScript (legacy) engine's own: the… - **Backtesting —** [Perps and Leverage](https://openmarket.xyz/indicators/strategies/perps-and-leverage.md): Declare a perps strategy, and understand leveraged margin sizing, liquidation, maker and taker fees, funding and the perps stats. The formulas are the kScript… - **Backtesting —** [Fill Simulation](https://openmarket.xyz/indicators/strategies/fill-simulation.md): How the broker decides when and at what price orders fill, how a bar that could have filled two levels is settled, and how the run reports its own precision.… - **Backtesting —** [Slippage and Costs](https://openmarket.xyz/indicators/strategies/slippage-and-costs.md): Commission on spot, maker and taker fees on perps, and flat slippage, each declared in the file so a shared package carries its own assumptions. The accounting… - **Backtesting —** [Perps: Margin, Liquidation, and Funding](https://openmarket.xyz/indicators/strategies/perps.md): instrument: "perps" switches the broker from spot accounting to isolated-margin perpetual futures: leverage, maker and taker fees, funding settlement and… - **Backtesting —** [Stats Reference](https://openmarket.xyz/indicators/strategies/stats-reference.md): Every performance stat the run reports, its exact formula, and its edge cases. The stats are computed by the kScript (legacy) engine's own statistics module… - **Backtesting —** [Examples: Spot Strategies](https://openmarket.xyz/indicators/strategies/examples-spot.md): Three complete spot strategies, the ports of the three kScript (legacy) examples: a two-line trend follower, a reversion with a protective stop, and bracketed… - **Backtesting —** [Examples: The Five Perps Scenarios](https://openmarket.xyz/indicators/strategies/examples-perps.md): The five canonical perps scripts behind the kScript (legacy) engine's acceptance battery, ported as Indicator files: liquidation on both sides, fee… - **Backtesting —** [Backtest a Hyperliquid Perp Strategy](https://openmarket.xyz/indicators/strategies/examples-hyperliquid.md): Hyperliquid trades as perpetuals: leveraged, funded and liquidatable. A backtest that ignores those three facts will happily approve a strategy the venue would… ## Migration - **Guide —** [kScript (legacy) v1 vs v2](https://openmarket.xyz/indicators/migrations/v1-vs-v2.md): In Indicators this is nothing to migrate: an Indicator has no language versions, only four sheet contracts (abi_version: "wrun-1", frozen forever, then the… - **Guide —** [From kScript (legacy)](https://openmarket.xyz/indicators/migrations/from-kscript.md): kScript (legacy) is frozen at v3: published kScript indicators keep charting and hosted-alerting forever on the pinned engine, and nothing existing breaks.… - **Guide —** [kScript (legacy) construct map](https://openmarket.xyz/indicators/migrations/construct-map.md): Every kScript (legacy) construct beside the Indicator form that replaces it, grouped by lifetime: a value on every bar, a snapshot of the finished run, or an… ## Reference - **Lookup —** [Quick reference](https://openmarket.xyz/indicators/reference/quick-reference.md): The Indicator kit on one screen, then the parts of it that are easiest to forget: the four exports, the generated accessors (the p_ / in_ / out_ families plus… - **Lookup —** [Limits reference](https://openmarket.xyz/indicators/reference/limits.md): Every ceiling an Indicator runs under, in one place: the declaration caps the sheet validator enforces, the runtime ceilings the sandbox enforces on every… ## Releases - **Docs —** [Releases overview](https://openmarket.xyz/indicators/releases/overview.md): How Indicator releases are versioned, what each one carries, how om upgrade moves your machine onto it, and the checklist to run afterwards. kScript (legacy)… - **Docs —** [Release notes](https://openmarket.xyz/indicators/releases/changelog.md): Every change to Indicators in the om CLI's changelog, newest first, one section per release: the runtime and its four contracts, the sheet, the scaffold and…