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 with an explicitly selected
LocalPaperaccount before live use. Playback does not select the account automatically; the current release-candidate build rejects external-account order mutations while Playback is active.
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 |
| managed market entry/exit | EnterLong(...), EnterShort(...), ExitLong(...), ExitShort(...), or the matching Ctx.Orders managed helpers |
| managed limit/stop entry | EnterLongLimit(...), EnterShortLimit(...), EnterLongStopMarket(...), EnterShortStopMarket(...) |
| managed stop/target | SetStopLoss(...), SetProfitTarget(...) |
| advanced unmanaged order control | SubmitOrder(...) with explicit OrderAction, OrderType, price, OCO, and signal values |
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);
EnterLong(quantity, "Buy");
For normal strategy ports, translate entries, exits, stops, and targets to managed helpers first. Preserve direct order submission only when the original logic genuinely depends on advanced unmanaged behavior such as custom OCO groups, partial-fill handling, or explicit order-state transitions:
Order entry = SubmitOrder(
0,
OrderAction.Buy,
OrderType.Limit,
quantity,
limitPrice,
0,
ocoId,
"Advanced Buy Limit");
An unmanaged port must also translate its order-update, cancellation, rejection, partial-fill, and OCO recovery logic. Validate those paths in simulation before enabling live trading.
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.