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
| Member | Purpose |
|---|---|
DisplayName | Display name including input and parameter values. |
Data | Runtime series value data. |
IsEnabled | Whether the indicator is enabled after runtime errors. |
LastError | Last indicator error message. |
LastErrorBar | Bar where the last error occurred. |
DisableReason | Why the indicator was disabled. |
Count | Count 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. |
Plots
Plot controls appearance.
new Plot(
Colors.DeepSkyBlue,
"Signal",
2,
PlotLineType.Solid,
PlotChartType.Linear);
Supported plot line types:
PlotLineType.SolidPlotLineType.Dashed
Supported plot chart types:
PlotChartType.LinearPlotChartType.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);
}
If a helper is missing, the indicator likely failed to compile, has a duplicate class name, or lives in the wrong namespace.
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.