Skip to content

Indicator catalog (metadata)

Use the indicator catalog to discover indicators, inspect their parameters and results, build pickers or configuration UIs, and execute a selected indicator without hard-coding its method call.

  • Discover indicators, parameters, and results at runtime
  • Build configuration UIs from indicator metadata, or export it to JSON or Markdown
  • Execute a selected indicator from its listing, without hard-coding the method call

Non-idiomatic

The Catalog provides a programmatic way to interact with indicators and options; however, it is not the idiomatic .NET way to use this library. See the examples in the Guide for normal usage.

Browse and search the catalog

All query methods are on the static Catalog class and return IndicatorListing metadata (no calculations are run).

csharp
using FacioQuo.Stock.Indicators;

// all listings
IReadOnlyList<IndicatorListing> all = Catalog.Get();

// a single listing by ID + style (null if not found)
IndicatorListing? emaSeries
  = Catalog.Get("EMA", Style.Series);

// all styles available for one ID
IReadOnlyList<IndicatorListing> allEma
  = Catalog.Get("EMA");

// filter by style
IReadOnlyList<IndicatorListing> seriesOnly
  = Catalog.Get(Style.Series);

// filter by category
IReadOnlyList<IndicatorListing> movingAverages
  = Catalog.Get(Category.MovingAverage);

// partial-match search on ID or name (empty query returns all)
IReadOnlyList<IndicatorListing> matches 
  = Catalog.Search("average");
MethodReturnsDescription
Get()IReadOnlyList<IndicatorListing>All listings
Get(string id, Style style)IndicatorListing?One listing, or null if not found
Get(string id)IReadOnlyList<IndicatorListing>All styles for an ID
Get(Style style)IReadOnlyList<IndicatorListing>Listings of a given style
Get(Category category)IReadOnlyList<IndicatorListing>Listings in a category
Search(string query)IReadOnlyList<IndicatorListing>Partial (case-insensitive) match on ID or name

Listing metadata

Each IndicatorListing describes one indicator-and-style combination. This is the metadata you bind a UI to.

PropertyTypeDescription
UiidstringUnique indicator ID (e.g. "EMA")
NamestringDisplay name
StyleStyleSeries, Buffer, or Stream
CategoryCategoryIndicator category (see below)
ParametersIReadOnlyList<IndicatorParam>?Input parameters (null when there are none)
ResultsIReadOnlyList<IndicatorResult>Output fields the indicator produces
ReturnTypestring?Result type name
MethodNamestring?Method name, for automation use cases
LegendTemplatestringLegend template for charting

IndicatorParam (each input parameter):

PropertyTypeDescription
DisplayNamestringHuman-friendly label
ParameterNamestringMethod parameter name (use this with WithParamValue)
DataTypestringParameter type name
Descriptionstring?Optional description
IsRequiredboolWhether the parameter must be supplied
DefaultValueobject?Default value, if any
Minimum / Maximumdouble?Recommended bounds, if any
EnumOptionsDictionary<int, string>?Allowed values for enum parameters (null otherwise)

IndicatorResult (each output field):

PropertyTypeDescription
DisplayNamestringHuman-friendly label
DataNamestringResult property name (e.g. "Ema")
DataTypeResultTypeCharting/display hint
IsReusablebooltrue for the field exposed as the chainable IReusable.Value

Example — inspect an indicator's inputs:

csharp
IndicatorListing? listing = Catalog.Get("EMA", Style.Series);

foreach (IndicatorParam p in listing?.Parameters ?? [])
{
    Console.WriteLine(
        $"{p.DisplayName} ({p.DataType}), required: {p.IsRequired}, default: {p.DefaultValue}");
}

Enums

  • Style: Series, Buffer, Stream — the three indicator styles.
  • Category: Undefined, CandlestickPattern, MovingAverage, Oscillator, PriceChannel, PriceCharacteristic, PricePattern, PriceTransform, PriceTrend, StopAndReverse, VolumeBased.
  • ResultType: Default, Centerline, Channel, Bar, BarStacked, Point — display hints for charting libraries.

Export the catalog

These extension methods serialize an IReadOnlyList<IndicatorListing> (typically Catalog.Get()). Each accepts an optional file path; when provided, the content is written to that file and also returned.

csharp
IReadOnlyList<IndicatorListing> catalog = Catalog.Get();

// JSON (indented, camelCase, string enums)
string json = catalog.ToJson();
catalog.ToJson("catalog.json");                       // also writes to file

// Markdown checklist: "- [ ] {id}: {name} ({styles})"
string checklist = catalog.ToMarkdownChecklist();

// Markdown table with ID, Name, Series, Buffer, Stream columns
string table = catalog.ToMarkdownTable();
MethodOutput
ToJson(filePath?)JSON array of listings
ToMarkdownChecklist(filePath?)Markdown checklist, one row per indicator ID
ToMarkdownTable(filePath?)Markdown table with a column per style

Execute from a listing

Look up a listing, then run it for strongly-typed results without calling the indicator's extension method directly:

csharp
IndicatorListing indicatorListing = Catalog
  .Get("EMA", Style.Series)
  ?? throw new InvalidOperationException("Indicator 'EMA' (Series) not found.");

// run with the catalog's default parameters
IReadOnlyList<EmaResult> emaWithDefaults = indicatorListing
  .Execute<EmaResult>(bars);

// or override parameters with the fluent builder
IReadOnlyList<EmaResult> emaWithParams = indicatorListing
  .WithParamValue("lookbackPeriods", 10)
  .FromSource((IEnumerable<IBar>)bars)  // cast selects the bars overload
  .Execute<EmaResult>();

The fluent ListingExecutionBuilder supports WithParamValue(name, value), WithParams(dictionary), FromSource(bars), FromSource(series, parameterName?) for chaining off another indicator's results, and Execute<TResult>(). Parameter values are type-checked against the listing's IndicatorParam metadata.

✨ Tip: disambiguate the bars overload

Because Bar implements both IBar and IReusable, a bars collection matches both FromSource(bars) and the FromSource(series, …) chaining overload. Cast to (IEnumerable<IBar>) (as above) to select the bars overload. The simpler listing.Execute<TResult>(bars) form needs no cast.

Execute from a saved configuration

IndicatorConfig is a serializable description of an indicator selection and its parameter overrides — useful for persisting a user's choices (per strategy, dashboard, etc.) and replaying them later.

csharp
// build (or deserialize) a configuration
IndicatorConfig config = new()
{
    Id = "EMA",
    Style = Style.Series,
    Parameters = new Dictionary<string, object> { ["lookbackPeriods"] = 20 }
};

// run it against bars
IReadOnlyList<EmaResult> results = config.Execute<EmaResult>(bars);

Use config.ToBuilder() to obtain a ListingExecutionBuilder for further fluent configuration, or IndicatorConfig.FromBuilder(builder) to capture an existing builder's settings back into a config for storage.

See also