Skip to main content

Indicator Reference

Indicators inherit from Indicator in the HyperionX.Custom.Indicators namespace. The generated Indicator base derives from IndicatorBase.

Minimal Indicator

using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Windows.Media;
using System.Xml.Serialization;
using HyperionX.Chart.Classes;
using HyperionX.Chart.Enums;
using HyperionX.Core.Attributes;
using HyperionX.Core.DataCalc;
using HyperionX.Core.Enums;

namespace HyperionX.Custom.Indicators;

public class MyMomentum : Indicator
{
private Plot _plot;

[HyperionXProperty]
[Display(Name = "Period", GroupName = "Parameters", Order = 1)]
public int Period { get; set; }

[Browsable(false)]
[XmlIgnore]
public Series<double> Momentum { get; set; }

public override void OnStateChanged()
{
if (State == State.SetDefaults)
{
Name = "My Momentum";
Version = "1.0";
Period = 14;
_plot = new Plot(Colors.DeepSkyBlue, "Momentum", 2, PlotLineType.Solid, PlotChartType.Linear);
AddPanePlot(_plot);
}
else if (State == State.Configured)
{
Momentum = new Series<double>();
AddSeries(Momentum);
_plot.DataSource = Momentum;
}
}

public override void OnBarUpdate()
{
if (CurrentBar < Period + 1)
return;

Momentum[0] = Close[0] - Close[Period];
}
}

IndicatorBase Members

MemberPurpose
DisplayNameDisplay name including input and parameter values.
DataRuntime series value data.
IsEnabledWhether the indicator is enabled after runtime errors.
LastErrorLast indicator error message.
LastErrorBarBar where the last error occurred.
DisableReasonWhy the indicator was disabled.
OutputSeriesRead-only snapshot of every numeric series registered through AddSeries(...).
CountCount of the primary output series.
this[int barsAgo]Primary output series value.
GetValueAt(index)Reads primary output by absolute index.
GetRange(startIndex, count)Reads a range from primary output.

Registered Outputs

Every call to AddSeries(...) adds a numeric output to OutputSeries. Registration order matters: the first registered series is the indicator's primary output and backs Count, this[barsAgo], GetValueAt(...), and GetRange(...).

Register at least one series when another indicator, a strategy, or a local analysis tool must consume the indicator numerically. An indicator with drawings only can leave OutputSeries empty, but its primary-series members must not be used because they require the first registered output.

Plots

Plot controls appearance.

new Plot(
Colors.DeepSkyBlue,
"Signal",
2,
PlotLineType.Solid,
PlotChartType.Linear);

Supported plot line types:

  • PlotLineType.Solid
  • PlotLineType.Dashed

Supported plot chart types:

  • PlotChartType.Linear
  • PlotChartType.Bars

Pane Behavior

Use AddPanePlot(plot) for a standard indicator panel. Use AddPane("Name") when the indicator needs a named panel.

var pane = AddPane("Volume Delta");
AddPanePlot(pane, _deltaPlot);

Do not use IsOverlay from another platform. HyperionX panel behavior is controlled through panes and plots.

Generated Helpers

After custom scripts compile, HyperionX generates helper methods for indicators. A class named SMA with a Period parameter can be called from indicators and strategies.

private SMA _sma;

public override void OnStateChanged()
{
if (State == State.Configured)
_sma = SMA(20);
}

Generated helper support is namespace-specific. For reliable helper generation, declare the public indicator directly as : Indicator in exactly HyperionX.Custom.Indicators. A matching folder name does not substitute for the namespace, and a fully qualified or indirect base declaration is not a supported helper-generation pattern. Runtime base-type discovery can find some classes outside that namespace, but the generated indicator and strategy helper methods target HyperionX.Custom.Indicators.

If a helper is missing, the indicator likely failed to compile, has a duplicate class name, or does not follow that namespace and base declaration.

Optional Analysis And Research Providers

Numeric outputs and structured events use separate contracts.

IIndicatorAnalysisProvider from HyperionX.Core.Interfaces lets an indicator expose recent, read-only events to local analysis tools:

public IReadOnlyList<IndicatorAnalysisEvent> GetRecentAnalysisEvents(int maxCount)

Each IndicatorAnalysisEvent can describe its absolute BarIndex, time, kind, direction, label, prices, numeric value, and details. Honor maxCount, return an empty list when there are no events, and keep the method free of order or UI side effects.

IResearchFeatureProvider from HyperionX.Core.ResearchLab lets the research dataset builder request named numeric features at an absolute bar index:

public IEnumerable<ResearchIndicatorFeature> GetResearchFeatures(int barIndex)

Each returned feature has a Name and Value. Provider exceptions are isolated by the current consumers and the failed event or feature set is omitted, so providers should return deterministic data and handle unavailable bars explicitly. Use OutputSeries for continuous numeric series, IIndicatorAnalysisProvider for discrete user-facing events, and IResearchFeatureProvider for research-dataset columns.

Overlay Rendering

Indicators that need custom drawing can implement IChartOverlayRenderer.

Use this for:

  • bar timers
  • order-flow overlays
  • volume profile rendering
  • labels that need exact pixel placement
  • heatmaps and custom chart objects

Do not reach into WPF chart internals from script code. Use IChartRenderContext.

Error Isolation

Indicators can be disabled after runtime exceptions instead of taking down the whole chart. Use early-bar guards and null checks so errors do not happen in the first place.