NinjaScript To HyperionXScript Migration Guide
HyperionX can import ideas from NinjaScript-style indicators and strategies, but scripts must be converted to HyperionX APIs. Do not paste another platform script and expect it to run unchanged.
Migration Process
- Identify the script type: indicator, strategy, optimizer, commission, or addon.
- Create a new HyperionX script in the correct Code Lab category.
- Move only the useful calculation logic first.
- Convert lifecycle methods.
- Convert plots and panels.
- Convert drawing calls.
- Convert order calls.
- Convert extra series and multi-timeframe logic.
- Compile.
- Fix diagnostics.
- Compare output against the original platform on the same data.
- Test in simulation/playback before live use.
Concept Mapping
| External concept | HyperionX direction |
|---|---|
| indicator class | public class MyIndicator : Indicator |
| strategy class | public class MyStrategy : Strategy |
| defaults state | State.SetDefaults |
| configure/data-loaded setup | State.Configured |
| bar update | OnBarUpdate() |
| market data event | OnMarketData(MarketDataEventArgs marketData) |
| market depth event | OnMarketDepth(MarketDepthEventArgs marketDepth) |
| current bar | CurrentBar |
| bars in progress | BarsInProgress |
| current close | Close[0] |
| prior close | Close[1] |
| custom output series | Series<double> plus AddSeries(...) |
| plot | Plot plus AddPanePlot(...) |
| overlay setting | panes and plots, not IsOverlay |
| fixed text | Draw.FixedText(...) or Ctx.Drawing.FixedText(...) |
| text position enum | ChartHudAnchor |
| order submit | SubmitOrder(...) or Ctx.Orders |
| managed stop/target | SetStopLoss(...), SetProfitTarget(...) |
Calls To Replace
Replace these patterns:
Draw.TextFixed(...)
TextPosition.TopRight
IsOverlay
Buy(...)
Sell(...)
ShortSell(...)
Cover(...)
with HyperionX equivalents:
Draw.FixedText(this, "tag", "Text", ChartHudAnchor.TopRight);
AddPanePlot(plot);
SubmitOrder(0, OrderAction.Buy, OrderType.Market, quantity, 0, 0, "", "Buy");
Generated Support Regions
Do not paste external generated support/cache regions. HyperionX generates its own helper methods after Code Lab builds the custom assembly.
If helper methods are missing, fix the source script and rebuild.
Namespaces
Use HyperionX namespaces:
using HyperionX.Chart.Classes;
using HyperionX.Chart.Enums;
using HyperionX.Core.Attributes;
using HyperionX.Core.DataCalc;
using HyperionX.Core.Enums;
Strategies usually also use:
using HyperionX.Core.Market;
using HyperionX.Custom.Indicators;
Validation Checklist
Before considering a port complete:
- The script compiles in Code Lab.
- It appears in the correct platform window.
- The chart output matches expected values.
- Early bars do not throw.
- Multi-series indexes are guarded.
- Drawings update without duplicating old tags.
- Strategy orders are correct in simulation.
- Backtest results include commission and realistic costs.
- Logs are clean except known unrelated warnings.